xsodata - codbex/codbex-kronos GitHub Wiki
.xsodata
In SAP HANA Extended Application Services (SAP HANA XS), the persistence model (for example, tables, views, and stored procedures) is mapped to the consumption model that is exposed to clients - the applications you write to extract data from the SAP HANA database.
You can map the persistence and consumption models with the Open Data Protocol (OData), a resource-based Web protocol for querying and updating data. An OData application running in SAP HANA XS is used to provide the consumption model for client applications exchanging OData queries with the SAP HANA database.
Reference
The information on how to develop and transform a design-time xsodata object for a Kronos application.
SAP Help
Additional Information
Parser Supported Syntax
| Supportable | XSOData Syntax | (XSODataParser) | XTransformer | MTransfrmer | HTransformer | Comments |
|---|---|---|---|---|---|---|
| HANA v1/v2 | odata service definition | SUPPORTED | SUPPORTED | NOT RELEVANT | NOT RELEVANT | documentation |
| HANA v1/v2 | odata namespace definition | SUPPORTED | SUPPORTED | SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata object exposure | SUPPORTED | SUPPORTED | SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata property projection | SUPPORTED | SUPPORTED | SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata key specification | SUPPORTED | SUPPORTED using sap:filterable | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata associations | SUPPORTED | SUPPORTED | SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata aggregations | SUPPORTED | SUPPORTED using sap:semantics="aggregate" | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata parameters entitysets | SUPPORTED | No odata representation exist | NOT RELEVANT | NOT RELEVANT | documentation |
| HANA v1/v2 | odata Etag support | NOT SUPPORTED | NOT SUPPORTED | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata nullable properties | SUPPORTED | No odata representation exist | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | odata configurable cash settings | SUPPORTED | No odata representation exist | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v2 | odata hints for SQL select statements | SUPPORTED | No odata representation exist | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v2 | odata entity limits | SUPPORTED | NOT SUPPORTED | NOT SUPPORTED | NOT RELEVANT | documentation |
| HANA v1/v2 | modifications | SUPPORTED | SUPPORTED [forbidden: using sap:creatable, sap:updatable, sap:deletable], [events - no odata representation exist] | NOT RELEVANT | SUPPORTED | documentation |
| HANA v1/v2 | validation scrips with XS JavaScript | SUPPORTED | No odata representation exist | NOT RELEVANT | SUPPORTED | documentation |
| HANA v1/v2 | validation exit with SQL script | SUPPORTED | No odata representation exist | NOT RELEVANT | SUPPORTED | documentation |
KronosOData2ODataHTransformer
Uses the OData2ODataHTransformer.transform() method. The xsodata modification artifacts are converted to odata artifacts. See the table for the supportable operations.
| XSOData Modification Artifacts | Convert to OData |
|---|---|
| create using | on |
| forbidden | forbid |
| before | before |
| after | after |
| precommit | not supported |
| postcommit | not supported |
Example of .xsodata will generate the following OData2ODataHTransformer
"sample.odata::table1"
update events (before "sample.odata::beforeMethod", precommit "sample.odata::beforeMethod")
delete events (after "sample.odata::afterMethod")
create forbidden;
| ODATAH_METHOD | ODATAH_TYPE | ODATAH_HANDLER |
|---------------|-------------|----------------------------|
| update | before | sample.odata::beforeMethod |
| delete | after | sample.odata::afterMethod |
| create | fordid | N/A |
Example of .xsodata will generate the following OData2ODataHTransformer
create using "sample.odata::createMethod"
update events (precommit "sample.odata::precommitMethod")
delete forbidden;
| ODATAH_METHOD | ODATAH_TYPE | ODATAH_HANDLER |
|---------------|-------------|----------------------------|
| create | on | sample.odata::createMethod |
| delete | fordid | N/A |
KronosOData2ODataMTransformer
Dirigible OData supports the following multiplicity values:
ZERO_TO_ONE("0..1"), MANY("*"), ONE("1");
XSODATA Multiplicity '1..' is converted to '', because '1..*' is not supported from odata.
KronosOData2ODataMTransformer relies on foreign key definitions on the database side. If there are no foreign key constraint between tables in the database, then all navigations must be defined inside the .odata file, otherwise no navigations will be exposed though the odata service.
Inside xsodata file we can specify which properties can be exposed using the 'with' and 'without' section:
service namespace "np"{
"sample.odata::table1" as "Table1" without ("COLUMN1");
"sample.odata::table2" as "Table2" with ("COLUMN1", "COLUMN2");
}
Supportability for Annotations
SAP ODATA Annotations for XSOData XS2
SAP Annotations for OData Version 2.0
| Annotation Element | Dirigible Annotation Supportability |
|---|---|
| Element edm:Schema | :x: |
| Element edm:EntityContainer | :x: |
| Element edm:EntitySet | :heavy_check_mark: |
| Element edm:EntityType | :heavy_check_mark: |
| Element edm:Property | :heavy_check_mark: |
| Element edm:NavigationProperty | :heavy_check_mark: |
| Element edm:FunctionImport | :x: |
| Element sap:value-constraint | :x: |
| Element edm:Parameter | :x: |
| Element edm:AssociationSet | :heavy_check_mark: |
For all the list of annotations check the official documentation SAP OData Annotations v2.X
| XSODATA Supportability | Annotation Element | Parameter Name | Parameter Value | The following values are supported in the following cases |
|---|---|---|---|---|
| edm:EntityType | sap:semantics | Undefined | Defaul Value is Undefined | |
| :heavy_check_mark: | aggregate | Where aggregation is defined for the entity set of the entity type using "aggregates" expression in .xsodata file | ||
| :x: | aggregate | Where the entity type represents a calculation view, which has a measure attribute | ||
| :x: | parameters | if the entity type represents input parameters for a calculation view | ||
| :x: | edm:EntitySet | sap:addressable | TRUE | Default Value is true |
| :x: | FALSE | “false” if the entity set represents either a calculation view or input parameters for a calculation view. | ||
| :x: | sap:creatable | TRUE | Default Value is true | |
| :heavy_check_mark: | FALSE | The "create forbidden" setting is defined for the entity set in the OData service definition (.xsodata) file | ||
| :x: | FALSE | The entity set represents a database view, for example, a table or a calculation view. | ||
| :x: | FALSE | The entity set represents input parameters for a calculation view. | ||
| :x: | FALSE | “aggregation” is defined for the entity set, for example, using the “aggregates always” expression in the OData service definition (.xsodata) file. | ||
| :x: | sap:updatable | TRUE | Default Value is true | |
| :heavy_check_mark: | FALSE | The "update forbidden" setting is defined for the entity set in the OData service definition (.xsodata) file | ||
| :x: | FALSE | The entity set represents a database view, for example, a table or a calculation view. | ||
| :x: | FALSE | The entity set represents input parameters for a calculation view. | ||
| :x: | FALSE | “aggregation” is defined for the entity set, for example, using the “aggregates always” expression in the OData service definition (.xsodata) file. | ||
| :x: | FALSE | A generated key is defined for the entity set. | ||
| :x: | sap:deletable | TRUE | Default Value is true | |
| :heavy_check_mark: | FALSE | The "delete forbidden" setting is defined for the entity set in the OData service definition (.xsodata) file | ||
| :x: | FALSE | The entity set represents a database view, for example, a table or a calculation view. | ||
| :x: | FALSE | The entity set represents input parameters for a calculation view. | ||
| :x: | FALSE | “aggregation” is defined for the entity set, for example, using the “aggregates always” expression in the OData service definition (.xsodata) file. | ||
| :x: | FALSE | A generated key is defined for the entity set. | ||
| :x: | Entity-Type edm:Property | sap:semantics | Undefined | Undefined; there is no defined default value |
| :x: | currency-code | check official docmentation for more detail | ||
| :x: | unit-of-measure | check official docmentation for more detail | ||
| :x: | dtstart | check official docmentation for more detail | ||
| :x: | dtend | check official docmentation for more detail | ||
| :x: | sap:parameter | Undefined | Undefined; there is no defined default value | |
| :x: | mandatory | check official docmentation for more detail | ||
| :x: | optional | check official docmentation for more detail | ||
| :x: | sap:label | Undefined | Undefined; there is no defined default value | |
| :x: | Additional Supported Values | check official docmentation for more detail | ||
| :x: | sap:filterable | TRUE | Default Value is true | |
| :x: | FALSE | The property represents a generated key | ||
| :x: | FALSE | The property represents a measure attribute of a calculation view | ||
| :x: | FALSE | The property is used in the aggregation, defined as the “aggregates always” expression in the XS OData service-definition (.xsodata) file. | ||
| :x: | sap:display-format | Undefined | Undefined; there is no defined default value | |
| :x: | Date | The “Date” value can be used if the SQL DATE type is used for the property on the database side. | ||
| :x: | sap:aggregation-role | Undefined | Undefined; there is no defined default value | |
| :x: | measure | The “measure” value can be used if the property represents a measure attribute of a calculation view or is used in the aggregation that is defined in the “aggregates always” expression in the XS advanced OData service-definition (.xsodata) file. | ||
| :x: | sap:unit | Undefined | Undefined; there is no defined default value | |
| :x: | Additional Supported Values | check official docmentation for more detail | ||
| :x: | sap:filter-restriction | Undefined | Undefined; there is no defined default value | |
| :x: | single-value | check official docmentation for more detail | ||
| :x: | multi-value | check official docmentation for more detail | ||
| :x: | interval | check official docmentation for more detail | ||
| :x: | edm:NavigationProperty | sap:creatable | TRUE | Default Value is true |
| :x: | FALSE | The annotation value is always “false” because neither “deep insert” (POST request payload containing data for both parent and related entity) nor POST request for the .../EntitySet(key)/navPropertyName URL is supported in XS OData for XS advanced. | ||
| :x: | sap:filterable | TRUE | Default Value is true | |
| :x: | FALSE | The annotation value is always “false” because navigation properties cannot be used in a $filter system query option in XS OData for XS advanced. | ||
| :x: | edm:AssociationSet | sap:creatable | TRUE | Default Value is true |
| :x: | FALSE | “false” if the association set connects entity sets for calculation view results and calculation view input parameters. | ||
| :x: | sap:updatable | TRUE | Default Value is true | |
| :x: | FALSE | “false” if the association set connects entity sets for calculation view results and calculation view input parameters. | ||
| :x: | sap:deletable | TRUE | Default Value is true | |
| :x: | FALSE | “false” if the association set connects entity sets for calculation view results and calculation view input parameters. |
Supportable OData Service-Definition Features
| FEATURES | SUPPORTED IN KRONOS | REMARKS |
|---|---|---|
| Aggregation | :x: | |
| Association | :heavy_check_mark: | DONE |
| Key Specification | :heavy_check_mark: | DONE |
| Parameter Entity Sets | :x: | |
| Projection | :heavy_check_mark: | DONE |
| HANA TableType | Dirigible supported type for odata |
|---|---|
| CALC VIEW | :heavy_check_mark: |
| GLOBAL TEMPORARARY | :x: |
| SHARED TEMPORARARY | :x: |
| NO LOGGING TEMPORARY | :x: |
| SYNONYM | :x: |
| SYSTEM TABLE | :x: |
| TABLE | :heavy_check_mark: |
| USER DEFINED | :x: |
| COLUMN VIEW | :x: |
| VIEW | :heavy_check_mark: |
| JOIN VIEW | :x: |
| OLAP VIEW | :x: |
| HIERARCHY VIEW | :x: |
Supportable XSODATA PARSER Conditions
| Conditions | Implemented | Remarks |
|---|---|---|
| 1 | :heavy_check_mark: | |
| 2 | :heavy_check_mark: | |
| 3 | :heavy_check_mark: | |
| 4 | :heavy_check_mark: | |
| 5 | :heavy_check_mark: | |
| 6 | :x: | can not be imlemented |
| 7 | :heavy_check_mark: | |
| 8 | :heavy_check_mark: | |
| 9 | :x: | calculation views and analytic views processing |
| 10 | :heavy_check_mark: | |
| 11 | :heavy_check_mark: | calculation views and analytic views processing |
| 12 | :heavy_check_mark: | calculation views and analytic views processing |
Sample
https://github.com/codbex/codbex-kronos/tree/main/samples/xsodata-simple https://github.com/codbex/codbex-kronos/tree/main/samples/xsodata-navigations
Modules
- ANTLR Parser
https://github.com/codbex/codbex-kronos/tree/main/modules/parsers/parser-xsodata/src/main
- Data Structure Parser
Unit Tests
https://github.com/codbex/codbex-kronos/tree/main/modules/parsers/parser-xsodata/src/test https://github.com/codbex/codbex-kronos/tree/main/modules/engines/engine-xsodata/src/test