Generate OData VDM using S/4 HANA SDK leads to errors

故事扮演 提交于 2019-12-13 04:28:21

问题


I tried to generate VDM for the OData service provided by S/4 HANA Cloud (which is not in API hub). The generated VDM class shows errors, in particular, it has an error with UUID set and get method, and the TRUE property. I attached the metadata edmx.xml here.

Ying

This XML file does not appear to have any style information associated with it. The document tree is shown below.

edmx.xml:

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData" Version="1.0">
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="https://my300470-api.s4hana.ondemand.com/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMON',Version='0001',SAP__Origin='LOCAL')/$value">
<edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common"/>
</edmx:Reference>
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="https://my300470-api.s4hana.ondemand.com/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_CAPABILITIES',Version='0001',SAP__Origin='LOCAL')/$value">
<edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/>
</edmx:Reference>
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="https://my300470-api.s4hana.ondemand.com/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_COMMUNICATION',Version='0001',SAP__Origin='LOCAL')/$value">
<edmx:Include Namespace="com.sap.vocabularies.Communication.v1" Alias="Communication"/>
</edmx:Reference>
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="https://my300470-api.s4hana.ondemand.com/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_AGGREGATION',Version='0001',SAP__Origin='LOCAL')/$value">
<edmx:Include Namespace="Org.OData.Aggregation.V1" Alias="Aggregation"/>
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="APS_IAM_SIAG_BROLE_SRV" xml:lang="en" sap:schema-version="1">
<EntityType Name="IagprivilegeauthDetails" sap:content-version="1">
<Key>
<PropertyRef Name="BusinessCatalogID"/>
<PropertyRef Name="PrivilegeRole"/>
</Key>
<Property Name="BusinessCatalogID" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="PrivilegeRole" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="PrivilegeProfile" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ActionType" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="AuthGroup" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ResourceId" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ResourceExtn" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="FromValue" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="ToValue" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
<Property Name="FioriCatalogId" Type="Edm.String" Nullable="false" sap:unicode="false" sap:creatable="false" sap:updatable="false" sap:sortable="false" sap:filterable="false"/>
</EntityType>
<EntityType Name="aps_iam_brbua_ddlType" sap:label="Business Role Business User Assignment" sap:content-version="1">
<Key>
<PropertyRef Name="BusinessRoleUUID"/>
<PropertyRef Name="BusinessUserAssignmentID"/>
</Key>
<Property Name="BusinessRoleUUID" Type="Edm.Guid" Nullable="false" sap:label="Business Role UUID"/>
<Property Name="BusinessUserAssignmentID" Type="Edm.String" Nullable="false" MaxLength="12" sap:display-format="UpperCase" sap:label="Business User Assignment ID"/>
<Property Name="UserID" Type="Edm.String" MaxLength="12" sap:display-format="UpperCase" sap:label="Business User ID"/>
<Property Name="UserName" Type="Edm.String" MaxLength="40" sap:display-format="UpperCase" sap:label="Business User Name"/>
<Property Name="FirstName" Type="Edm.String" MaxLength="40" sap:label="Business User First Name"/>
<Property Name="LastName" Type="Edm.String" MaxLength="40" sap:label="Business User Last Name"/>
<Property Name="PersonID" Type="Edm.String" MaxLength="10" sap:display-format="UpperCase" sap:label="Business User Person ID"/>
<Property Name="Building" Type="Edm.String" MaxLength="10" sap:label="Building"/>
<Property Name="Floor" Type="Edm.String" MaxLength="10" sap:label="Floor"/>
<Property Name="Room" Type="Edm.String" MaxLength="10" sap:label="Room"/>
<Property Name="PriceCategory" Type="Edm.Int16" sap:label="Price Category"/>
<Property Name="PriceCategoryText" Type="Edm.String" MaxLength="80" sap:label="Price Category"/>
</EntityType>
<EntityType Name="Aps_Iam_Siag_Brca_DllType" sap:label="Business Role - Catalog Assignment" sap:content-version="1">
<Key>
<PropertyRef Name="ID"/>
<PropertyRef Name="BusinessCatalogID"/>
</Key>
<Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="40" sap:display-format="UpperCase" sap:label="Bus. Role ID" sap:quickinfo="IAM: Business Role ID"/>
<Property Name="BusinessCatalogID" Type="Edm.String" Nullable="false" MaxLength="35" sap:display-format="UpperCase" sap:label="Catalog ID" sap:quickinfo="IAM: Business Catalog ID"/>
<Property Name="BusinessRoleUUID" Type="Edm.Guid" sap:label="UUID" sap:quickinfo="Global Unique ID for table"/>
<Property Name="FioriCatalogID" Type="Edm.String" MaxLength="35" sap:display-format="UpperCase" sap:label="Fiori Catalog ID" sap:quickinfo="Fiori Catalog Type"/>
<Property Name="RoleTemplate" Type="Edm.String" MaxLength="30" sap:display-format="UpperCase" sap:label="Role Name"/>
<Property Name="Restrictable" Type="Edm.Boolean" sap:display-format="UpperCase" sap:label="Restrictable"/>
<NavigationProperty Name="to_BusinessRole" Relationship="APS_IAM_SIAG_BROLE_SRV.assoc_7D2C2868538CD70C0B433A90421C523F" FromRole="FromRole_assoc_7D2C2868538CD70C0B433A90421C523F" ToRole="ToRole_assoc_7D2C2868538CD70C0B433A90421C523F"/>
<NavigationProperty Name="to_Description" Relationship="APS_IAM_SIAG_BROLE_SRV.assoc_C2CAEB0FCF842BFF92ECFB837B9001F9" FromRole="FromRole_assoc_C2CAEB0FCF842BFF92ECFB837B9001F9" ToRole="ToRole_assoc_C2CAEB0FCF842BFF92ECFB837B9001F9"/>
</EntityType>
<EntityType Name="Aps_Iam_Siag_Br_DllType" sap:label="IAG Business Role View" sap:content-version="1">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.String" Nullable="false" MaxLength="40" sap:display-format="UpperCase" sap:label="Bus. Role ID" sap:quickinfo="IAM: Business Role ID"/>
<Property Name="UUID" Type="Edm.Guid" sap:label="UUID" sap:quickinfo="Global Unique ID for table"/>
<Property Name="LastChangedAt" Type="Edm.DateTimeOffset" Precision="0" sap:label="Time Stamp" sap:quickinfo="UTC Time Stamp in Short Form (YYYYMMDDhhmmss)"/>
<Property Name="LastChangedBy" Type="Edm.String" MaxLength="12" sap:display-format="UpperCase" sap:label="User Name"/>
<Property Name="Description" Type="Edm.String" MaxLength="80" sap:label="" sap:quickinfo="IAM: Business Role Description"/>
<Property Name="Language" Type="Edm.String" MaxLength="2" sap:label="Language Key"/>
<NavigationProperty Name="to_BusinessCatalogAssignment" Relationship="APS_IAM_SIAG_BROLE_SRV.assoc_DFC7845EA2C63AB8EE73721D41279674" FromRole="FromRole_assoc_DFC7845EA2C63AB8EE73721D41279674" ToRole="ToRole_assoc_DFC7845EA2C63AB8EE73721D41279674"/>
<NavigationProperty Name="to_BusinessUserAssignment" Relationship="APS_IAM_SIAG_BROLE_SRV.assoc_35A670E810662891BAABAA62A25B742F" FromRole="FromRole_assoc_35A670E810662891BAABAA62A25B742F" ToRole="ToRole_assoc_35A670E810662891BAABAA62A25B742F"/>
</EntityType>
<EntityType Name="aps_iam_vbct_ddlType" sap:label="Business Catalog Text" sap:content-version="1">
<Key>
<PropertyRef Name="bu_catalog_id"/>
<PropertyRef Name="language"/>
</Key>
<Property Name="bu_catalog_id" Type="Edm.String" Nullable="false" MaxLength="35" sap:display-format="UpperCase" sap:label="Catalog ID" sap:quickinfo="IAM: Business Catalog ID"/>
<Property Name="language" Type="Edm.String" Nullable="false" MaxLength="2" sap:label="Language Key"/>
<Property Name="text" Type="Edm.String" MaxLength="80" sap:label="Business Catalog"/>
<Property Name="long_text" Type="Edm.String" sap:label="Description" sap:sortable="false" sap:filterable="false"/>
<Property Name="is_deprecated" Type="Edm.Boolean" sap:display-format="UpperCase" sap:label="TRUE" sap:quickinfo="Data element for domain BOOLE: TRUE (='X') and FALSE (=' ')"/>
</EntityType>
<Association Name="assoc_C2CAEB0FCF842BFF92ECFB837B9001F9" sap:content-version="1">
<End Type="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Brca_DllType" Multiplicity="1" Role="FromRole_assoc_C2CAEB0FCF842BFF92ECFB837B9001F9"/>
<End Type="APS_IAM_SIAG_BROLE_SRV.aps_iam_vbct_ddlType" Multiplicity="*" Role="ToRole_assoc_C2CAEB0FCF842BFF92ECFB837B9001F9"/>
</Association>
<Association Name="assoc_7D2C2868538CD70C0B433A90421C523F" sap:content-version="1">
<End Type="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Brca_DllType" Multiplicity="1" Role="FromRole_assoc_7D2C2868538CD70C0B433A90421C523F"/>
<End Type="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Br_DllType" Multiplicity="0..1" Role="ToRole_assoc_7D2C2868538CD70C0B433A90421C523F"/>
</Association>
<Association Name="assoc_DFC7845EA2C63AB8EE73721D41279674" sap:content-version="1">
<End Type="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Br_DllType" Multiplicity="1" Role="FromRole_assoc_DFC7845EA2C63AB8EE73721D41279674"/>
<End Type="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Brca_DllType" Multiplicity="*" Role="ToRole_assoc_DFC7845EA2C63AB8EE73721D41279674"/>
</Association>
<Association Name="assoc_35A670E810662891BAABAA62A25B742F" sap:content-version="1">
<End Type="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Br_DllType" Multiplicity="1" Role="FromRole_assoc_35A670E810662891BAABAA62A25B742F"/>
<End Type="APS_IAM_SIAG_BROLE_SRV.aps_iam_brbua_ddlType" Multiplicity="*" Role="ToRole_assoc_35A670E810662891BAABAA62A25B742F"/>
</Association>
<EntityContainer Name="APS_IAM_SIAG_BROLE_SRV_Entities" m:IsDefaultEntityContainer="true" sap:supported-formats="atom json xlsx">
<EntitySet Name="IagprivilegeauthDetailsSet" EntityType="APS_IAM_SIAG_BROLE_SRV.IagprivilegeauthDetails" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:searchable="true" sap:content-version="1"/>
<EntitySet Name="aps_iam_brbua_ddl" EntityType="APS_IAM_SIAG_BROLE_SRV.aps_iam_brbua_ddlType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<EntitySet Name="Aps_Iam_Siag_Brca_Dll" EntityType="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Brca_DllType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<EntitySet Name="Aps_Iam_Siag_Br_Dll" EntityType="APS_IAM_SIAG_BROLE_SRV.Aps_Iam_Siag_Br_DllType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<EntitySet Name="aps_iam_vbct_ddl" EntityType="APS_IAM_SIAG_BROLE_SRV.aps_iam_vbct_ddlType" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
<AssociationSet Name="assoc_35A670E810662891BAABAA62A25B742F" Association="APS_IAM_SIAG_BROLE_SRV.assoc_35A670E810662891BAABAA62A25B742F" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="Aps_Iam_Siag_Br_Dll" Role="FromRole_assoc_35A670E810662891BAABAA62A25B742F"/>
<End EntitySet="aps_iam_brbua_ddl" Role="ToRole_assoc_35A670E810662891BAABAA62A25B742F"/>
</AssociationSet>
<AssociationSet Name="assoc_7D2C2868538CD70C0B433A90421C523F" Association="APS_IAM_SIAG_BROLE_SRV.assoc_7D2C2868538CD70C0B433A90421C523F" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="Aps_Iam_Siag_Brca_Dll" Role="FromRole_assoc_7D2C2868538CD70C0B433A90421C523F"/>
<End EntitySet="Aps_Iam_Siag_Br_Dll" Role="ToRole_assoc_7D2C2868538CD70C0B433A90421C523F"/>
</AssociationSet>
<AssociationSet Name="assoc_C2CAEB0FCF842BFF92ECFB837B9001F9" Association="APS_IAM_SIAG_BROLE_SRV.assoc_C2CAEB0FCF842BFF92ECFB837B9001F9" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="Aps_Iam_Siag_Brca_Dll" Role="FromRole_assoc_C2CAEB0FCF842BFF92ECFB837B9001F9"/>
<End EntitySet="aps_iam_vbct_ddl" Role="ToRole_assoc_C2CAEB0FCF842BFF92ECFB837B9001F9"/>
</AssociationSet>
<AssociationSet Name="assoc_DFC7845EA2C63AB8EE73721D41279674" Association="APS_IAM_SIAG_BROLE_SRV.assoc_DFC7845EA2C63AB8EE73721D41279674" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1">
<End EntitySet="Aps_Iam_Siag_Br_Dll" Role="FromRole_assoc_DFC7845EA2C63AB8EE73721D41279674"/>
<End EntitySet="Aps_Iam_Siag_Brca_Dll" Role="ToRole_assoc_DFC7845EA2C63AB8EE73721D41279674"/>
</AssociationSet>
<FunctionImport Name="getBusinessCatalogAuthDetails" ReturnType="Collection(APS_IAM_SIAG_BROLE_SRV.IagprivilegeauthDetails)" EntitySet="IagprivilegeauthDetailsSet" m:HttpMethod="GET" sap:action-for="APS_IAM_SIAG_BROLE_SRV.IagprivilegeauthDetails">
<Parameter Name="BusinessCatalogID" Type="Edm.String" Mode="In" MaxLength="40"/>
<Parameter Name="ID" Type="Edm.String" Mode="In" MaxLength="40"/>
</FunctionImport>
<FunctionImport Name="getAuthDetails" ReturnType="Collection(APS_IAM_SIAG_BROLE_SRV.IagprivilegeauthDetails)" EntitySet="IagprivilegeauthDetailsSet" m:HttpMethod="GET" sap:action-for="APS_IAM_SIAG_BROLE_SRV.IagprivilegeauthDetails">
<Parameter Name="ID" Type="Edm.String" Mode="In"/>
</FunctionImport>
</EntityContainer>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="APS_IAM_SIAG_BROLE_SRV.APS_IAM_SIAG_BROLE_SRV_Entities">
<Annotation Term="Aggregation.ApplySupported">
<Record>
<PropertyValue Property="Transformations">
<Collection>
<String>aggregate</String>
<String>groupby</String>
<String>filter</String>
</Collection>
</PropertyValue>
<PropertyValue Property="Rollup" EnumMember="None"/>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="APS_IAM_SIAG_BROLE_SRV.APS_IAM_SIAG_BROLE_SRV_Entities/aps_iam_vbct_ddl">
<Annotation Term="Capabilities.FilterRestrictions">
<Record>
<PropertyValue Property="FilterExpressionRestrictions">
<Collection>
<Record>
<PropertyValue Property="Property" PropertyPath="long_text"/>
<PropertyValue Property="AllowedExpressions" String="SearchExpression"/>
</Record>
</Collection>
</PropertyValue>
<PropertyValue Property="NonFilterableProperties">
<Collection>
<PropertyPath>long_text</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Capabilities.SortRestrictions">
<Record>
<PropertyValue Property="NonSortableProperties">
<Collection>
<PropertyPath>long_text</PropertyPath>
<PropertyPath>long_text</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="self" href="https://my300470-api.s4hana.ondemand.com/sap/opu/odata/SAP/APS_IAM_SIAG_BROLE_SRV/$metadata"/>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="latest-version" href="https://my300470-api.s4hana.ondemand.com/sap/opu/odata/SAP/APS_IAM_SIAG_BROLE_SRV/$metadata"/>
</Schema>
</edmx:DataServices>
</edmx:Edmx> `


回答1:


It turned out that the problem was missing Lombok configuration.

As this question is asked multiple times I will give a bit more comprehensive answer than just "configure it", answering the most common questions.

What is Lombok?

According to their website:

Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.

More specifically Lombok allows you to add annotations to your code which will generate boilerplate at compile time.

So, taking @EqualsAndHashCode as an example: This will generate, as the name implies, valid equals(Object) and hashCode() methods for the annotated class.

See the overview page for a full list of annotations.

What are you using Lombok for?

We use the following annotations in our OData VDM Generator (not a full list, this might also change in the future):

  • @Builder
  • @ToString
  • @EqualsAndHashCode
  • @Data

The last annotation brings in, besides others, the @Getter annotation which generates all necessary getters at compile time.

How do I compile my code with Lombok/Display it in my IDE?

As described directly by Lombok and our blog post you just need the Lombok dependency (org.projectlombok:lombok) with scope provided on your classpath.

To view the code in your IDE without any build issues you need to setup your IDE accordingly, see the Lombok guides for that.



来源:https://stackoverflow.com/questions/55073079/generate-odata-vdm-using-s-4-hana-sdk-leads-to-errors

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!