[OLINGO-1062]Cannot consume Odata Reference Services with Annotations

This commit is contained in:
Archana Rai 2018-08-20 11:31:08 +05:30
parent 58ec0358c2
commit 8cbe468c2a
35 changed files with 4407 additions and 21 deletions

View File

@ -32,6 +32,7 @@ import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
import org.apache.olingo.commons.api.edm.EdmAnnotations;
import org.apache.olingo.commons.api.edm.EdmComplexType;
@ -41,13 +42,17 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
@ -525,4 +530,241 @@ public class MetadataTest extends AbstractTest {
assertEquals("AnnotationPath", expression.asDynamic().getExpressionName());
}
}
@Test
public void readAnnotationOnAnEntityType() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmEntityType entity = edm.getEntityTypeWithAnnotations(
new FullQualifiedName("SEPMRA_SO_MAN2", "SEPMRA_C_CountryVHType"));
assertEquals(1, entity.getAnnotations().size());
assertNotNull(entity.getAnnotations().get(0).getTerm());
assertEquals("HeaderInfo", entity.getAnnotations().get(0).getTerm().getName());
assertNotNull(entity.getAnnotations().get(0).getExpression());
EdmEntityType entity1 = edm.getEntityTypeWithAnnotations(
new FullQualifiedName("SEPMRA_SO_MAN2", "SEPMRA_C_SalesOrderCustCntctVHType"));
EdmAnnotation annotation = entity1.getAnnotations().get(0);
assertNotNull(annotation);
assertEquals(5, entity1.getAnnotations().size());
assertEquals("FieldGroup", annotation.getTerm().getName());
assertEquals("ContactPerson", annotation.getQualifier());
EdmExpression expression = annotation.getExpression();
assertNotNull(expression);
assertTrue(expression.isDynamic());
EdmRecord record = expression.asDynamic().asRecord();
assertNotNull(record);
assertEquals(2, record.asRecord().getPropertyValues().size());
List<EdmPropertyValue> propertyValues = record.asRecord().getPropertyValues();
assertEquals("Data", propertyValues.get(0).getProperty());
assertTrue(propertyValues.get(0).getValue().isDynamic());
List<EdmExpression> items = propertyValues.get(0).getValue().asDynamic().asCollection().getItems();
assertEquals(4, items.size());
assertEquals("Label", propertyValues.get(1).getProperty());
assertEquals("Contact Person", propertyValues.get(1).getValue().asConstant().asPrimitive());
assertEquals(1, entity1.getNavigationProperty("to_Customer").getAnnotations().size());
EdmNavigationProperty navProperty = entity1.getNavigationProperty("to_Customer");
assertEquals("ThingPerspective", navProperty.
getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnAProperty() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmEntityType entity = edm.getEntityTypeWithAnnotations(
new FullQualifiedName("SEPMRA_SO_MAN2", "I_DraftAdministrativeDataType"));
EdmProperty property = (EdmProperty) entity.getProperty("DraftUUID");
assertNotNull(property.getAnnotations());
assertEquals(1, property.getAnnotations().size());
assertEquals("UI.HeaderInfo", property.getAnnotations().get(0).getTerm().
getFullQualifiedName().getFullQualifiedNameAsString());
}
@Test
public void readAnnotationOnActionImport() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmEntityContainer container = edm.getEntityContainer();
EdmActionImport actionImport = container.getActionImport("AIRTString");
assertEquals(3, actionImport.getAnnotations().size());
assertEquals("Description", actionImport.getAnnotations().get(0).getTerm().getName());
assertEquals("HeaderInfo", actionImport.getAnnotations().get(2).getTerm().getName());
}
@Test
public void readAnnotationOnASingleton() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmEntityContainer container = edm.getEntityContainer();
EdmSingleton singleton = container.getSingleton("SINav");
assertEquals(1, singleton.getAnnotations().size());
assertEquals("HeaderInfo", singleton.getAnnotations().get(0).getTerm().getName());
EdmEntityType singletonET = singleton.getEntityType();
EdmProperty singlComplexProp = (EdmProperty)singletonET.getProperty("ComplexProperty");
EdmComplexType singlCompType = (EdmComplexType) singlComplexProp.getTypeWithAnnotations();
EdmNavigationProperty singlNavProp = (EdmNavigationProperty) singlCompType.
getNavigationProperty("NavPropertyDraftAdministrativeDataType");
assertEquals(1, singlNavProp.getAnnotations().size());
assertEquals("AdditionalInfo", singlNavProp.getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnBoundFunction() {
final Edm edm = fetchEdm();
assertNotNull(edm);
List<String> parameterNames = new ArrayList<String>();
EdmFunction function = edm.getBoundFunction(new FullQualifiedName("SEPMRA_SO_MAN2", "_FC_RTTimeOfDay_"),
new FullQualifiedName("Edm","TimeOfDay"), false, parameterNames);
assertEquals(1, function.getAnnotations().size());
assertEquals("HeaderInfo", function.getAnnotations().get(0).getTerm().getName());
// Annotations on Bound Function parameter
assertEquals(1, function.getParameter("ParameterTimeOfDay").getAnnotations().size());
assertEquals("HeaderInfo", function.getParameter("ParameterTimeOfDay")
.getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnSchema() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmSchema schema = edm.getSchema("sepmra_so_man2_anno_mdl.v1");
assertNotNull(schema);
assertEquals(112, schema.getAnnotationGroups().size());
EdmAnnotations annotations = edm.getSchema("SEPMRA_SO_MAN2").getAnnotationGroups().get(22);
assertEquals("SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType", annotations.getTargetPath());
assertEquals(1, annotations.getAnnotations().size());
assertEquals("SelectionFields", annotations.getAnnotations()
.get(0).getTerm().getName());
assertTrue(annotations.getAnnotations().get(0).getExpression().isDynamic());
}
@Test
public void readAnnotationOnContainer() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmEntityContainer container = edm.getEntityContainer();
assertEquals(1, container.getAnnotations().size());
assertEquals("HeaderInfo", container.getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnComplexType() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmComplexType complexType = edm.getComplexTypeWithAnnotations(
new FullQualifiedName("SEPMRA_SO_MAN2", "CTPrim"));
assertEquals(1, complexType.getAnnotations().size());
assertEquals("HeaderInfo", complexType.getAnnotations().get(0).getTerm().getName());
// Annotations on complex type property
EdmProperty complexTypeProp = (EdmProperty) complexType.getProperty("PropertyInt16");
assertEquals(1, complexTypeProp.getAnnotations().size());
assertEquals("HeaderInfo", complexTypeProp.getAnnotations().get(0).getTerm().getName());
// Annotations on complex type navigation property
EdmNavigationProperty complexTypeNavProp = complexType.
getNavigationProperty("NavPropertyDraftAdministrativeDataType");
assertEquals(1, complexTypeNavProp.getAnnotations().size());
assertEquals("HeaderInfo", complexTypeNavProp.getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnTypeDefinitions() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmTypeDefinition typeDefn = edm.getTypeDefinition(new FullQualifiedName("SEPMRA_SO_MAN2", "TDString"));
assertEquals(1, typeDefn.getAnnotations().size());
assertEquals("HeaderInfo", typeDefn.getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnBoundActions() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmAction action = edm.getBoundAction(new FullQualifiedName("SEPMRA_SO_MAN2", "BA_RTCountryVHType"),
new FullQualifiedName("SEPMRA_SO_MAN2","I_DraftAdministrativeDataType"), false);
assertEquals(1, action.getAnnotations().size());
assertEquals("HeaderInfo", action.getAnnotations().get(0).getTerm().getName());
//Annotations on Bound Action parameter
assertEquals(1, action.getParameter("ParameterCTPrim").getAnnotations().size());
assertEquals("HeaderInfo", action.getParameter("ParameterCTPrim")
.getAnnotations().get(0).getTerm().getName());
}
@Test
public void readAnnotationOnEntitySet() {
final Edm edm = fetchEdm();
assertNotNull(edm);
EdmEntityContainer container = edm.getEntityContainer();
EdmEntitySet entitySet = container.getEntitySet("I_DraftAdministrativeData");
assertEquals(1, entitySet.getAnnotations().size());
assertEquals("HeaderInfo", entitySet.getAnnotations().get(0).getTerm().getName());
EdmEntityType entityType50 = edm.getEntityTypeWithAnnotations(
new FullQualifiedName("SEPMRA_SO_MAN2", "I_DraftAdministrativeDataType"));
assertEquals(1, ((EdmProperty)entityType50.getProperty("DraftUUID")).getAnnotations().size());
assertEquals("UI.HeaderInfo", ((EdmProperty)entityType50.getProperty("DraftUUID")).
getAnnotations().get(0).getTerm().getFullQualifiedName().getFullQualifiedNameAsString());
// Annotations on properties of entity type included in EntitySet
EdmEntityType entityType3 = entitySet.getEntityTypeWithAnnotations();
assertEquals(2, ((EdmProperty)entityType3.getProperty("DraftUUID")).getAnnotations().size());
assertEquals("AdditionalInfo", ((EdmProperty)entityType3.getProperty("DraftUUID"))
.getAnnotations().get(0).getTerm().getName());
assertEquals("HeaderInfo", ((EdmProperty)entityType3.getProperty("DraftUUID"))
.getAnnotations().get(1).getTerm().getName());
// Annotations on navigation properties of entity type included in EntitySet
EdmEntitySet entitySet1 = container.getEntitySet("SEPMRA_C_SalesOrderCustCntctVH");
EdmEntityType entityType5 = entitySet1.getEntityTypeWithAnnotations();
assertEquals(2, ((EdmNavigationProperty)entityType5.getNavigationProperty("to_Customer"))
.getAnnotations().size());
assertEquals("AdditionalInfo", ((EdmNavigationProperty)entityType5
.getNavigationProperty("to_Customer"))
.getAnnotations().get(0).getTerm().getName());
assertEquals("HeaderInfo", ((EdmNavigationProperty)entityType5
.getNavigationProperty("to_Customer"))
.getAnnotations().get(1).getTerm().getName());
EdmComplexType complexType = edm.getComplexTypeWithAnnotations(
new FullQualifiedName("SEPMRA_SO_MAN2", "CTPrim"));
EdmProperty complexTypeProp = (EdmProperty) complexType.getProperty("PropertyInt16");
assertEquals(1, complexTypeProp.getAnnotations().size());
assertEquals("HeaderInfo", complexTypeProp.getAnnotations().get(0).getTerm().getName());
// Annotations on properties of complex properties of entity type included in EntitySet
EdmProperty complexProp = (EdmProperty) entityType3.getProperty("ComplexProperty");
EdmComplexType compType = (EdmComplexType) complexProp.getTypeWithAnnotations();
EdmProperty prop = (EdmProperty) compType.getProperty("PropertyInt16");
assertEquals(1, prop.getAnnotations().size());
assertEquals("AdditionalInfo", prop.getAnnotations().get(0).getTerm().getName());
// Annotations on navigation properties of complex properties of entity type included in EntitySet
EdmNavigationProperty navProp = (EdmNavigationProperty) compType
.getProperty("NavPropertyDraftAdministrativeDataType");
assertEquals(1, navProp.getAnnotations().size());
assertEquals("AdditionalInfo", navProp.getAnnotations().get(0).getTerm().getName());
}
private Edm fetchEdm() {
List<InputStream> streams = new ArrayList<InputStream>();
streams.add(getClass().getResourceAsStream("annotations.xml"));
streams.add(getClass().getResourceAsStream("VOC_Core.xml"));
streams.add(getClass().getResourceAsStream("UI.xml"));
final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("$metadata.xml"),
streams);
return edm;
}
}

View File

@ -0,0 +1,779 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" Version="1.0">
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="../v4.0/cs02/vocabularies/Org.OData.Common.V1.xml">
<edmx:Include Namespace="com.vocabularies.Common.v1" Alias="Common"/>
</edmx:Reference>
<edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="../v4.0/cs02/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core"/>
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="SEPMRA_SO_MAN2" xml:lang="en">
<EnumType Name="ENString" IsFlags="true" UnderlyingType="Edm.Int16">
<Member Name="String1" Value="1"/>
<Member Name="String2" Value="2"/>
<Member Name="String3" Value="4"/>
</EnumType>
<TypeDefinition Name="TDString" UnderlyingType="Edm.String" MaxLength="15"/>
<ComplexType Name="CTPrim">
<Property Name="PropertyInt16" Type="Edm.Int16"/>
<NavigationProperty Name="NavPropertyDraftAdministrativeDataType" Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType"/>
</ComplexType>
<EntityType Name="I_DraftAdministrativeDataType">
<Key>
<PropertyRef Name="DraftUUID"/>
</Key>
<Property Name="DraftUUID" Type="Edm.Guid" Nullable="false"/>
<Property Name="ComplexProperty" Type="SEPMRA_SO_MAN2.CTPrim" Nullable="true"/>
<Property Name="DraftEntityType" Type="Edm.String" MaxLength="30"/>
<Property Name="CreationDateTime" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="CreatedByUser" Type="Edm.String" MaxLength="12"/>
<Property Name="LastChangeDateTime" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="LastChangedByUser" Type="Edm.String" MaxLength="12"/>
<Property Name="DraftAccessType" Type="Edm.String" MaxLength="1"/>
<Property Name="ProcessingStartDateTime" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="InProcessByUser" Type="Edm.String" MaxLength="12"/>
<Property Name="DraftIsKeptByUser" Type="Edm.Boolean"/>
<Property Name="EnqueueStartDateTime" Type="Edm.DateTimeOffset" Precision="7"/>
<Property Name="DraftIsCreatedByMe" Type="Edm.Boolean"/>
<Property Name="DraftIsLastChangedByMe" Type="Edm.Boolean"/>
<Property Name="DraftIsProcessedByMe" Type="Edm.Boolean"/>
<Property Name="CreatedByUserDescription" Type="Edm.String" MaxLength="80"/>
<Property Name="LastChangedByUserDescription" Type="Edm.String" MaxLength="80"/>
<Property Name="InProcessByUserDescription" Type="Edm.String" MaxLength="80"/>
</EntityType>
<EntityType Name="SEPMRA_C_SalesOrderCustCntctVHType">
<Key>
<PropertyRef Name="ContactPerson"/>
</Key>
<Property Name="ContactPerson" Type="Edm.String" Nullable="false" MaxLength="10"/>
<Property Name="Customer" Type="Edm.String" MaxLength="10"/>
<Property Name="FirstName" Type="Edm.String" MaxLength="40"/>
<Property Name="LastName" Type="Edm.String" MaxLength="40"/>
<Property Name="EmailAddress" Type="Edm.String" MaxLength="255"/>
<NavigationProperty Name="to_Customer" Type="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType"/>
</EntityType>
<EntityType Name="SEPMRA_C_CountryVHType">
<Key>
<PropertyRef Name="Country"/>
</Key>
<Property Name="Country" Type="Edm.String" Nullable="false" MaxLength="3"/>
<Property Name="CountryT" Type="Edm.String" MaxLength="50"/>
</EntityType>
<Action Name="BA_RTCountryVHType" IsBound="true">
<Parameter Name="ParameterCountryType" Type="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType" Nullable="false"/>
<ReturnType Type="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType"/>
</Action>
<Action Name="BA_RTCountryVHType" IsBound="true">
<Parameter Name="ParameterSalesOrder" Type="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType" Nullable="false"/>
<Parameter Name="ParameterCTPrim" Type="SEPMRA_SO_MAN2.CTPrim" Nullable="false"/>
<ReturnType Type="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType"/>
</Action>
<Action Name="BA_RTCountryVHType" IsBound="true">
<Parameter Name="ParameterDraftAdministrativeDataType" Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType" Nullable="false"/>
<Parameter Name="ParameterCTPrim" Type="SEPMRA_SO_MAN2.CTPrim" Nullable="false"/>
<ReturnType Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType"/>
</Action>
<Function Name="_FC_RTTimeOfDay_" IsBound="true" IsComposable="true">
<Parameter Name="ParameterTimeOfDay" Type="Edm.TimeOfDay" Nullable="false"/>
<ReturnType Type="Edm.TimeOfDay"/>
</Function>
<Function Name="_FC_RTTimeOfDay_" IsBound="true" IsComposable="true">
<Parameter Name="ParameterTimeOfDay" Type="Edm.TimeOfDay" Nullable="false"/>
<Parameter Name="ParameterAny" Type="Edm.String" Nullable="false"/>
<ReturnType Type="Edm.TimeOfDay"/>
</Function>
<EntityContainer Name="SEPMRA_SO_MAN2_Entities" m:IsDefaultEntityContainer="true">
<EntitySet Name="I_DraftAdministrativeData" EntityType="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType"/>
<EntitySet Name="SEPMRA_C_SalesOrderCustCntctVH" EntityType="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType">
<NavigationPropertyBinding Path="Customer" Target="SEPMRA_C_CountryVH" />
</EntitySet>
<EntitySet Name="SEPMRA_C_CountryVH" EntityType="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType"/>
<ActionImport Name="AIRTString" Action="Namespace1_Alias.UARTString">
<Annotation Term="Core.Description">
<String>Action Import returns a simple String</String>
</Annotation>
<Annotation Term="SEPMRA_SO_MAN2.Data">
<Bool>true</Bool>
</Annotation>
</ActionImport>
<Singleton Name="SINav" Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType">
<NavigationPropertyBinding Path="NavPropertyDraftAdministrativeDataType" Target="I_DraftAdministrativeData"/>
</Singleton>
</EntityContainer>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTP">
<Annotation Term="Common.DraftRoot">
<Record>
<PropertyValue Property="ActivationAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTPActivation"/>
<PropertyValue Property="EditAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTPEdit"/>
<PropertyValue Property="PreparationAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTPPreparation"/>
<PropertyValue Property="ValidationFunction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTPValidation"/>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_ScheduleLineTP">
<Annotation Term="Common.DraftNode">
<Record>
<PropertyValue Property="PreparationAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_ScheduleLineTPPreparation"/>
<PropertyValue Property="ValidationFunction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_ScheduleLineTPValidation"/>
</Record>
</Annotation>
<Annotation Term="Common.DraftActivationVia">
<Collection>
<String>SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTP</String>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderItemTP">
<Annotation Term="Common.DraftNode">
<Record>
<PropertyValue Property="PreparationAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderItemTPPreparation"/>
<PropertyValue Property="ValidationFunction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderItemTPValidation"/>
</Record>
</Annotation>
<Annotation Term="Common.DraftActivationVia">
<Collection>
<String>SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTP</String>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType/Customer">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Sales Order Customer"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderCustomer"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Customer"/>
<PropertyValue Property="ValueListProperty" String="Customer"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CompanyName"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustomerVHType/Country">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Country"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_CountryVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Country"/>
<PropertyValue Property="ValueListProperty" String="Country"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CountryT"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderItemTPType/SalesOrder">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Sales Order"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderTP"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrder"/>
<PropertyValue Property="ValueListProperty" String="SalesOrder"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderItemTPType/Product">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Product Value Help"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderProductVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Product"/>
<PropertyValue Property="ValueListProperty" String="Product"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Name"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="MainProductCategory"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Supplier"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="SupplierName"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderItemTPType/TransactionCurrency">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Currency"/>
<PropertyValue Property="CollectionPath" String="I_Currency"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="TransactionCurrency"/>
<PropertyValue Property="ValueListProperty" String="Currency"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Currency_Text"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderPartyVHType/Country">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Country"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_CountryVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Country"/>
<PropertyValue Property="ValueListProperty" String="Country"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CountryT"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/CustomerContact">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Customer Contact Person"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderCustCntctVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SoldToParty"/>
<PropertyValue Property="ValueListProperty" String="Customer"/>
</Record>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="CustomerContact"/>
<PropertyValue Property="ValueListProperty" String="ContactPerson"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="FirstName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="LastName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="EmailAddress"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/SoldToParty">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Customer"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderCustomerVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SoldToParty"/>
<PropertyValue Property="ValueListProperty" String="Customer"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CompanyName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CityName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Country"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CountryT"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/BillToParty">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Party"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderPartyVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="BillToParty"/>
<PropertyValue Property="ValueListProperty" String="Party"/>
</Record>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SoldToParty"/>
<PropertyValue Property="ValueListProperty" String="Customer"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="PartyName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CityName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Country"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CountryT"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/ShipToParty">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Party"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderPartyVH"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="ShipToParty"/>
<PropertyValue Property="ValueListProperty" String="Party"/>
</Record>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SoldToParty"/>
<PropertyValue Property="ValueListProperty" String="Customer"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="PartyName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CityName"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Country"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="CountryT"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/CreatedByUser">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Sales Order Reviser"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderReviser"/>
<PropertyValue Property="SearchSupported" Bool="false"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="CreatedByUser"/>
<PropertyValue Property="ValueListProperty" String="UserID"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/LastChangedByUser">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Sales Order Reviser"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderReviser"/>
<PropertyValue Property="SearchSupported" Bool="false"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="LastChangedByUser"/>
<PropertyValue Property="ValueListProperty" String="UserID"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/TransactionCurrency">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Currency"/>
<PropertyValue Property="CollectionPath" String="I_Currency"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="TransactionCurrency"/>
<PropertyValue Property="ValueListProperty" String="Currency"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="Currency_Text"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/SalesOrderOverallStatus">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Status"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderStatus"/>
<PropertyValue Property="SearchSupported" Bool="false"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrderOverallStatus"/>
<PropertyValue Property="ValueListProperty" String="SalesOrderOverallStatus"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="SalesOrderOverallStatus_Text"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/SalesOrderPaymentMethod">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="EPM Demo: Sales Order Payment Method Values"/>
<PropertyValue Property="CollectionPath" String="Sepm_I_SlsordPaymentMethod"/>
<PropertyValue Property="SearchSupported" Bool="false"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrderPaymentMethod"/>
<PropertyValue Property="ValueListProperty" String="SalesOrderPaymentMethod"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="SalesOrderPaymentMethod_Text"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType/SalesOrderPaymentTerms">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="EPM Demo: Sales Order Payment Terms"/>
<PropertyValue Property="CollectionPath" String="Sepm_I_SlsordPaymentTerms"/>
<PropertyValue Property="SearchSupported" Bool="false"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrderPaymentTerms"/>
<PropertyValue Property="ValueListProperty" String="SalesOrderPaymentTerms"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="SalesOrderPaymentTerms_Text"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_ScheduleLineTPType/SalesOrder">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Sales Order"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderTP"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrder"/>
<PropertyValue Property="ValueListProperty" String="SalesOrder"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_ScheduleLineTPType/SalesOrderItem">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Sales Order Item"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_C_SalesOrderItemTP"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrder"/>
<PropertyValue Property="ValueListProperty" String="SalesOrder"/>
</Record>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="SalesOrderItem"/>
<PropertyValue Property="ValueListProperty" String="SalesOrderItem"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_ScheduleLineTPType/QuantityUnit">
<Annotation Term="Common.ValueList">
<Record>
<PropertyValue Property="Label" String="Quantity Unit"/>
<PropertyValue Property="CollectionPath" String="SEPMRA_I_QuantityUnit"/>
<PropertyValue Property="SearchSupported" Bool="true"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="QuantityUnit"/>
<PropertyValue Property="ValueListProperty" String="UnitOfMeasure"/>
</Record>
<Record Type="Common.ValueListParameterDisplayOnly">
<PropertyValue Property="ValueListProperty" String="UnitOfMeasure_Text"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType">
<Annotation Term="UI.SelectionFields">
<Collection>
<PropertyPath>ContactPerson</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderItemTPType">
<Annotation Term="Common.SemanticKey">
<Collection>
<PropertyPath>SalesOrderItem</PropertyPath>
<PropertyPath>SalesOrder</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderPartyVHType">
<Annotation Term="Common.SemanticKey">
<Collection>
<PropertyPath>Party</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType">
<Annotation Term="Common.SemanticKey">
<Collection>
<PropertyPath>SalesOrder</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_ScheduleLineTPType">
<Annotation Term="Common.SemanticKey">
<Collection>
<PropertyPath>ScheduleLine</PropertyPath>
<PropertyPath>SalesOrderItem</PropertyPath>
<PropertyPath>SalesOrder</PropertyPath>
</Collection>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderCustomer">
<Annotation Term="Capabilities.FilterRestrictions">
<Record>
<PropertyValue Property="FilterExpressionRestrictions">
<Collection>
<Record>
<PropertyValue Property="Property" PropertyPath="URL"/>
<PropertyValue Property="AllowedExpressions" String="SearchExpression"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderTPType">
<Annotation Term="Common.SideEffects" Qualifier="AdminData">
<Record>
<PropertyValue Property="SourceEntities">
<Collection>
<NavigationPropertyPath/>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetProperties">
<Collection>
<PropertyPath>LastChangedByUser</PropertyPath>
<PropertyPath>LastChangedDateTime</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
<Annotation Term="Common.SideEffects" Qualifier="SoldToPartyChange">
<Record>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>SoldToParty</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_Customer</NavigationPropertyPath>
<NavigationPropertyPath>to_CustomerContact</NavigationPropertyPath>
<NavigationPropertyPath>to_BillToParty</NavigationPropertyPath>
<NavigationPropertyPath>to_ShipToParty</NavigationPropertyPath>
<NavigationPropertyPath>to_TransactionCurrency</NavigationPropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetProperties">
<Collection>
<PropertyPath>CustomerContact</PropertyPath>
<PropertyPath>BillToParty</PropertyPath>
<PropertyPath>ShipToParty</PropertyPath>
<PropertyPath>NetAmountInTransactionCurrency</PropertyPath>
<PropertyPath>TransactionCurrency</PropertyPath>
<PropertyPath>CustomerContact_fc</PropertyPath>
<PropertyPath>BillToParty_fc</PropertyPath>
<PropertyPath>ShipToParty_fc</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
<Annotation Term="Common.SideEffects" Qualifier="BillToPartyChange">
<Record>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>BillToParty</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_BillToParty</NavigationPropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
<Annotation Term="Common.SideEffects" Qualifier="ShipToPartyChange">
<Record>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>ShipToParty</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_ShipToParty</NavigationPropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
<Annotation Term="Common.SideEffects" Qualifier="CustomerContactChange">
<Record>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>CustomerContact</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_CustomerContact</NavigationPropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderItemTPType">
<Annotation Term="Common.SideEffects" Qualifier="ProductChange">
<Record>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>Product</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_Product</NavigationPropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetProperties">
<Collection>
<PropertyPath>GrossAmountInTransacCurrency</PropertyPath>
<PropertyPath>NetAmountInTransactionCurrency</PropertyPath>
<PropertyPath>TaxAmountInTransactionCurrency</PropertyPath>
<PropertyPath>to_SalesOrder/GrossAmountInTransacCurrency</PropertyPath>
<PropertyPath>to_SalesOrder/NetAmountInTransactionCurrency</PropertyPath>
<PropertyPath>to_SalesOrder/TaxAmountInTransactionCurrency</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
</Annotations>
<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_C_ScheduleLineTPType">
<Annotation Term="Common.SideEffects" Qualifier="QuantityChange">
<Record>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>Quantity</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetProperties">
<Collection>
<PropertyPath>to_SalesOrderItem/GrossAmountInTransacCurrency</PropertyPath>
<PropertyPath>to_SalesOrderItem/TaxAmountInTransactionCurrency</PropertyPath>
<PropertyPath>to_SalesOrderItem/NetAmountInTransactionCurrency</PropertyPath>
<PropertyPath>to_SalesOrder/GrossAmountInTransacCurrency</PropertyPath>
<PropertyPath>to_SalesOrder/NetAmountInTransactionCurrency</PropertyPath>
<PropertyPath>to_SalesOrder/TaxAmountInTransactionCurrency</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
</Record>
</Annotation>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

View File

@ -0,0 +1,467 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/os/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>
<edmx:Reference Uri="/coco/vocabularies/Communication.xml">
<edmx:Include Namespace="Org.OData.Communication.V1" Alias="vCard" />
</edmx:Reference>
<edmx:Reference Uri="/coco/vocabularies/Common.xml">
<edmx:Include Namespace="Org.OData.Common.V1" Alias="Common" />
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Alias="UI" Namespace="com.vocabularies.UI.v1">
<Annotation Term="Core.Description">
<String>Terms for presenting data in user interfaces</String>
</Annotation>
<Annotation Term="Core.Description" Qualifier="Published">
<String>2013-10-16 © Copyright 2013</String>
</Annotation>
<!-- Semantic Views / Perspectives -->
<Term Name="HeaderInfo" Type="UI.HeaderInfoType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
<Annotation Term="Core.Description">
<String>HeaderInfos are mandatory and must be exposed on every thing of the model</String>
</Annotation>
</Term>
<ComplexType Name="HeaderInfoType">
<Property Name="TypeName" Type="Edm.String">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="TypeNamePlural" Type="Edm.String" Nullable="false">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="TypeImageUrl" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="Title" Type="UI.DataField" Nullable="false" />
<Property Name="Description" Type="UI.DataField" Nullable="true" />
<Property Name="ImageUrl" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsURL" />
</Property>
</ComplexType>
<Term Name="Identification" Type="Collection(UI.DataFieldAbstract)" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
<Annotation Term="Core.Description">
<String>HeaderInfo plus this set of attributes identifies the object</String>
</Annotation>
</Term>
<Term Name="Badge" Type="UI.BadgeType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
<Annotation Term="Core.Description">
<String>Badge is similar to a business card view</String>
</Annotation>
</Term>
<ComplexType Name="BadgeType">
<Property Name="HeadLine" Type="UI.DataField" Nullable="false" />
<Property Name="Title" Type="UI.DataField" Nullable="false" />
<Property Name="ImageUrl" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="TypeImageUrl" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="MainInfo" Type="UI.DataField" Nullable="true" />
<Property Name="SecondaryInfo" Type="UI.DataField" Nullable="true" />
</ComplexType>
<Term Name="LineItem" Type="Collection(UI.DataFieldAbstract)" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<Term Name="StatusInfo" Type="Collection(UI.DataFieldAbstract)" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<Term Name="FieldGroup" Type="UI.FieldGroupType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<ComplexType Name="FieldGroupType">
<Property Name="Label" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="Data" Type="Collection(UI.DataFieldAbstract)" />
</ComplexType>
<!-- To be discussed, please don't deliver -->
<Term Name="GeoPoints" Type="Collection(Edm.AnnotationPath)" AppliesTo="EntityType">
<Annotation Term="Core.Description">
<String>
Each collection element MUST reference an annotation of a
vCard.Contact or
collection of vCard.ContactData or
UI.Contacts or
UI.GeoLocation or
of UI.GeoLocationType
</String>
</Annotation>
<Annotation Term="UI.ThingPerspective" />
</Term>
<!-- To be discussed, please don't deliver -->
<Term Name="GeoLocations" Type="Collection(UI.GeoLocationType)" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<Term Name="GeoLocation" Type="UI.GeoLocationType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<ComplexType Name="GeoLocationType">
<Annotation Term="Core.Description">
<String>Set of Attributes which defines the Localization of the object</String>
</Annotation>
<Property Name="Latitude" Type="Edm.Double" Nullable="true" />
<Property Name="Longitude" Type="Edm.Double" Nullable="true" />
<Property Name="Location" Type="Edm.GeographyPoint" Nullable="true" />
<Property Name="Address" Type="vCard.AddressType" Nullable="true" />
</ComplexType>
<Term Name="Contacts" Type="Collection(Edm.AnnotationPath)" AppliesTo="EntityType">
<Annotation Term="Core.Description" String="Each collection element MUST reference an annotation of a vCard.Contact" />
<Annotation Term="UI.ThingPerspective" />
</Term>
<!-- To be discussed, please don't deliver -->
<Term Name="MediaResource" Type="UI.MediaResourceType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
<Annotation Term="Core.Description" String="Properties that are relevant for Media Resources" />
</Term>
<ComplexType Name="MediaResourceType">
<Property Name="Url" Type="Edm.String" Nullable="false">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="ContentType" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsMediaType" />
</Property>
<Property Name="ByteSize" Type="Edm.Int64" Nullable="true" />
<Property Name="ChangedAt" Type="Edm.DateTimeOffset" Nullable="true" />
<Property Name="Thumbnail" Type="UI.ImageType" Nullable="true" />
<Property Name="Title" Type="UI.DataField" Nullable="false" />
<Property Name="Description" Type="UI.DataField" Nullable="true" />
</ComplexType>
<ComplexType Name="ImageType">
<Property Name="Url" Type="Edm.String" Nullable="false">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="Width" Type="Edm.String" Nullable="true" />
<Property Name="Height" Type="Edm.String" Nullable="true" />
</ComplexType>
<!-- To be discussed, please don't deliver -->
<!-- To be discussed, please don't deliver -->
<Term Name="AdditionalInfo" Type="Edm.AnnotationPath" AppliesTo="Annotation">
<Annotation Term="Core.Description">
<String>
Applies to UI.GeoLocation and vCard.Contact annotations only
Provides additional related information for a UI.GeoLocation or vCard.Contact
Reference to UI.HeaderInfo, UI.Badge, a qualified UI.FieldGroup, or a dedicated property tagged with Core.IsUrl
</String>
</Annotation>
</Term>
<!-- To be discussed, please don't deliver -->
<Term Name="DataPoint" Type="UI.DataPointType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<ComplexType Name="DataPointType">
<Property Name="Title" Type="Edm.String" Nullable="false">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="Description" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="LongDescription" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="Value" Type="Edm.PrimitiveType" Nullable="false">
<Annotation Term="Core.Description" String="The numeric value of the DataPoint" />
<Annotation Term="Core.LongDescription">
<String>
It could be annotated with either UoM.ISOCurrency or UoM.Unit.
Percentage values are annotated with UoM.Unit = '%'.
A renderer should take an optional Common.Text annotation into consideration.
</String>
</Annotation>
</Property>
<Property Name="ValueFormat" Type="UI.NumberFormat" Nullable="true" />
<Property Name="ReferencePeriod" Type="UI.ReferencePeriod" Nullable="true" />
<Property Name="Criticality" Type="UI.CriticalityType" Nullable="true" />
<Property Name="CriticalityCalculation" Type="UI.CriticalityCalculationType" Nullable="true" />
<Property Name="Trend" Type="UI.TrendType" Nullable="true" />
<Property Name="TrendCalculation" Type="UI.TrendCalculationType" Nullable="true" />
<Property Name="Responsible" Type="vCard.ContactType" Nullable="true" />
</ComplexType>
<ComplexType Name="NumberFormat">
<Property Name="ScaleFactor" Type="Edm.Decimal" Scale="variable" Nullable="true" />
<Property Name="NumberOfFractionalDigits" Type="Edm.Byte" Nullable="true" />
</ComplexType>
<ComplexType Name="ReferencePeriod">
<Property Name="Description" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="Start" Type="Edm.DateTimeOffset" Nullable="true" />
<Property Name="End" Type="Edm.DateTimeOffset" Nullable="true" />
</ComplexType>
<EnumType Name="CriticalityType">
<Member Name="Negative" />
<Member Name="Critical" />
<Member Name="Positive" />
</EnumType>
<ComplexType Name="CriticalityCalculationType">
<Annotation Term="Core.Description">
<String>
Direction: Target
- Positive: ge ToleranceRangeLowValue and le ToleranceRangeHighValue
- Critical: ge DeviationRangeLowValue and lt ToleranceRangeLowValue or
gt ToleranceRangeHighValue and le DeviationRangeHighValue
- Negative: lt DeviationRangeLowValue and gt DeviationRangeHighValue
Direction: Minimize
- Positive: le ToleranceRangeHighValue
- Critical: gt ToleranceRangeHighValue and le DeviationRangeHighValue
- Negative: gt DeviationRangeHighValue
Direction: Maximize
- Positive: ge ToleranceRangeLowValue
- Critical: lt ToleranceRangeLowValue and ge DeviationRangeLowValue
- Negative: lt DeviationRangeLowValue
</String>
</Annotation>
<Property Name="ImprovementDirection" Type="UI.ImprovementDirectionType" Nullable="false">
</Property>
<Property Name="ToleranceRangeLowValue" Type="Edm.PrimitiveType" Nullable="true" />
<Property Name="ToleranceRangeHighValue" Type="Edm.PrimitiveType" Nullable="true" />
<Property Name="DeviationRangeLowValue" Type="Edm.PrimitiveType" Nullable="true" />
<Property Name="DeviationRangeHighValue" Type="Edm.PrimitiveType" Nullable="true" />
</ComplexType>
<EnumType Name="ImprovementDirectionType">
<Member Name="Minimize" />
<Member Name="Target" />
<Member Name="Maximize" />
</EnumType>
<EnumType Name="TrendType">
<Member Name="StrongUp" />
<Member Name="Up" />
<Member Name="Sideways" />
<Member Name="Down" />
<Member Name="StrongDown" />
</EnumType>
<ComplexType Name="TrendCalculationType">
<Annotation Term="Core.Description">
<String>
Value sub ReferenceValue ( div ReferenceValue if IsRelativeDifference ) must be
- StrongUp: ge StrongUpDifference
- Up: lt StrongUpDifference and ge UpDifference
- Sideways: lt UpDifference and gt DownDifference
- Down: gt StrongDownDifference and le DownDifference
- StrongDown: le StrongDownDifference
</String>
</Annotation>
<Property Name="ReferenceValue" Type="Edm.PrimitiveType" Nullable="false" />
<Property Name="IsRelativeDifference" Type="Edm.Boolean" DefaultValue="false" />
<Property Name="UpDifference" Type="Edm.Decimal" Nullable="false" />
<Property Name="StrongUpDifference" Type="Edm.Decimal" Nullable="false" />
<Property Name="DownDifference" Type="Edm.Decimal" Nullable="false" />
<Property Name="StrongDownDifference" Type="Edm.Decimal" Nullable="false" />
</ComplexType>
<Term Name="Chart" Type="UI.ChartDefinitionType" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
</Term>
<ComplexType Name="ChartDefinitionType">
<Property Name="Title" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="Description" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
<Property Name="ChartType" Type="UI.ChartType" Nullable="false" />
<Property Name="Measures" Type="Collection(Edm.PropertyPath)" />
<Property Name="Dimensions" Type="Collection(Edm.PropertyPath)" />
</ComplexType>
<EnumType Name="ChartType">
<Member Name="Column" />
<Member Name="ColumnStacked" />
<Member Name="ColumnStacked100" />
<Member Name="Bar" />
<Member Name="BarStacked" />
<Member Name="BarStacked100" />
<Member Name="Area" />
<Member Name="AreaStacked" />
<Member Name="AreaStacked100" />
<Member Name="HorizontalArea" />
<Member Name="HorizontalAreaStacked" />
<Member Name="HorizontalAreaStacked100" />
<Member Name="Line" />
<Member Name="Pie" />
<Member Name="Donut" />
<Member Name="Scatter" />
<Member Name="Bubble" />
<Member Name="Radar" />
<Member Name="HeatMap" />
<Member Name="TreeMap" />
<Member Name="Waterfall" />
<!-- Future: GeoPie, GeoBubble, ChoroplethMap -->
</EnumType>
<Term Name="SelectionFields" Type="Collection(Edm.PropertyPath)" AppliesTo="EntityType">
<Annotation Term="UI.ThingPerspective" />
<Annotation Term="Core.Description" String="Properties that might be relevant for filtering a listof entity instances" />
</Term>
<!-- Segmentation of content according to facets of the Object -->
<Term Name="Facets" Type="Collection(UI.Facet)" AppliesTo="EntityType">
</Term>
<ComplexType Name="Facet" Abstract="true">
<Annotation Term="Core.Description" String="Base type for facets" />
<Property Name="Label" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
</ComplexType>
<ComplexType Name="CollectionFacet" BaseType="UI.Facet">
<Annotation Term="Core.Description" String="Collection of Facets" />
<Property Name="Facets" Type="Collection(UI.Facet)" />
</ComplexType>
<ComplexType Name="ReferenceFacet" BaseType="UI.Facet">
<Annotation Term="Core.Description" String="Facet that refers to a thing perspective, e.g. LineItem" />
<Property Name="Target" Type="Edm.AnnotationPath" Nullable="false">
<Annotation Term="Core.Description">
<String>Path MUST end in vCard.Contact or vCard.Address or a term that is tagged with UI.ThingPerspective, e.g. UI.StatusInfo, UI.LineItem, UI.Identification, UI.FieldGroup, UI.Badge</String>
</Annotation>
</Property>
</ComplexType>
<ComplexType Name="ReferenceURLFacet" BaseType="UI.Facet">
<Property Name="Url" Type="Edm.String" Nullable="false">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="UrlContentType" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsMediaType" />
</Property>
</ComplexType>
<!-- basic type definitions for reuse goes here -->
<Term Name="ThingPerspective" Type="Core.Tag" DefaultValue="true" AppliesTo="Term">
<Annotation Term="Core.Description" String="This Term is a Thing Perspective" />
</Term>
<Term Name="IsSummary" Type="Core.Tag" DefaultValue="true" AppliesTo="Record">
<Annotation Term="Core.Description"
String="This Facet and all included Facets are the summary of the thing. At most one Facet of a thing can be tagged with this term" />
<Annotation Term="Core.RequiresType" String="UI.Facet" />
</Term>
<Term Name="PartOfPreview" Type="Core.Tag" DefaultValue="true" AppliesTo="Record">
<Annotation Term="Core.Description" String="This Facet and all included Facets are part of the Thing preview" />
<Annotation Term="Core.RequiresType" String="UI.Facet" />
</Term>
<Term Name="Map" Type="Core.Tag" DefaultValue="true" AppliesTo="Record">
<Annotation Term="Core.Description" String="Target MUST reference a UI.GeoLocation, vCard.Address or a collection of these" />
<Annotation Term="Core.RequiresType" String="UI.ReferenceFacet" />
</Term>
<!-- To be discussed, please don't deliver -->
<Term Name="Gallery" Type="Core.Tag" DefaultValue="true" AppliesTo="Record">
<Annotation Term="Core.Description" String="Target MUST reference a UI.MediaResource" />
<Annotation Term="Core.RequiresType" String="UI.ReferenceFacet" />
</Term>
<!-- To be discussed, please don't deliver -->
<Term Name="IsImageURL" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
<Annotation Term="Core.Description"
String="Properties and terms annotated with this term MUST contain a valid URL referencing an resource with a MIME type image" />
<Annotation Term="Core.RequiresType" String="Edm.String" />
</Term>
<Term Name="MultiLineText" Type="Core.Tag" DefaultValue="true" AppliesTo="Property">
<Annotation Term="Core.Description"
String="Properties annotated with this annotation should be rendered as multi-line text (e.g. text area)" />
<Annotation Term="Core.RequiresType" String="Edm.String" />
</Term>
<!-- To be discussed, please don't deliver -->
<!-- not ready yet, wait for UI5 concerning the format of that value -->
<Term Name="DisplayTimeZone" Type="Edm.Int32" AppliesTo="Property">
<Annotation Term="Core.Description">
<String>Contains information for time- or date-time-fields in which time zone the time value should be displayed.</String>
</Annotation>
</Term>
<!-- To be discussed, please don't deliver -->
<Term Name="Importance" Type="UI.ImportanceType" AppliesTo="Annotation Record">
<Annotation Term="Core.Description"
String="Expresses the importance, e.g. importance of a DataField or a the importance of a annotation" />
</Term>
<EnumType Name="ImportanceType">
<Member Name="High" />
<Member Name="Medium" />
<Member Name="Low" />
</EnumType>
<ComplexType Name="DataFieldAbstract" Abstract="true">
<Property Name="Label" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
</ComplexType>
<ComplexType Name="DataFieldForAnnotation" BaseType="UI.DataFieldAbstract">
<Property Name="Target" Type="Edm.AnnotationPath">
<Annotation Term="Core.Description" String="Annotation path MUST end in vCard.Address or UI.DataPoint" />
</Property>
</ComplexType>
<ComplexType Name="DataFieldForAction" BaseType="UI.DataFieldAbstract">
<Property Name="Action" Type="Common.QualifiedName">
<Annotation Term="Core.Description" String="Qualified name of an Action, Function, ActionImport or FunctionImport in scope" />
</Property>
</ComplexType>
<ComplexType Name="DataField" BaseType="UI.DataFieldAbstract">
<Property Name="Value" Type="Edm.PrimitiveType" Nullable="false">
<Annotation Term="Core.IsLanguageDependent" />
</Property>
</ComplexType>
<ComplexType Name="DataFieldWithNavigationPath" BaseType="UI.DataField">
<Property Name="Target" Type="Edm.NavigationPropertyPath" Nullable="false">
<Annotation Term="Core.Description">
<String>Contains either a navigation property or a term cast, where term is of type Edm.EntityType or a concrete entity type or a collection of these types</String>
</Annotation>
</Property>
</ComplexType>
<ComplexType Name="DataFieldWithUrl" BaseType="UI.DataField">
<Property Name="Url" Type="Edm.String" Nullable="false">
<Annotation Term="Core.IsURL" />
</Property>
<Property Name="UrlContentType" Type="Edm.String" Nullable="true">
<Annotation Term="Core.IsMediaType" />
</Property>
</ComplexType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

File diff suppressed because it is too large Load Diff

View File

@ -91,6 +91,16 @@ public interface Edm {
*/
EdmEntityType getEntityType(FullQualifiedName name);
/**
* Get entity type with annotations by full qualified name.
* <br/>
* See {@link EdmEntityType} for more information.
*
* @param name full qualified name of entity type
* @return {@link EdmEntityType}
*/
EdmEntityType getEntityTypeWithAnnotations(FullQualifiedName name);
/**
* Get complex type by full qualified name..
* <br/>
@ -101,6 +111,16 @@ public interface Edm {
*/
EdmComplexType getComplexType(FullQualifiedName name);
/**
* Get complex type with annotations by full qualified name..
* <br/>
* See {@link EdmComplexType} for more information.
*
* @param name full qualified name of complex type
* @return {@link EdmComplexType}
*/
EdmComplexType getComplexTypeWithAnnotations(FullQualifiedName name);
/**
* Get unbound Action by full qualified name.
*

View File

@ -58,4 +58,11 @@ public interface EdmBindingTarget extends EdmNamed, EdmAnnotatable, EdmMappable
* @return {@link EdmEntityType}
*/
EdmEntityType getEntityType();
/**
* Get the entity type with annotations defined in external file.
*
* @return {@link EdmEntityType}
*/
EdmEntityType getEntityTypeWithAnnotations();
}

View File

@ -76,6 +76,14 @@ public interface EdmEntityContainer extends EdmNamed, EdmAnnotatable {
* @return returns all entity sets for this container.
*/
List<EdmEntitySet> getEntitySets();
/**
* This method <b>DOES NOT</b> support lazy loading
*
* @return returns all entity sets for this container with
* annotations defined in external file.
*/
List<EdmEntitySet> getEntitySetsWithAnnotations();
/**
* This method <b>DOES NOT</b> support lazy loading

View File

@ -75,4 +75,11 @@ public interface EdmProperty extends EdmElement, EdmMappable, EdmAnnotatable {
* @return the default value as a String or null if not specified
*/
String getDefaultValue();
/**
* See {@link EdmType} for more information about possible types.
*
* @return {@link EdmType}
*/
EdmType getTypeWithAnnotations();
}

View File

@ -103,4 +103,51 @@ public class CsdlAnnotation extends CsdlAbstractEdmItem implements CsdlAnnotatab
public List<CsdlAnnotation> getAnnotations() {
return annotations;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlAnnotation)) {
return false;
}
CsdlAnnotation csdlAnnot = (CsdlAnnotation) obj;
return (this.getTerm() == null ? csdlAnnot.getTerm() == null :
this.getTerm().equals(csdlAnnot.getTerm()))
&& (this.getQualifier() == null ? csdlAnnot.getQualifier() == null :
this.getQualifier().equals(csdlAnnot.getQualifier()))
&& (this.getExpression() == null ? csdlAnnot.getExpression() == null :
this.getExpression().equals(csdlAnnot.getExpression()))
&& (this.getAnnotations() == null ? csdlAnnot.getAnnotations() == null :
checkAnnotations(csdlAnnot.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlAnnots) {
if (csdlAnnots == null) {
return false;
}
if (this.getAnnotations().size() == csdlAnnots.size()) {
for (int i = 0; i < this.getAnnotations().size(); i++) {
if (!this.getAnnotations().get(i).equals(csdlAnnots.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((term == null) ? 0 : term.hashCode());
result = prime * result + ((qualifier == null) ? 0 : qualifier.hashCode());
result = prime * result + ((annotationExpression == null) ? 0 :
annotationExpression.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -37,4 +37,26 @@ public class CsdlAnnotationPath extends CsdlDynamicExpression {
public String getValue() {
return value;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlAnnotationPath)) {
return false;
}
CsdlAnnotationPath csdlAnnotPath = (CsdlAnnotationPath) obj;
return this.getValue() == null ? csdlAnnotPath.getValue() == null :
this.getValue().equals(csdlAnnotPath.getValue());
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}

View File

@ -73,4 +73,63 @@ public class CsdlApply extends CsdlDynamicExpression implements CsdlAnnotatable
this.parameters = parameters;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlApply)) {
return false;
}
CsdlApply annotApply = (CsdlApply) obj;
return (this.getFunction() == null ? annotApply.getFunction() == null :
this.getFunction().equals(annotApply.getFunction()))
&& (this.getParameters() == null ? annotApply.getParameters() == null :
checkParamaters(annotApply.getParameters()))
&& (this.getAnnotations() == null ? annotApply.getAnnotations() == null :
checkAnnotations(annotApply.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> annotApplyannotations) {
if (annotApplyannotations == null) {
return false;
}
if (this.getAnnotations().size() == annotApplyannotations.size()) {
for (int i = 0; i < this.getAnnotations().size(); i++) {
if (!this.getAnnotations().get(i).equals(annotApplyannotations.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
private boolean checkParamaters(List<CsdlExpression> annotApplyParams) {
if (annotApplyParams == null) {
return false;
}
if (this.getParameters().size() == annotApplyParams.size()) {
for (int i = 0; i < this.getParameters().size(); i++) {
if (!this.getParameters().get(i).equals(annotApplyParams.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((function == null) ? 0 : function.hashCode());
result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -126,4 +126,59 @@ public class CsdlCast extends CsdlDynamicExpression implements CsdlAnnotatable {
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlCast)) {
return false;
}
CsdlCast csdlCast = (CsdlCast) obj;
return (this.getValue() == null ? csdlCast.getValue() == null :
this.getValue().equals(csdlCast.getValue()))
&& (this.getType() == null ? csdlCast.getType() == null :
this.getType().equals(csdlCast.getType()))
&& (this.getMaxLength() == null ? csdlCast.getMaxLength() == null :
this.getMaxLength().equals(csdlCast.getMaxLength()))
&& (this.getPrecision() == null ? csdlCast.getPrecision() == null :
this.getPrecision().equals(csdlCast.getPrecision()))
&& (this.getScale() == null ? csdlCast.getScale() == null :
this.getScale().equals(csdlCast.getScale()))
&& (this.getSrid() == null ? csdlCast.getSrid() == null :
String.valueOf(this.getSrid()).equals(String.valueOf(csdlCast.getSrid())))
&& (this.getAnnotations() == null ? csdlCast.getAnnotations() == null :
checkAnnotations(csdlCast.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlCastAnnotations) {
if (csdlCastAnnotations == null) {
return false;
}
if (this.getAnnotations().size() == csdlCastAnnotations.size()) {
for (int i = 0; i < this.getAnnotations().size(); i++) {
if (!this.getAnnotations().get(i).equals(csdlCastAnnotations.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((maxLength == null) ? 0 : maxLength.hashCode());
result = prime * result + ((precision == null) ? 0 : precision.hashCode());
result = prime * result + ((scale == null) ? 0 : scale.hashCode());
result = prime * result + ((srid == null) ? 0 : srid.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -46,4 +46,41 @@ public class CsdlCollection extends CsdlDynamicExpression {
this.items = items;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlCollection)) {
return false;
}
CsdlCollection annotColl = (CsdlCollection) obj;
return (this.getItems() == null ? annotColl.getItems() == null :
checkItems(annotColl.getItems()));
}
private boolean checkItems(List<CsdlExpression> annotCollItems) {
if (annotCollItems == null) {
return false;
}
if (this.getItems().size() == annotCollItems.size()) {
for (int i = 0; i < this.getItems().size(); i++) {
if (!this.getItems().get(i).equals(annotCollItems.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((items == null) ? 0 : items.hashCode());
return result;
}
}

View File

@ -128,4 +128,28 @@ public class CsdlConstantExpression extends CsdlExpression {
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlConstantExpression)) {
return false;
}
CsdlConstantExpression csdlConstExp = (CsdlConstantExpression) obj;
return (this.getValue() == null ? csdlConstExp.getValue() == null :
this.getValue().equals(csdlConstExp.getValue()))
&& (this.getType() == null ? csdlConstExp.getType() == null :
this.getType().equals(csdlConstExp.getType()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}

View File

@ -90,4 +90,50 @@ public class CsdlIf extends CsdlDynamicExpression implements CsdlAnnotatable {
this._else = _else;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlIf)) {
return false;
}
CsdlIf csdlIf = (CsdlIf) obj;
return (this.getGuard() == null ? csdlIf.getGuard() == null :
this.getGuard().equals(csdlIf.getGuard()))
&& (this.getThen() == null ? csdlIf.getThen() == null :
this.getThen().equals(csdlIf.getThen()))
&& (this.getElse() == null ? csdlIf.getElse() == null :
this.getElse().equals(csdlIf.getElse()))
&& (this.getAnnotations() == null ? csdlIf.getAnnotations() == null :
checkAnnotations(csdlIf.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlIfAnnotations) {
if (csdlIfAnnotations == null) {
return false;
}
if (this.getAnnotations().size() == csdlIfAnnotations.size()) {
for (int i = 0; i < this.getAnnotations().size(); i++) {
if (!this.getAnnotations().get(i).equals(csdlIfAnnotations.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((guard == null) ? 0 : guard.hashCode());
result = prime * result + ((_then == null) ? 0 : _then.hashCode());
result = prime * result + ((_else == null) ? 0 : _else.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -126,4 +126,58 @@ return this;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlIsOf)) {
return false;
}
CsdlIsOf csdlIsOf = (CsdlIsOf) obj;
return (this.getType() == null ? csdlIsOf.getType() == null :
this.getType().equals(csdlIsOf.getType()))
&& (this.getMaxLength() == null ? csdlIsOf.getMaxLength() == null :
this.getMaxLength().equals(csdlIsOf.getMaxLength()))
&& (this.getPrecision() == null ? csdlIsOf.getPrecision() == null :
this.getPrecision().equals(csdlIsOf.getPrecision()))
&& (this.getScale() == null ? csdlIsOf.getScale() == null :
this.getScale().equals(csdlIsOf.getScale()))
&& (this.getSrid() == null ? csdlIsOf.getSrid() == null :
this.getSrid().equals(csdlIsOf.getSrid()))
&& (this.getValue() == null ? csdlIsOf.getValue() == null :
this.getValue().equals(csdlIsOf.getValue()))
&& (this.getAnnotations() == null ? csdlIsOf.getAnnotations() == null :
checkAnnotations(csdlIsOf.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlIsOfannot) {
if (csdlIsOfannot == null) {
return false;
}
if (this.getAnnotations().size() == csdlIsOfannot.size()) {
for (int i = 0; i < this.getAnnotations().size(); i++) {
if (!this.getAnnotations().get(i).equals(csdlIsOfannot.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((maxLength == null) ? 0 : maxLength.hashCode());
result = prime * result + ((precision == null) ? 0 : precision.hashCode());
result = prime * result + ((scale == null) ? 0 : scale.hashCode());
result = prime * result + ((srid == null) ? 0 : srid.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -69,4 +69,48 @@ public class CsdlLabeledElement extends CsdlDynamicExpression implements CsdlAnn
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlLabeledElement)) {
return false;
}
CsdlLabeledElement csdlLabelledEle = (CsdlLabeledElement) obj;
return (this.getName() == null ? csdlLabelledEle.getName() == null :
this.getName().equals(csdlLabelledEle.getName()))
&& (this.getValue() == null ? csdlLabelledEle.getValue() == null :
this.getValue().equals(csdlLabelledEle.getValue()))
&& (this.getAnnotations() == null ? csdlLabelledEle.getAnnotations() == null :
checkAnnotations(csdlLabelledEle.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlLabelledEleAnnotations) {
if (csdlLabelledEleAnnotations == null) {
return false;
}
if (this.getAnnotations().size() == csdlLabelledEleAnnotations.size()) {
for (int i = 0; i < this.getAnnotations().size() ; i++) {
if (!this.getAnnotations().get(i).equals(
csdlLabelledEleAnnotations.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -38,4 +38,25 @@ public class CsdlLabeledElementReference extends CsdlDynamicExpression {
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlLabeledElementReference)) {
return false;
}
CsdlLabeledElementReference csdlLabelledEleRef = (CsdlLabeledElementReference) obj;
return (this.getValue() == null ? csdlLabelledEleRef.getValue() == null :
this.getValue().equals(csdlLabelledEleRef.getValue()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}

View File

@ -145,4 +145,51 @@ public class CsdlLogicalOrComparisonExpression extends CsdlDynamicExpression imp
}
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlLogicalOrComparisonExpression)) {
return false;
}
CsdlLogicalOrComparisonExpression csdlLogComp = (CsdlLogicalOrComparisonExpression) obj;
return (this.getLeft() == null ? csdlLogComp.getLeft() == null :
this.getLeft().equals(csdlLogComp.getLeft()))
&& (this.getRight() == null ? csdlLogComp.getRight() == null :
this.getRight().equals(csdlLogComp.getRight()))
&& (this.getType() == null ? csdlLogComp.getType() == null :
this.getType().equals(csdlLogComp.getType()))
&& (this.getAnnotations() == null ? csdlLogComp.getAnnotations() == null :
checkAnnotations(csdlLogComp.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlLogCompAnnot) {
if (csdlLogCompAnnot == null) {
return false;
}
if (this.getAnnotations().size() == csdlLogCompAnnot.size()) {
for (int i = 0; i < this.getAnnotations().size() ; i++) {
if (!this.getAnnotations().get(i).equals(csdlLogCompAnnot.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((left == null) ? 0 : left.hashCode());
result = prime * result + ((right == null) ? 0 : right.hashCode());
result = prime * result + ((annotations == null) ? 0 :
annotations.hashCode());
return result;
}
}

View File

@ -39,4 +39,25 @@ public class CsdlNavigationPropertyPath extends CsdlDynamicExpression {
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlNavigationPropertyPath)) {
return false;
}
CsdlNavigationPropertyPath csdlNavPropPath = (CsdlNavigationPropertyPath) obj;
return (this.getValue() == null ? csdlNavPropPath.getValue() == null :
this.getValue().equals(csdlNavPropPath.getValue()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}

View File

@ -40,4 +40,42 @@ public class CsdlNull extends CsdlDynamicExpression implements CsdlAnnotatable {
this.annotations = annotations;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlNull)) {
return false;
}
CsdlNull csdlNull = (CsdlNull) obj;
return (this.getAnnotations() == null ? csdlNull.getAnnotations() == null :
checkAnnotations(csdlNull.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlNullAnnot) {
if (csdlNullAnnot == null) {
return false;
}
if (this.getAnnotations().size() == csdlNullAnnot.size()) {
for (int i = 0; i < this.getAnnotations().size() ; i++) {
if (!this.getAnnotations().get(i).equals(csdlNullAnnot.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((annotations == null) ? 0 :
annotations.hashCode());
return result;
}
}

View File

@ -40,4 +40,25 @@ public class CsdlPath extends CsdlDynamicExpression {
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlPath)) {
return false;
}
CsdlPath csdlPath = (CsdlPath) obj;
return (this.getValue() == null ? csdlPath.getValue() == null :
this.getValue().equals(csdlPath.getValue()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}

View File

@ -38,4 +38,25 @@ public class CsdlPropertyPath extends CsdlDynamicExpression {
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlPropertyPath)) {
return false;
}
CsdlPropertyPath csdlPropPath = (CsdlPropertyPath) obj;
return this.getValue() == null ? csdlPropPath.getValue() == null :
this.getValue().equals(csdlPropPath.getValue());
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
}

View File

@ -71,4 +71,50 @@ public class CsdlPropertyValue extends CsdlAbstractEdmItem implements CsdlAnnota
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlPropertyValue)) {
return false;
}
CsdlPropertyValue csdlPropertyValue = (CsdlPropertyValue) obj;
return (this.getProperty() == null ? csdlPropertyValue.getProperty() == null :
this.getProperty().equalsIgnoreCase(csdlPropertyValue.getProperty()))
&& (this.getValue() == null ? csdlPropertyValue.getValue() == null :
this.getValue().equals(csdlPropertyValue.getValue()))
&& (this.getAnnotations() == null ? csdlPropertyValue.getAnnotations() == null :
checkAnnotations(csdlPropertyValue.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlPropertyValueAnnot) {
if (csdlPropertyValueAnnot == null) {
return false;
}
if (this.getAnnotations().size() == csdlPropertyValueAnnot.size()) {
for (int i = 0; i < this.getAnnotations().size() ; i++) {
if (!this.getAnnotations().get(i).equals(
csdlPropertyValueAnnot.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((property == null) ? 0 : property.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((annotations == null) ? 0 :
annotations.hashCode());
return result;
}
}

View File

@ -69,4 +69,66 @@ public class CsdlRecord extends CsdlDynamicExpression implements CsdlAnnotatable
this.propertyValues = propertyValues;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlRecord)) {
return false;
}
CsdlRecord csdlRecord = (CsdlRecord) obj;
return (this.getType() == null ? csdlRecord.getType() == null :
this.getType().equals(csdlRecord.getType()))
&& (this.getAnnotations() == null ? csdlRecord.getAnnotations() == null :
checkAnnotations(csdlRecord.getAnnotations()))
&& (this.getPropertyValues() == null ? csdlRecord.getPropertyValues() == null :
checkPropertyValues(csdlRecord.getPropertyValues()));
}
private boolean checkPropertyValues(List<CsdlPropertyValue> csdlRecordpropertyValues) {
if (csdlRecordpropertyValues == null) {
return false;
}
if (this.getPropertyValues().size() == csdlRecordpropertyValues.size()) {
for (int i = 0; i < this.getPropertyValues().size(); i++) {
if (!this.getPropertyValues().get(i).equals(
csdlRecordpropertyValues.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlRecordAnnot) {
if (csdlRecordAnnot == null) {
return false;
}
if (this.getAnnotations().size() == csdlRecordAnnot.size()) {
for (int i = 0; i < this.getAnnotations().size() ; i++) {
if (!this.getAnnotations().get(i).equals(csdlRecordAnnot.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((propertyValues == null) ? 0 :
propertyValues.hashCode());
result = prime * result + ((annotations == null) ? 0 :
annotations.hashCode());
return result;
}
}

View File

@ -55,4 +55,44 @@ public class CsdlUrlRef extends CsdlDynamicExpression implements CsdlAnnotatable
this.value = value;
return this;
}
@Override
public boolean equals (Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof CsdlUrlRef)) {
return false;
}
CsdlUrlRef csdlUrlRef = (CsdlUrlRef) obj;
return (this.getValue() == null ? csdlUrlRef.getValue() == null :
this.getValue().equals(csdlUrlRef.getValue()))
&& (this.getAnnotations() == null ? csdlUrlRef.getAnnotations() == null :
checkAnnotations(csdlUrlRef.getAnnotations()));
}
private boolean checkAnnotations(List<CsdlAnnotation> csdlUrlRefAnnot) {
if (csdlUrlRefAnnot == null) {
return false;
}
if (this.getAnnotations().size() == csdlUrlRefAnnot.size()) {
for (int i = 0; i < this.getAnnotations().size() ; i++) {
if (!this.getAnnotations().get(i).equals(csdlUrlRefAnnot.get(i))) {
return false;
}
}
} else {
return false;
}
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
result = prime * result + ((annotations == null) ? 0 : annotations.hashCode());
return result;
}
}

View File

@ -42,6 +42,9 @@ public abstract class AbstractEdm implements Edm {
protected Map<String, EdmSchema> schemas;
protected List<EdmSchema> schemaList;
private boolean isEntityDerivedFromES;
private boolean isComplexDerivedFromES;
private boolean isPreviousES;
private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
Collections.synchronizedMap(new HashMap<FullQualifiedName, EdmEntityContainer>());
@ -80,6 +83,18 @@ public abstract class AbstractEdm implements Edm {
Collections.synchronizedMap(new HashMap<TargetQualifierMapKey, EdmAnnotations>());
private Map<String, String> aliasToNamespaceInfo = null;
private final Map<FullQualifiedName, EdmEntityType> entityTypesWithAnnotations =
Collections.synchronizedMap(new HashMap<FullQualifiedName, EdmEntityType>());
private final Map<FullQualifiedName, EdmEntityType> entityTypesDerivedFromES =
Collections.synchronizedMap(new HashMap<FullQualifiedName, EdmEntityType>());
private final Map<FullQualifiedName, EdmComplexType> complexTypesWithAnnotations =
Collections.synchronizedMap(new HashMap<FullQualifiedName, EdmComplexType>());
private final Map<FullQualifiedName, EdmComplexType> complexTypesDerivedFromES =
Collections.synchronizedMap(new HashMap<FullQualifiedName, EdmComplexType>());
@Override
public List<EdmSchema> getSchemas() {
@ -175,6 +190,56 @@ public abstract class AbstractEdm implements Edm {
return entityType;
}
@Override
public EdmEntityType getEntityTypeWithAnnotations(final FullQualifiedName namespaceOrAliasFQN) {
final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
EdmEntityType entityType = entityTypesWithAnnotations.get(fqn);
if (entityType == null) {
entityType = createEntityType(fqn);
if (entityType != null) {
entityTypesWithAnnotations.put(fqn, entityType);
}
}
setIsPreviousES(false);
return entityType;
}
protected EdmEntityType getEntityTypeWithAnnotations(final FullQualifiedName namespaceOrAliasFQN,
boolean isEntityDerivedFromES) {
this.isEntityDerivedFromES = isEntityDerivedFromES;
final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
if (!isPreviousES() && getEntityContainer() != null) {
getEntityContainer().getEntitySetsWithAnnotations();
}
EdmEntityType entityType = entityTypesDerivedFromES.get(fqn);
if (entityType == null) {
entityType = createEntityType(fqn);
if (entityType != null) {
entityTypesDerivedFromES.put(fqn, entityType);
}
}
this.isEntityDerivedFromES = false;
return entityType;
}
protected EdmComplexType getComplexTypeWithAnnotations(final FullQualifiedName namespaceOrAliasFQN,
boolean isComplexDerivedFromES) {
this.isComplexDerivedFromES = isComplexDerivedFromES;
final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
if (!isPreviousES() && getEntityContainer() != null) {
getEntityContainer().getEntitySetsWithAnnotations();
}
EdmComplexType complexType = complexTypesDerivedFromES.get(fqn);
if (complexType == null) {
complexType = createComplexType(fqn);
if (complexType != null) {
complexTypesDerivedFromES.put(fqn, complexType);
}
}
this.isComplexDerivedFromES = false;
return complexType;
}
@Override
public EdmComplexType getComplexType(final FullQualifiedName namespaceOrAliasFQN) {
final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
@ -188,6 +253,20 @@ public abstract class AbstractEdm implements Edm {
return complexType;
}
@Override
public EdmComplexType getComplexTypeWithAnnotations(final FullQualifiedName namespaceOrAliasFQN) {
final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
EdmComplexType complexType = complexTypesWithAnnotations.get(fqn);
if (complexType == null) {
complexType = createComplexType(fqn);
if (complexType != null) {
complexTypesWithAnnotations.put(fqn, complexType);
}
}
setIsPreviousES(false);
return complexType;
}
@Override
public EdmAction getUnboundAction(final FullQualifiedName actionName) {
final FullQualifiedName fqn = resolvePossibleAlias(actionName);
@ -452,4 +531,20 @@ public abstract class AbstractEdm implements Edm {
}
return functions;
}
protected boolean isEntityDerivedFromES() {
return isEntityDerivedFromES;
}
protected boolean isComplexDerivedFromES() {
return isComplexDerivedFromES;
}
protected void setIsPreviousES(boolean isPreviousES) {
this.isPreviousES = isPreviousES;
}
protected boolean isPreviousES() {
return isPreviousES;
}
}

View File

@ -78,6 +78,17 @@ public abstract class AbstractEdmBindingTarget extends AbstractEdmNamed implemen
return entityType;
}
@Override
public EdmEntityType getEntityTypeWithAnnotations() {
final EdmEntityType entityType = ((AbstractEdm)edm).
getEntityTypeWithAnnotations(target.getTypeFQN(), true);
if (entityType == null) {
throw new EdmException("Can´t find entity type: " + target.getTypeFQN() + " for entity set or singleton: "
+ getName());
}
return entityType;
}
@Override
public EdmBindingTarget getRelatedBindingTarget(final String path) {
if (path == null) {

View File

@ -34,12 +34,20 @@ import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmSingleton;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
import org.apache.olingo.commons.api.ex.ODataException;
public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntityContainer {
@ -61,6 +69,12 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
private List<EdmFunctionImport> functionImports;
private final Map<String, EdmFunctionImport> functionImportCache = Collections.synchronizedMap(
new LinkedHashMap<String, EdmFunctionImport>());
private boolean isAnnotationsIncluded = false;
private final Map<String, EdmEntitySet> entitySetWithAnnotationsCache = Collections.synchronizedMap(
new LinkedHashMap<String, EdmEntitySet>());
private final Map<String, EdmSingleton> singletonWithAnnotationsCache = Collections.synchronizedMap(
new LinkedHashMap<String, EdmSingleton>());
private boolean isSingletonAnnotationsIncluded = false;
public EdmEntityContainerImpl(final Edm edm, final CsdlEdmProvider provider,
final CsdlEntityContainerInfo entityContainerInfo) {
@ -76,7 +90,8 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
this.provider = provider;
container = entityContainer;
entityContainerName = containerFQN;
parentContainerName = entityContainer.getExtendsContainerFQN();
parentContainerName = entityContainer == null ? null :
entityContainer.getExtendsContainerFQN();
}
@Override
@ -91,11 +106,18 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public EdmSingleton getSingleton(final String singletonName) {
EdmSingleton singleton = singletonCache.get(singletonName);
EdmSingleton singleton = singletonWithAnnotationsCache.get(singletonName);
if (singleton == null) {
singleton = createSingleton(singletonName);
if (singleton != null) {
singletonCache.put(singletonName, singleton);
singleton = singletonCache.get(singletonName);
if (singleton == null) {
singleton = createSingleton(singletonName);
if (singleton != null) {
if (isSingletonAnnotationsIncluded) {
singletonWithAnnotationsCache.put(singletonName, singleton);
} else {
singletonCache.put(singletonName, singleton);
}
}
}
}
return singleton;
@ -103,13 +125,21 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
@Override
public EdmEntitySet getEntitySet(final String entitySetName) {
EdmEntitySet entitySet = entitySetCache.get(entitySetName);
EdmEntitySet entitySet = entitySetWithAnnotationsCache.get(entitySetName);
if (entitySet == null) {
entitySet = createEntitySet(entitySetName);
if (entitySet != null) {
entitySetCache.put(entitySetName, entitySet);
entitySet = entitySetCache.get(entitySetName);
if (entitySet == null) {
entitySet = createEntitySet(entitySetName);
if (entitySet != null) {
if (isAnnotationsIncluded) {
entitySetWithAnnotationsCache.put(entitySetName, entitySet);
} else {
entitySetCache.put(entitySetName, entitySet);
}
}
}
}
((EdmProviderImpl)edm).setIsPreviousES(true);
return entitySet;
}
@ -145,6 +175,12 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
return Collections.unmodifiableList(entitySets);
}
@Override
public List<EdmEntitySet> getEntitySetsWithAnnotations() {
loadAllEntitySets();
return Collections.unmodifiableList(entitySets);
}
@Override
public List<EdmFunctionImport> getFunctionImports() {
if (functionImports == null) {
@ -180,6 +216,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
try {
final CsdlSingleton providerSingleton = provider.getSingleton(entityContainerName, singletonName);
if (providerSingleton != null) {
addAnnotations(providerSingleton, entityContainerName);
singleton = new EdmSingletonImpl(edm, this, providerSingleton);
}
} catch (ODataException e) {
@ -189,12 +226,112 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
return singleton;
}
private void addAnnotations(CsdlSingleton singleton, FullQualifiedName entityContainerName) {
boolean isPropAnnotationsCleared = false;
boolean isNavPropAnnotationsCleared = false;
CsdlEntityType entityType = fetchEntityTypeFromSingleton(singleton);
if (entityType == null) {
return;
}
List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + singleton.getName())) {
isSingletonAnnotationsIncluded = true;
addAnnotationsToSingleton(singleton, annotationGrp);
} else {
addAnnotationsToPropertiesDerivedFromSingleton(singleton, isPropAnnotationsCleared,
isNavPropAnnotationsCleared, entityType, annotationGrp);
isPropAnnotationsCleared = true;
isNavPropAnnotationsCleared = true;
}
}
}
}
/** adds annotations to entity type properties derived from singleton
* @param singleton
* @param isPropAnnotationsCleared
* @param isNavPropAnnotationsCleared
* @param entityType
* @param annotationGrp
*/
private void addAnnotationsToPropertiesDerivedFromSingleton(CsdlSingleton singleton, boolean isPropAnnotationsCleared,
boolean isNavPropAnnotationsCleared, CsdlEntityType entityType, CsdlAnnotations annotationGrp) {
for (CsdlProperty propertyName : entityType.getProperties()) {
if (!isPropAnnotationsCleared) {
entityType.getProperty(propertyName.getName()).getAnnotations().clear();
}
if (isPropertyComplex(propertyName)) {
CsdlComplexType complexType = getComplexTypeFromProperty(propertyName);
addAnnotationsToComplexTypeIncludedFromSingleton(singleton,
annotationGrp, propertyName, isNavPropAnnotationsCleared, complexType);
}
}
}
/** Adds annotation to singleton
* @param singleton
* @param annotationGrp
*/
private void addAnnotationsToSingleton(CsdlSingleton singleton, CsdlAnnotations annotationGrp) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(singleton.getAnnotations(), annotation)) {
singleton.getAnnotations().add(annotation);
}
}
}
/**
* @param singleton
* @return
*/
private CsdlEntityType fetchEntityTypeFromSingleton(CsdlSingleton singleton) {
CsdlEntityType entityType;
try {
entityType = singleton.getTypeFQN() != null ? this.provider.getEntityType(new FullQualifiedName(
singleton.getTypeFQN().getFullQualifiedNameAsString())) : null;
} catch (ODataException e) {
throw new EdmException(e);
}
return entityType;
}
/**
*
* @param singleton
* @param entityContainerName2
* @param annotationGrp
* @param propertyName
* @param isComplexNavPropAnnotationsCleared
* @param complexType
*/
private void addAnnotationsToComplexTypeIncludedFromSingleton(CsdlSingleton singleton,
CsdlAnnotations annotationGrp, CsdlProperty propertyName,
boolean isComplexNavPropAnnotationsCleared, CsdlComplexType complexType) {
for (CsdlNavigationProperty complexNavPropertyName : complexType.getNavigationProperties()) {
if (!isComplexNavPropAnnotationsCleared) {
complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().clear();
}
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + singleton.getName() + "/" +
propertyName.getName() + "/" + complexNavPropertyName.getName())) {
isSingletonAnnotationsIncluded = true;
addAnnotationsToComplexTypeNavProperties(annotationGrp, complexType, complexNavPropertyName);
}
}
}
protected EdmEntitySet createEntitySet(final String entitySetName) {
EdmEntitySet entitySet = null;
try {
final CsdlEntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName);
if (providerEntitySet != null) {
addAnnotations(providerEntitySet, entityContainerName);
entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet);
}
} catch (ODataException e) {
@ -204,12 +341,228 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
return entitySet;
}
private void addAnnotations(CsdlEntitySet entitySet, FullQualifiedName entityContainerName) {
boolean isPropAnnotationsCleared = false;
boolean isNavPropAnnotationsCleared = false;
CsdlEntityType entityType = getCsdlEntityTypeFromEntitySet(entitySet);
if (entityType == null) {
return;
}
List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + entitySet.getName())) {
isAnnotationsIncluded = true;
addAnnotationsToEntitySet(entitySet, annotationGrp);
} else {
addAnnotationsToEntityTypeIncludedFromES(entitySet, entityContainerName,
annotationGrp, isPropAnnotationsCleared, isNavPropAnnotationsCleared, entityType);
isPropAnnotationsCleared = true;
isNavPropAnnotationsCleared = true;
}
}
}
}
/**
* @param entitySet
* @param annotationGrp
*/
private void addAnnotationsToEntitySet(CsdlEntitySet entitySet, CsdlAnnotations annotationGrp) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(entitySet.getAnnotations(), annotation)) {
entitySet.getAnnotations().add(annotation);
}
}
}
/**
* @param entitySet
* @return
*/
private CsdlEntityType getCsdlEntityTypeFromEntitySet(CsdlEntitySet entitySet) {
CsdlEntityType entityType;
try {
entityType = entitySet.getTypeFQN() != null ? this.provider.getEntityType(new FullQualifiedName(
entitySet.getTypeFQN().getFullQualifiedNameAsString())) : null;
} catch (ODataException e) {
throw new EdmException(e);
}
return entityType;
}
/** Adds annotations to Entity type Properties derived from entity set
* @param entitySet
* @param entityContainerName
* @param annotationGrp
* @param entityType
* @param isNavPropAnnotationsCleared
* @param isPropAnnotationsCleared
* @return
*/
private void addAnnotationsToEntityTypeIncludedFromES(CsdlEntitySet entitySet,
FullQualifiedName entityContainerName, CsdlAnnotations annotationGrp,
boolean isPropAnnotationsCleared, boolean isNavPropAnnotationsCleared, CsdlEntityType entityType) {
for (CsdlProperty propertyName : entityType.getProperties()) {
if (!isPropAnnotationsCleared) {
entityType.getProperty(propertyName.getName()).getAnnotations().clear();
}
if (isPropertyComplex(propertyName)) {
CsdlComplexType complexType = getComplexTypeFromProperty(propertyName);
addAnnotationsToComplexTypeIncludedFromES(entitySet, entityContainerName,
annotationGrp, propertyName, isPropAnnotationsCleared, isNavPropAnnotationsCleared, complexType);
} else {
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" +
propertyName.getName())) {
isAnnotationsIncluded = true;
addAnnotationsToEntityTypeProperties(annotationGrp, entityType, propertyName);
}
}
}
for (CsdlNavigationProperty navPropertyName : entityType.getNavigationProperties()) {
if (!isNavPropAnnotationsCleared) {
entityType.getNavigationProperty(navPropertyName.getName()).getAnnotations().clear();
}
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" +
navPropertyName.getName())) {
isAnnotationsIncluded = true;
addAnnotationsToEntityTypeNavProperties(annotationGrp, entityType, navPropertyName);
}
}
}
/** Adds annotations to Entity type Navigation Properties derived from entity set
* @param annotationGrp
* @param entityType
* @param navPropertyName
*/
private void addAnnotationsToEntityTypeNavProperties(CsdlAnnotations annotationGrp, CsdlEntityType entityType,
CsdlNavigationProperty navPropertyName) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(entityType.getNavigationProperty(
navPropertyName.getName()).getAnnotations(), annotation)) {
entityType.getNavigationProperty(navPropertyName.getName()).getAnnotations().add(annotation);
}
}
}
/** Adds annotations to Entity type Properties derived from entity set
* @param annotationGrp
* @param entityType
* @param propertyName
*/
private void addAnnotationsToEntityTypeProperties(CsdlAnnotations annotationGrp, CsdlEntityType entityType,
CsdlProperty propertyName) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(entityType.getProperty(
propertyName.getName()).getAnnotations(), annotation)) {
entityType.getProperty(propertyName.getName()).getAnnotations().add(annotation);
}
}
}
/**
* @param propertyName
* @return
*/
private CsdlComplexType getComplexTypeFromProperty(CsdlProperty propertyName) {
CsdlComplexType complexType;
try {
complexType = this.provider.getComplexType(propertyName.getTypeAsFQNObject());
} catch (ODataException e) {
throw new EdmException(e);
}
return complexType;
}
/**
* @param entitySet
* @param entityContainerName
* @param annotationGrp
* @param propertyName
* @param complexType
* @param isComplexNavPropAnnotationsCleared2
* @param isComplexPropAnnotationsCleared2
* @return
*/
private void addAnnotationsToComplexTypeIncludedFromES(CsdlEntitySet entitySet,
FullQualifiedName entityContainerName, CsdlAnnotations annotationGrp,
CsdlProperty propertyName, boolean isComplexPropAnnotationsCleared,
boolean isComplexNavPropAnnotationsCleared, CsdlComplexType complexType) {
for (CsdlProperty complexPropertyName : complexType.getProperties()) {
if (!isComplexPropAnnotationsCleared) {
complexType.getProperty(complexPropertyName.getName()).getAnnotations().clear();
}
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" +
propertyName.getName() + "/" + complexPropertyName.getName())) {
isAnnotationsIncluded = true;
addAnnotationsToComplexTypeProperties(annotationGrp, complexType, complexPropertyName);
}
}
for (CsdlNavigationProperty complexNavPropertyName : complexType.getNavigationProperties()) {
if (!isComplexNavPropAnnotationsCleared) {
complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().clear();
}
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" +
propertyName.getName() + "/" + complexNavPropertyName.getName())) {
isAnnotationsIncluded = true;
addAnnotationsToComplexTypeNavProperties(annotationGrp, complexType, complexNavPropertyName);
}
}
}
/**
* @param annotationGrp
* @param complexType
* @param complexNavPropertyName
*/
private void addAnnotationsToComplexTypeNavProperties(CsdlAnnotations annotationGrp, CsdlComplexType complexType,
CsdlNavigationProperty complexNavPropertyName) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(complexType.getNavigationProperty(
complexNavPropertyName.getName()).getAnnotations(), annotation)) {
complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().add(annotation);
}
}
}
/**
* @param annotationGrp
* @param complexType
* @param complexPropertyName
*/
private void addAnnotationsToComplexTypeProperties(CsdlAnnotations annotationGrp, CsdlComplexType complexType,
CsdlProperty complexPropertyName) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(complexType.getProperty(
complexPropertyName.getName()).getAnnotations(), annotation)) {
complexType.getProperty(complexPropertyName.getName()).getAnnotations().add(annotation);
}
}
}
private boolean isPropertyComplex(CsdlProperty propertyName) {
try {
return this.provider.getComplexType(propertyName.getTypeAsFQNObject()) != null ? true : false;
} catch (ODataException e) {
throw new EdmException(e);
}
}
protected EdmActionImport createActionImport(final String actionImportName) {
EdmActionImport actionImport = null;
try {
final CsdlActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName);
if (providerImport != null) {
addAnnotations(providerImport, entityContainerName);
actionImport = new EdmActionImportImpl(edm, this, providerImport);
}
} catch (ODataException e) {
@ -219,12 +572,31 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
return actionImport;
}
private void addAnnotations(CsdlActionImport actionImport, FullQualifiedName entityContainerName) {
List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + actionImport.getName())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(actionImport.getAnnotations(), annotation)) {
actionImport.getAnnotations().add(annotation);
}
}
break;
}
}
}
}
protected EdmFunctionImport createFunctionImport(final String functionImportName) {
EdmFunctionImport functionImport = null;
try {
final CsdlFunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName);
if (providerImport != null) {
addAnnotations(providerImport, entityContainerName);
functionImport = new EdmFunctionImportImpl(edm, this, providerImport);
}
} catch (ODataException e) {
@ -234,6 +606,24 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
return functionImport;
}
private void addAnnotations(CsdlFunctionImport functionImport, FullQualifiedName entityContainerName) {
List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().
equalsIgnoreCase(entityContainerName + "/" + functionImport.getName())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(functionImport.getAnnotations(), annotation)) {
functionImport.getAnnotations().add(annotation);
}
}
break;
}
}
}
}
protected void loadAllEntitySets() {
loadContainer();
final List<CsdlEntitySet> providerEntitySets = container.getEntitySets();
@ -241,11 +631,17 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
if (providerEntitySets != null) {
for (CsdlEntitySet entitySet : providerEntitySets) {
addAnnotations(entitySet, entityContainerName);
final EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
entitySetCache.put(impl.getName(), impl);
if (isAnnotationsIncluded) {
entitySetWithAnnotationsCache.put(impl.getName(), impl);
} else {
entitySetCache.put(impl.getName(), impl);
}
entitySetsLocal.add(impl);
}
entitySets = entitySetsLocal;
((EdmProviderImpl)edm).setIsPreviousES(true);
}
}
@ -256,6 +652,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
if (providerFunctionImports != null) {
for (CsdlFunctionImport functionImport : providerFunctionImports) {
addAnnotations(functionImport, entityContainerName);
EdmFunctionImportImpl impl = new EdmFunctionImportImpl(edm, this, functionImport);
functionImportCache.put(impl.getName(), impl);
functionImportsLocal.add(impl);
@ -271,6 +668,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
if (providerSingletons != null) {
for (CsdlSingleton singleton : providerSingletons) {
addAnnotations(singleton, entityContainerName);
final EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
singletonCache.put(singleton.getName(), impl);
singletonsLocal.add(impl);
@ -286,7 +684,8 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
if (providerActionImports != null) {
for (CsdlActionImport actionImport : providerActionImports) {
final EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
addAnnotations(actionImport, entityContainerName);
final EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
actionImportCache.put(actionImport.getName(), impl);
actionImportsLocal.add(impl);
}
@ -302,11 +701,20 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
if (containerLocal == null) {
containerLocal = new CsdlEntityContainer().setName(getName());
}
((EdmProviderImpl)edm).addAnnotations(containerLocal, entityContainerName);
container = containerLocal;
} catch (ODataException e) {
throw new EdmException(e);
}
}
}
private boolean compareAnnotations(List<CsdlAnnotation> annotations, CsdlAnnotation annotation) {
for (CsdlAnnotation annot : annotations) {
if (annot.equals(annotation)) {
return true;
}
}
return false;
}
}

View File

@ -54,6 +54,21 @@ public class EdmPropertyImpl extends AbstractEdmNamed implements EdmProperty {
return propertyType;
}
@Override
public EdmType getTypeWithAnnotations() {
if (propertyType == null) {
if (typeInfo == null) {
buildTypeInfoWithAnnotations();
}
propertyType = typeInfo.getType();
if (propertyType == null) {
throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
}
}
return propertyType;
}
private void buildTypeInfo() {
if (property.getType() == null) {
throw new EdmException("Property " + property.getName() + " must hava a full qualified type.");
@ -61,6 +76,14 @@ public class EdmPropertyImpl extends AbstractEdmNamed implements EdmProperty {
typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType()).build();
}
private void buildTypeInfoWithAnnotations() {
if (property.getType() == null) {
throw new EdmException("Property " + property.getName() + " must hava a full qualified type.");
}
typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setIncludeAnnotations(true)
.setTypeExpression(property.getType()).build();
}
@Override
public boolean isCollection() {
return property.isCollection();

View File

@ -39,16 +39,20 @@ import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.CsdlAction;
import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
import org.apache.olingo.commons.api.edm.provider.CsdlParameter;
import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
import org.apache.olingo.commons.api.edm.provider.CsdlStructuralType;
import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition;
import org.apache.olingo.commons.api.ex.ODataException;
@ -60,7 +64,7 @@ public class EdmProviderImpl extends AbstractEdm {
Collections.synchronizedMap(new HashMap<FullQualifiedName, List<CsdlAction>>());
private final Map<FullQualifiedName, List<CsdlFunction>> functionsMap =
Collections.synchronizedMap(new HashMap<FullQualifiedName, List<CsdlFunction>>());
private List<CsdlSchema> termSchemaDefinition = null;
private List<CsdlSchema> termSchemaDefinition = new ArrayList<CsdlSchema>();
public EdmProviderImpl(final CsdlEdmProvider provider) {
this.provider = provider;
@ -76,7 +80,9 @@ public class EdmProviderImpl extends AbstractEdm {
try {
CsdlEntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
if (entityContainerInfo != null) {
return new EdmEntityContainerImpl(this, provider, entityContainerInfo);
addAnnotations(provider.getEntityContainer(), entityContainerInfo.getContainerName());
return new EdmEntityContainerImpl(this, provider, entityContainerInfo.getContainerName(),
provider.getEntityContainer());
}
return null;
} catch (ODataException e) {
@ -84,11 +90,28 @@ public class EdmProviderImpl extends AbstractEdm {
}
}
public void addAnnotations(CsdlEntityContainer csdlEntityContainer, FullQualifiedName containerName) {
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().equalsIgnoreCase(containerName.getFullQualifiedNameAsString())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(csdlEntityContainer.getAnnotations(), annotation)) {
csdlEntityContainer.getAnnotations().addAll(annotationGrp.getAnnotations());
}
}
break;
}
}
}
}
@Override
public EdmEnumType createEnumType(final FullQualifiedName enumName) {
try {
CsdlEnumType enumType = provider.getEnumType(enumName);
if (enumType != null) {
addAnnotations(enumType, enumName);
return new EdmEnumTypeImpl(this, enumName, enumType);
}
return null;
@ -97,11 +120,28 @@ public class EdmProviderImpl extends AbstractEdm {
}
}
public void addAnnotations(CsdlEnumType enumType, FullQualifiedName enumName) {
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().equalsIgnoreCase(enumName.getFullQualifiedNameAsString())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(enumType.getAnnotations(), annotation)) {
enumType.getAnnotations().addAll(annotationGrp.getAnnotations());
}
}
break;
}
}
}
}
@Override
public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
try {
CsdlTypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
if (typeDefinition != null) {
addAnnotations(typeDefinition, typeDefinitionName);
return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
}
return null;
@ -109,12 +149,31 @@ public class EdmProviderImpl extends AbstractEdm {
throw new EdmException(e);
}
}
public void addAnnotations(CsdlTypeDefinition typeDefinition, FullQualifiedName typeDefinitionName) {
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().equalsIgnoreCase(typeDefinitionName.getFullQualifiedNameAsString())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(typeDefinition.getAnnotations(), annotation)) {
typeDefinition.getAnnotations().addAll(annotationGrp.getAnnotations());
}
}
break;
}
}
}
}
@Override
public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
try {
CsdlEntityType entityType = provider.getEntityType(entityTypeName);
if (entityType != null) {
if (!isEntityDerivedFromES()) {
addAnnotations(entityType, entityTypeName);
}
return new EdmEntityTypeImpl(this, entityTypeName, entityType);
}
return null;
@ -123,11 +182,121 @@ public class EdmProviderImpl extends AbstractEdm {
}
}
/**
* Add the annotations defined in an external file to the property/
* navigation property and the entity
* @param structuralType
* @param typeName
*/
public void addAnnotations(CsdlStructuralType structuralType, FullQualifiedName typeName) {
boolean isPropAnnotationsCleared = false;
boolean isNavPropAnnotationsCleared = false;
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().equalsIgnoreCase(typeName.getFullQualifiedNameAsString())) {
addAnnotationsToStructuralTypes(structuralType, annotationGrp);
} else {
checkAnnotationsOnStructuralProperties(structuralType, typeName, isPropAnnotationsCleared, annotationGrp);
checkAnnotationsOnStructuralNavProperties(structuralType, typeName, isNavPropAnnotationsCleared,
annotationGrp);
isPropAnnotationsCleared = true;
isNavPropAnnotationsCleared = true;
}
}
}
}
/** Check if annotations are added on navigation properties of a structural type
* @param structuralType
* @param typeName
* @param isNavPropAnnotationsCleared
* @param annotationGrp
*/
private void checkAnnotationsOnStructuralNavProperties(CsdlStructuralType structuralType, FullQualifiedName typeName,
boolean isNavPropAnnotationsCleared, CsdlAnnotations annotationGrp) {
List<CsdlNavigationProperty> navProperties = structuralType.getNavigationProperties();
for (CsdlNavigationProperty navProperty : navProperties) {
if (!isNavPropAnnotationsCleared) {
structuralType.getNavigationProperty(navProperty.getName()).getAnnotations().clear();
}
if (annotationGrp.getTarget().equalsIgnoreCase(typeName + "/" + navProperty.getName())) {
addAnnotationsToStructuralTypeNavProperties(structuralType, annotationGrp, navProperty);
}
}
}
/** Check if annotations are added on properties of a structural type
* @param structuralType
* @param typeName
* @param isPropAnnotationsCleared
* @param annotationGrp
*/
private void checkAnnotationsOnStructuralProperties(CsdlStructuralType structuralType, FullQualifiedName typeName,
boolean isPropAnnotationsCleared, CsdlAnnotations annotationGrp) {
List<CsdlProperty> properties = structuralType.getProperties();
for (CsdlProperty property : properties) {
if (!isPropAnnotationsCleared) {
structuralType.getProperty(property.getName()).getAnnotations().clear();
}
if (annotationGrp.getTarget().equalsIgnoreCase(
typeName.getFullQualifiedNameAsString() + "/" + property.getName())) {
addAnnotationsToStructuralTypeProperties(structuralType, annotationGrp, property);
}
}
}
/**
* @param structuralType
* @param annotationGrp
* @param navProperty
*/
private void addAnnotationsToStructuralTypeNavProperties(CsdlStructuralType structuralType,
CsdlAnnotations annotationGrp, CsdlNavigationProperty navProperty) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(structuralType.getNavigationProperty(
navProperty.getName()).getAnnotations(), annotation)) {
structuralType.getNavigationProperty(navProperty.getName()).getAnnotations().
add(annotation);
}
}
}
/**
* @param structuralType
* @param annotationGrp
* @param property
*/
private void addAnnotationsToStructuralTypeProperties(CsdlStructuralType structuralType,
CsdlAnnotations annotationGrp, CsdlProperty property) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(structuralType.getProperty(
property.getName()).getAnnotations(), annotation)) {
structuralType.getProperty(property.getName()).getAnnotations().add(annotation);
}
}
}
/**
* @param structuralType
* @param annotationGrp
*/
private void addAnnotationsToStructuralTypes(CsdlStructuralType structuralType, CsdlAnnotations annotationGrp) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(structuralType.getAnnotations(), annotation)) {
structuralType.getAnnotations().addAll(annotationGrp.getAnnotations());
}
}
}
@Override
public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
try {
final CsdlComplexType complexType = provider.getComplexType(complexTypeName);
if (complexType != null) {
if (!isComplexDerivedFromES()) {
addAnnotations(complexType, complexTypeName);
}
return new EdmComplexTypeImpl(this, complexTypeName, complexType);
}
return null;
@ -160,7 +329,7 @@ public class EdmProviderImpl extends AbstractEdm {
isComplexPreviousTypeCompatibleToBindingParam(bindingParameterTypeName, parameter,
isBindingParameterCollection))
&& isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
addAnnotations(action, actionName);
return new EdmActionImpl(this, actionName, action);
}
@ -172,6 +341,52 @@ public class EdmProviderImpl extends AbstractEdm {
}
}
public void addAnnotations(CsdlAction action, FullQualifiedName actionName) {
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().equalsIgnoreCase(
actionName.getFullQualifiedNameAsString())) {
addAnnotationsToActions(action, annotationGrp);
} else {
addAnnotationsToParamsOfActions(action, actionName, annotationGrp);
}
}
}
}
/** Adds annotations to actions
* @param action
* @param actionName
* @param annotationGrp
*/
private void addAnnotationsToParamsOfActions(CsdlAction action, FullQualifiedName actionName,
CsdlAnnotations annotationGrp) {
final List<CsdlParameter> parameters = action.getParameters();
for (CsdlParameter parameter : parameters) {
if (annotationGrp.getTarget().equalsIgnoreCase(
actionName.getFullQualifiedNameAsString() + "/" + parameter.getName())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(action.getParameter(parameter.getName()).getAnnotations(), annotation)) {
action.getParameter(parameter.getName()).getAnnotations().add(annotation);
}
}
}
}
}
/** Adds annotations to parameters of action
* @param action
* @param annotationGrp
*/
private void addAnnotationsToActions(CsdlAction action, CsdlAnnotations annotationGrp) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(action.getAnnotations(), annotation)) {
action.getAnnotations().add(annotation);
}
}
}
/**
* @param bindingParameterTypeName
* @param parameter
@ -249,6 +464,7 @@ public class EdmProviderImpl extends AbstractEdm {
providerParameterNames.add(providerParameters.get(i).getName());
}
if (parameterNamesCopy.containsAll(providerParameterNames)) {
addAnnotations(function, functionName);
return new EdmFunctionImpl(this, functionName, function);
}
}
@ -260,6 +476,52 @@ public class EdmProviderImpl extends AbstractEdm {
}
}
public void addAnnotations(CsdlFunction function, FullQualifiedName functionName) {
for (CsdlSchema schema : termSchemaDefinition) {
List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
for (CsdlAnnotations annotationGrp : annotationGrps) {
if (annotationGrp.getTarget().equalsIgnoreCase(
functionName.getFullQualifiedNameAsString())) {
addAnnotationsToFunctions(function, annotationGrp);
} else {
addAnnotationsToParamsOFunctions(function, functionName, annotationGrp);
}
}
}
}
/** Adds annotations of function parameters
* @param function
* @param functionName
* @param annotationGrp
*/
private void addAnnotationsToParamsOFunctions(CsdlFunction function, FullQualifiedName functionName,
CsdlAnnotations annotationGrp) {
final List<CsdlParameter> parameters = function.getParameters();
for (CsdlParameter parameter : parameters) {
if (annotationGrp.getTarget().equalsIgnoreCase(
functionName.getFullQualifiedNameAsString() + "/" + parameter.getName())) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(function.getParameter(parameter.getName()).getAnnotations(), annotation)) {
function.getParameter(parameter.getName()).getAnnotations().add(annotation);
}
}
}
}
}
/**Add annotations to functions
* @param function
* @param annotationGrp
*/
private void addAnnotationsToFunctions(CsdlFunction function, CsdlAnnotations annotationGrp) {
for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
if (!compareAnnotations(function.getAnnotations(), annotation)) {
function.getAnnotations().add(annotation);
}
}
}
@Override
protected Map<String, String> createAliasToNamespaceInfo() {
final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
@ -374,6 +636,10 @@ public class EdmProviderImpl extends AbstractEdm {
for (CsdlSchema schema : localSchemas) {
providerSchemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
}
}
for (CsdlSchema termSchemaDefn : termSchemaDefinition) {
providerSchemas.put(termSchemaDefn.getNamespace(),
new EdmSchemaImpl(this, provider, termSchemaDefn));
}
return providerSchemas;
} catch (ODataException e) {
@ -387,9 +653,11 @@ public class EdmProviderImpl extends AbstractEdm {
CsdlTerm providerTerm = provider.getTerm(termName);
if (providerTerm != null) {
return new EdmTermImpl(this, termName.getNamespace(), providerTerm);
} else if (termSchemaDefinition != null && !termSchemaDefinition.isEmpty()) {
} else {
for (CsdlSchema schema : termSchemaDefinition) {
if (schema.getNamespace().equalsIgnoreCase(termName.getNamespace())) {
if (schema.getNamespace().equalsIgnoreCase(termName.getNamespace()) ||
(null != schema.getAlias() &&
schema.getAlias().equalsIgnoreCase(termName.getNamespace()))) {
List<CsdlTerm> terms = schema.getTerms();
for (CsdlTerm term : terms) {
if (term.getName().equals(termName.getName())) {
@ -417,4 +685,17 @@ public class EdmProviderImpl extends AbstractEdm {
throw new EdmException(e);
}
}
public List<CsdlSchema> getTermSchemaDefinitions() {
return termSchemaDefinition;
}
private boolean compareAnnotations(List<CsdlAnnotation> annotations, CsdlAnnotation annotation) {
for (CsdlAnnotation annot : annotations) {
if (annot.equals(annotation)) {
return true;
}
}
return false;
}
}

View File

@ -41,6 +41,7 @@ public class EdmTypeInfo {
private String typeExpression;
private Edm edm;
private boolean includeAnnotations;
public Builder setTypeExpression(final String typeExpression) {
this.typeExpression = typeExpression;
@ -52,8 +53,13 @@ public class EdmTypeInfo {
return this;
}
public Builder setIncludeAnnotations(final boolean includeAnnotations) {
this.includeAnnotations = includeAnnotations;
return this;
}
public EdmTypeInfo build() {
return new EdmTypeInfo(edm, typeExpression);
return new EdmTypeInfo(edm, typeExpression, includeAnnotations);
}
}
@ -65,7 +71,7 @@ public class EdmTypeInfo {
private EdmComplexType complexType;
private EdmEntityType entityType;
private EdmTypeInfo(final Edm edm, final String typeExpression) {
private EdmTypeInfo(final Edm edm, final String typeExpression, final boolean includeAnnotations) {
String baseType;
final int collStartIdx = typeExpression.indexOf("Collection(");
final int collEndIdx = typeExpression.lastIndexOf(')');
@ -113,7 +119,12 @@ public class EdmTypeInfo {
if (typeDefinition == null) {
enumType = edm.getEnumType(fullQualifiedName);
if (enumType == null) {
complexType = edm.getComplexType(fullQualifiedName);
if (includeAnnotations) {
complexType = ((AbstractEdm)edm).
getComplexTypeWithAnnotations(fullQualifiedName, true);
} else {
complexType = edm.getComplexType(fullQualifiedName);
}
if (complexType == null) {
entityType = edm.getEntityType(fullQualifiedName);
}

View File

@ -319,4 +319,45 @@ public class EdmImplCallCreateTest {
return null;
}
}
@Test
public void callCreateComplexTypeWithAnnotations() {
EdmComplexType complexType = edm.getComplexTypeWithAnnotations(FQN);
assertNotNull(complexType);
assertEquals(FQN.getNamespace(), complexType.getNamespace());
assertEquals(FQN.getName(), complexType.getName());
assertNull(edm.getComplexType(WRONG_FQN));
}
@Test
public void callCreateComplexTypeWithAnnotationsDerivedFromES() {
EdmComplexType complexType = ((AbstractEdm)edm).
getComplexTypeWithAnnotations(FQN, true);
assertNotNull(complexType);
assertEquals(FQN.getNamespace(), complexType.getNamespace());
assertEquals(FQN.getName(), complexType.getName());
assertNull(edm.getComplexType(WRONG_FQN));
}
@Test
public void callCreateEntityTypeWithAnnotation() {
EdmEntityType entityType = edm.getEntityTypeWithAnnotations(FQN);
assertNotNull(entityType);
assertEquals(FQN.getNamespace(), entityType.getNamespace());
assertEquals(FQN.getName(), entityType.getName());
assertNull(edm.getEntityType(WRONG_FQN));
}
@Test
public void callCreateEntityTypeWithAnnotationDerivedFromES() {
EdmEntityType entityType = ((AbstractEdm)edm).
getEntityTypeWithAnnotations(FQN, true);
assertNotNull(entityType);
assertEquals(FQN.getNamespace(), entityType.getNamespace());
assertEquals(FQN.getName(), entityType.getName());
assertNull(edm.getEntityType(WRONG_FQN));
}
}

View File

@ -246,7 +246,7 @@ public class EdmSchemaImplTest {
@Override
public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
throw new RuntimeException("Provider must not be called in the schema case");
return null;
}
@Override

View File

@ -115,4 +115,9 @@ public class DynamicProperty implements EdmProperty {
public List<EdmAnnotation> getAnnotations() {
return Collections.emptyList();
}
@Override
public EdmType getTypeWithAnnotations() {
return propertyType;
}
}