You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/05/04 18:24:07 UTC
[4/9] [OLINGO-263][OLINGO-264] First draft Edm annotation interfaces
+ client-side implementation (server components have TODO)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
index 455ffb8..8c6273d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.header.ODataHeaders;
import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
-import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory;
import org.apache.olingo.commons.api.op.ODataSerializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
index 3962786..3a43644 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.header.ODataHeaders;
import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
-import org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory;
+import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory;
import org.apache.olingo.client.api.communication.request.v4.AsyncRequestFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
index ca226a3..116e98c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
@@ -56,11 +56,11 @@ public class URIEscapeTest {
@Test
public void geospatial() throws UnsupportedEncodingException {
- final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, 0);
+ final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(142.1);
point.setY(64.1);
- assertEquals(URLEncoder.encode("geography'SRID=0;Point(142.1 64.1)'", Constants.UTF8),
+ assertEquals(URLEncoder.encode("geography'SRID=4326;Point(142.1 64.1)'", Constants.UTF8),
URIUtils.escape(ODataServiceVersion.V40, point));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index 303d18a..51a2356 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -51,6 +51,7 @@ import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.junit.Test;
@@ -81,7 +82,7 @@ public class MetadataTest extends AbstractTest {
assertNotNull(product);
assertFalse(product.getPropertyNames().isEmpty());
assertFalse(product.getNavigationPropertyNames().isEmpty());
-
+
final EdmNavigationProperty detail = product.getNavigationProperty("Detail");
assertNotNull(detail);
assertEquals("Product", detail.getPartner().getName());
@@ -122,6 +123,21 @@ public class MetadataTest extends AbstractTest {
assertEquals(container.getEntitySet("Customer").getEntityContainer().getFullQualifiedName(),
logins.getRelatedBindingTarget("Customer").getEntityContainer().getFullQualifiedName());
assertEquals(container.getEntitySet("Customer").getName(), logins.getRelatedBindingTarget("Customer").getName());
+
+ // 5. Operation
+ final EdmFunctionImport funcImp = container.getFunctionImport("InStreamErrorGetCustomer");
+ assertNotNull(funcImp);
+ final EdmEntitySet returnedEntitySet = funcImp.getReturnedEntitySet();
+ assertNotNull(returnedEntitySet);
+ assertEquals("Customer", returnedEntitySet.getName());
+
+ final EdmFunction function = funcImp.getUnboundFunction(null);
+ assertNotNull(function);
+ final EdmReturnType returnType = function.getReturnType();
+ assertNotNull(returnType);
+ assertEquals("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer",
+ returnType.getType().getFullQualifiedName().toString());
+ assertTrue(returnType.isCollection());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index 56de140..267083a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -18,13 +18,6 @@
*/
package org.apache.olingo.client.core.v4;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.edm.xml.v4.Annotation;
import org.apache.olingo.client.api.edm.xml.v4.Annotations;
import org.apache.olingo.client.api.edm.xml.v4.ComplexType;
@@ -35,13 +28,21 @@ import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
import org.apache.olingo.client.api.edm.xml.v4.Schema;
import org.apache.olingo.client.api.edm.xml.v4.Singleton;
import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
+import org.apache.olingo.client.api.edm.xml.v4.annotation.Apply;
+import org.apache.olingo.client.api.edm.xml.v4.annotation.Collection;
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ConstantAnnotationExpression;
+import org.apache.olingo.client.api.edm.xml.v4.annotation.TwoParamsOpDynamicAnnotationExpression;
+import org.apache.olingo.client.api.edm.xml.v4.annotation.UrlRef;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.edm.xml.v4.annotation.Apply;
-import org.apache.olingo.client.core.edm.xml.v4.annotation.Collection;
-import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstExprConstructImpl;
-import org.apache.olingo.client.core.edm.xml.v4.annotation.Path;
+import org.apache.olingo.client.core.edm.xml.v4.annotation.ConstantAnnotationExpressionImpl;
+import org.apache.olingo.client.core.edm.xml.v4.annotation.PathImpl;
+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.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
@@ -51,9 +52,19 @@ import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
public class MetadataTest extends AbstractTest {
@@ -65,8 +76,7 @@ public class MetadataTest extends AbstractTest {
@Test
public void parse() {
- final Edm edm = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("metadata.xml"));
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("metadata.xml"));
assertNotNull(edm);
// 1. Enum
@@ -127,14 +137,39 @@ public class MetadataTest extends AbstractTest {
toMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
assertNotNull(metadata);
- assertFalse(metadata.getSchema(0).getAnnotationsList().isEmpty());
- final Annotations annots = metadata.getSchema(0).getAnnotationsList("ODataDemo.DemoService/Suppliers");
+ assertFalse(metadata.getSchema(0).getAnnotationGroups().isEmpty());
+ final Annotations annots = metadata.getSchema(0).getAnnotationGroup("ODataDemo.DemoService/Suppliers");
assertNotNull(annots);
assertFalse(annots.getAnnotations().isEmpty());
- assertEquals(ConstExprConstructImpl.Type.String,
- annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getConstExpr().getType());
+ assertEquals(ConstantAnnotationExpression.Type.String,
+ annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getType());
assertEquals("http://www.odata.org/",
- annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getConstExpr().getValue());
+ annots.getAnnotation("Org.OData.Publication.V1.PrivacyPolicyUrl").getExpression().asConstant().getValue());
+
+ // Now let's test some edm:Annotations
+ final Edm edm = getClient().getReader().
+ readMetadata(getClass().getResourceAsStream("demo-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmSchema schema = edm.getSchema("ODataDemo");
+ assertNotNull(schema);
+ assertTrue(schema.getAnnotations().isEmpty());
+ assertFalse(schema.getAnnotationGroups().isEmpty());
+
+ final EdmAnnotations annotationGroup = schema.getAnnotationGroups().get(2);
+ assertNotNull(annotationGroup);
+ final EdmAnnotationsTarget annotationsTarget = annotationGroup.getTarget();
+ assertNotNull(annotationsTarget);
+ assertTrue(EdmAnnotationsTarget.TargetType.Property == annotationsTarget.getAnnotationsTargetType());
+ assertEquals(new FullQualifiedName("ODataDemo.Product"), annotationsTarget.getAnnotationsTargetFQN());
+ assertEquals("Name", annotationsTarget.getAnnotationsTargetPath());
+
+ final EdmAnnotation annotation = annotationGroup.getAnnotations().get(0);
+ assertNotNull(annotation);
+ assertTrue(annotation.getExpression().isConstant());
+ assertEquals("Edm.String", annotation.getExpression().asConstant().getValue().getTypeName());
+
+ assertEquals(10, schema.getAnnotationGroups().get(3).getAnnotations().size());
}
@Test
@@ -169,7 +204,7 @@ public class MetadataTest extends AbstractTest {
final EntityType product = metadata.getSchema(0).getEntityType("Product");
assertTrue(product.isHasStream());
- assertEquals("UoM.ISOCurrency", product.getProperty("Price").getAnnotation().getTerm());
+ assertEquals("UoM.ISOCurrency", product.getProperty("Price").getAnnotations().get(0).getTerm());
assertEquals("Products", product.getNavigationProperty("Supplier").getPartner());
final EntityType category = metadata.getSchema(0).getEntityType("Category");
@@ -197,8 +232,7 @@ public class MetadataTest extends AbstractTest {
functionImport.getFunction());
// Now let's go high-level
- final Edm edm = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc1-metadata.xml"));
assertNotNull(edm);
final EdmFunctionImportInfo fiInfo = edm.getServiceMetadata().getFunctionImportInfos().get(0);
@@ -219,6 +253,12 @@ public class MetadataTest extends AbstractTest {
fi.getUnboundFunction(null).getReturnType().getType().getName());
assertEquals(function.getReturnType().getType().getNamespace(),
fi.getUnboundFunction(null).getReturnType().getType().getNamespace());
+
+ final EdmTypeDefinition weight = edm.getTypeDefinition(new FullQualifiedName("ODataDemo", "Weight"));
+ assertNotNull(weight);
+ assertEquals(EdmInt32.getInstance(), weight.getUnderlyingType());
+ assertFalse(weight.getAnnotations().isEmpty());
+ assertEquals("Kilograms", weight.getAnnotations().get(0).getExpression().asConstant().getValue().toString());
}
/**
@@ -231,42 +271,40 @@ public class MetadataTest extends AbstractTest {
assertNotNull(metadata);
// Check displayName
- final Annotation displayName = metadata.getSchema(0).getAnnotationsList("ODataDemo.Supplier").
+ final Annotation displayName = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Supplier").
getAnnotation("Vocabulary1.DisplayName");
assertNotNull(displayName);
- assertNull(displayName.getConstExpr());
- assertNotNull(displayName.getDynExpr());
+ assertTrue(displayName.getExpression().isDynamic());
- assertTrue(displayName.getDynExpr() instanceof Apply);
- final Apply apply = (Apply) displayName.getDynExpr();
- assertEquals(Apply.CANONICAL_FUNCTION_CONCAT, apply.getFunction());
+ assertTrue(displayName.getExpression().asDynamic().isApply());
+ final Apply apply = displayName.getExpression().asDynamic().asApply();
+ assertEquals(Constants.CANONICAL_FUNCTION_CONCAT, apply.getFunction());
assertEquals(3, apply.getParameters().size());
- final Path firstArg = new Path();
+ final PathImpl firstArg = new PathImpl();
firstArg.setValue("Name");
assertEquals(firstArg, apply.getParameters().get(0));
- final ConstExprConstructImpl secondArg = new ConstExprConstructImpl();
- secondArg.setType(ConstExprConstructImpl.Type.String);
+ final ConstantAnnotationExpression secondArg = new ConstantAnnotationExpressionImpl();
+ secondArg.setType(ConstantAnnotationExpression.Type.String);
secondArg.setValue(" in ");
assertEquals(secondArg, apply.getParameters().get(1));
- final Path thirdArg = new Path();
+ final PathImpl thirdArg = new PathImpl();
thirdArg.setValue("Address/CountryName");
assertEquals(thirdArg, apply.getParameters().get(2));
// Check Tags
- final Annotation tags = metadata.getSchema(0).getAnnotationsList("ODataDemo.Product").
+ final Annotation tags = metadata.getSchema(0).getAnnotationGroup("ODataDemo.Product").
getAnnotation("Vocabulary1.Tags");
assertNotNull(tags);
- assertNull(tags.getConstExpr());
- assertNotNull(tags.getDynExpr());
+ assertTrue(tags.getExpression().isDynamic());
- assertTrue(tags.getDynExpr() instanceof Collection);
- final Collection collection = (Collection) tags.getDynExpr();
+ assertTrue(tags.getExpression().asDynamic().isCollection());
+ final Collection collection = tags.getExpression().asDynamic().asCollection();
assertEquals(1, collection.getItems().size());
- assertEquals(ConstExprConstructImpl.Type.String, ((ConstExprConstructImpl) collection.getItems().get(0)).getType());
- assertEquals("MasterData", ((ConstExprConstructImpl) collection.getItems().get(0)).getValue());
+ assertEquals(ConstantAnnotationExpression.Type.String, collection.getItems().get(0).asConstant().getType());
+ assertEquals("MasterData", collection.getItems().get(0).asConstant().getValue());
}
/**
@@ -274,8 +312,74 @@ public class MetadataTest extends AbstractTest {
*/
@Test
public void fromdoc3() {
- final Edm metadata = getClient().getReader().
- readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmAnnotations group = edm.getSchema("Annotations").getAnnotationGroups().get(0);
+ assertNotNull(group);
+
+ final EdmAnnotation time1 = group.getAnnotations().get(0);
+ assertEquals("Edm.TimeOfDay", time1.getExpression().asConstant().getValue().getTypeName());
+
+ final EdmAnnotation time2 = group.getAnnotations().get(1);
+ assertEquals("Edm.TimeOfDay", time2.getExpression().asConstant().getValue().getTypeName());
+ }
+
+ /**
+ * Various annotation examples taken from CSDL specification.
+ */
+ @Test
+ public void fromdoc4() {
+ final XMLMetadata metadata = getClient().getDeserializer().
+ toMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
assertNotNull(metadata);
+
+ final Annotations group = metadata.getSchema(0).getAnnotationGroups().get(0);
+ assertNotNull(group);
+
+ Annotation annotation = group.getAnnotations().get(0);
+ assertTrue(annotation.getExpression().isDynamic());
+ assertTrue(annotation.getExpression().asDynamic().isCast());
+ assertEquals("Edm.Decimal", annotation.getExpression().asDynamic().asCast().getType());
+
+ annotation = group.getAnnotation("And");
+ assertTrue(annotation.getExpression().isDynamic());
+ assertTrue(annotation.getExpression().asDynamic().isTwoParamsOp());
+ assertEquals(TwoParamsOpDynamicAnnotationExpression.Type.And,
+ annotation.getExpression().asDynamic().asTwoParamsOp().getType());
+ assertTrue(annotation.getExpression().asDynamic().asTwoParamsOp().getLeftExpression().isPath());
+
+ annotation = group.getAnnotation("Vocab.Supplier");
+ assertNotNull(annotation);
+ assertTrue(annotation.getExpression().isDynamic());
+ assertTrue(annotation.getExpression().asDynamic().isUrlRef());
+ final UrlRef urlRef = annotation.getExpression().asDynamic().asUrlRef();
+ assertTrue(urlRef.getValue().isDynamic());
+ assertTrue(urlRef.getValue().asDynamic().isApply());
+
+ // Now let's go high-level
+ final Edm edm = getClient().getReader().readMetadata(getClass().getResourceAsStream("fromdoc4-metadata.xml"));
+ assertNotNull(edm);
+
+ final EdmAnnotations edmGroup = edm.getSchemas().get(0).getAnnotationGroups().get(0);
+ assertNotNull(edmGroup);
+
+ EdmAnnotation edmAnnotation = edmGroup.getAnnotations().get(0);
+ assertTrue(edmAnnotation.getExpression().isDynamic());
+ assertTrue(edmAnnotation.getExpression().asDynamic().isCast());
+ assertEquals(EdmDecimal.getInstance(), edmAnnotation.getExpression().asDynamic().asCast().getType());
+
+ edmAnnotation = edmGroup.getAnnotations().get(1);
+ assertTrue(edmAnnotation.getExpression().isDynamic());
+ assertTrue(edmAnnotation.getExpression().asDynamic().isAnd());
+ assertTrue(edmAnnotation.getExpression().asDynamic().asAnd().getLeftExpression().isPath());
+
+ edmAnnotation = edmGroup.getAnnotations().get(edmGroup.getAnnotations().size() - 2);
+ assertNotNull(edmAnnotation);
+ assertTrue(edmAnnotation.getExpression().isDynamic());
+ assertTrue(edmAnnotation.getExpression().asDynamic().isUrlRef());
+ final EdmUrlRef edmUrlRef = edmAnnotation.getExpression().asDynamic().asUrlRef();
+ assertTrue(edmUrlRef.getValue().isDynamic());
+ assertTrue(edmUrlRef.getValue().asDynamic().isApply());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml
index 9b21e2f..1f75859 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/demo-metadata.xml
@@ -24,139 +24,139 @@
<Schema Namespace="ODataDemo" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityType Name="Product">
<Key>
- <PropertyRef Name="ID" />
+ <PropertyRef Name="ID"/>
</Key>
- <Property Name="ID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Name" Type="Edm.String" />
- <Property Name="Description" Type="Edm.String" />
- <Property Name="ReleaseDate" Type="Edm.DateTimeOffset" Nullable="false" />
- <Property Name="DiscontinuedDate" Type="Edm.DateTimeOffset" />
- <Property Name="Rating" Type="Edm.Int16" Nullable="false" />
- <Property Name="Price" Type="Edm.Double" Nullable="false" />
- <NavigationProperty Name="Categories" Type="Collection(ODataDemo.Category)" Partner="Products" />
- <NavigationProperty Name="Supplier" Type="ODataDemo.Supplier" Partner="Products" />
- <NavigationProperty Name="ProductDetail" Type="ODataDemo.ProductDetail" Partner="Product" />
+ <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <Property Name="Description" Type="Edm.String"/>
+ <Property Name="ReleaseDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="DiscontinuedDate" Type="Edm.DateTimeOffset"/>
+ <Property Name="Rating" Type="Edm.Int16" Nullable="false"/>
+ <Property Name="Price" Type="Edm.Double" Nullable="false"/>
+ <NavigationProperty Name="Categories" Type="Collection(ODataDemo.Category)" Partner="Products"/>
+ <NavigationProperty Name="Supplier" Type="ODataDemo.Supplier" Partner="Products"/>
+ <NavigationProperty Name="ProductDetail" Type="ODataDemo.ProductDetail" Partner="Product"/>
</EntityType>
<EntityType Name="FeaturedProduct" BaseType="ODataDemo.Product">
- <NavigationProperty Name="Advertisement" Type="ODataDemo.Advertisement" Partner="FeaturedProduct" />
+ <NavigationProperty Name="Advertisement" Type="ODataDemo.Advertisement" Partner="FeaturedProduct"/>
</EntityType>
<EntityType Name="ProductDetail">
<Key>
- <PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductID"/>
</Key>
- <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Details" Type="Edm.String" />
- <NavigationProperty Name="Product" Type="ODataDemo.Product" Partner="ProductDetail" />
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Details" Type="Edm.String"/>
+ <NavigationProperty Name="Product" Type="ODataDemo.Product" Partner="ProductDetail"/>
</EntityType>
<EntityType Name="Category" OpenType="true">
<Key>
- <PropertyRef Name="ID" />
+ <PropertyRef Name="ID"/>
</Key>
- <Property Name="ID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Name" Type="Edm.String" />
- <NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Categories" />
+ <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Categories"/>
</EntityType>
<EntityType Name="Supplier">
<Key>
- <PropertyRef Name="ID" />
+ <PropertyRef Name="ID"/>
</Key>
- <Property Name="ID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Name" Type="Edm.String" />
- <Property Name="Address" Type="ODataDemo.Address" />
- <Property Name="Location" Type="Edm.GeographyPoint" SRID="Variable" />
- <Property Name="Concurrency" Type="Edm.Int32" ConcurrencyMode="Fixed" Nullable="false" />
- <NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Supplier" />
+ <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <Property Name="Address" Type="ODataDemo.Address"/>
+ <Property Name="Location" Type="Edm.GeographyPoint" SRID="Variable"/>
+ <Property Name="Concurrency" Type="Edm.Int32" ConcurrencyMode="Fixed" Nullable="false"/>
+ <NavigationProperty Name="Products" Type="Collection(ODataDemo.Product)" Partner="Supplier"/>
</EntityType>
<ComplexType Name="Address">
- <Property Name="Street" Type="Edm.String" />
- <Property Name="City" Type="Edm.String" />
- <Property Name="State" Type="Edm.String" />
- <Property Name="ZipCode" Type="Edm.String" />
- <Property Name="Country" Type="Edm.String" />
+ <Property Name="Street" Type="Edm.String"/>
+ <Property Name="City" Type="Edm.String"/>
+ <Property Name="State" Type="Edm.String"/>
+ <Property Name="ZipCode" Type="Edm.String"/>
+ <Property Name="Country" Type="Edm.String"/>
</ComplexType>
<EntityType Name="Person">
<Key>
- <PropertyRef Name="ID" />
+ <PropertyRef Name="ID"/>
</Key>
- <Property Name="ID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Name" Type="Edm.String" />
- <NavigationProperty Name="PersonDetail" Type="ODataDemo.PersonDetail" Partner="Person" />
+ <Property Name="ID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <NavigationProperty Name="PersonDetail" Type="ODataDemo.PersonDetail" Partner="Person"/>
</EntityType>
<EntityType Name="Customer" BaseType="ODataDemo.Person">
- <Property Name="TotalExpense" Type="Edm.Decimal" Nullable="false" />
+ <Property Name="TotalExpense" Type="Edm.Decimal" Nullable="false"/>
</EntityType>
<EntityType Name="Employee" BaseType="ODataDemo.Person">
- <Property Name="EmployeeID" Type="Edm.Int64" Nullable="false" />
- <Property Name="HireDate" Type="Edm.DateTimeOffset" Nullable="false" />
- <Property Name="Salary" Type="Edm.Single" Nullable="false" />
+ <Property Name="EmployeeID" Type="Edm.Int64" Nullable="false"/>
+ <Property Name="HireDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="Salary" Type="Edm.Single" Nullable="false"/>
</EntityType>
<EntityType Name="PersonDetail">
<Key>
- <PropertyRef Name="PersonID" />
+ <PropertyRef Name="PersonID"/>
</Key>
- <Property Name="PersonID" Type="Edm.Int32" Nullable="false" />
- <Property Name="Age" Type="Edm.Byte" Nullable="false" />
- <Property Name="Gender" Type="Edm.Boolean" Nullable="false" />
- <Property Name="Phone" Type="Edm.String" />
- <Property Name="Address" Type="ODataDemo.Address" />
- <Property Name="Photo" Type="Edm.Stream" Nullable="false" />
- <NavigationProperty Name="Person" Type="ODataDemo.Person" Partner="PersonDetail" />
+ <Property Name="PersonID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Age" Type="Edm.Byte" Nullable="false"/>
+ <Property Name="Gender" Type="Edm.Boolean" Nullable="false"/>
+ <Property Name="Phone" Type="Edm.String"/>
+ <Property Name="Address" Type="ODataDemo.Address"/>
+ <Property Name="Photo" Type="Edm.Stream" Nullable="false"/>
+ <NavigationProperty Name="Person" Type="ODataDemo.Person" Partner="PersonDetail"/>
</EntityType>
<EntityType Name="Advertisement" HasStream="true">
<Key>
- <PropertyRef Name="ID" />
+ <PropertyRef Name="ID"/>
</Key>
- <Property Name="ID" Type="Edm.Guid" Nullable="false" />
- <Property Name="Name" Type="Edm.String" />
- <Property Name="AirDate" Type="Edm.DateTimeOffset" Nullable="false" />
- <NavigationProperty Name="FeaturedProduct" Type="ODataDemo.FeaturedProduct" Partner="Advertisement" />
+ <Property Name="ID" Type="Edm.Guid" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <Property Name="AirDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <NavigationProperty Name="FeaturedProduct" Type="ODataDemo.FeaturedProduct" Partner="Advertisement"/>
</EntityType>
<EntityContainer Name="DemoService">
<EntitySet Name="Products" EntityType="ODataDemo.Product">
- <NavigationPropertyBinding Path="ODataDemo.FeaturedProduct/Advertisement" Target="Advertisements" />
- <NavigationPropertyBinding Path="Categories" Target="Categories" />
- <NavigationPropertyBinding Path="Supplier" Target="Suppliers" />
- <NavigationPropertyBinding Path="ProductDetail" Target="ProductDetails" />
+ <NavigationPropertyBinding Path="ODataDemo.FeaturedProduct/Advertisement" Target="Advertisements"/>
+ <NavigationPropertyBinding Path="Categories" Target="Categories"/>
+ <NavigationPropertyBinding Path="Supplier" Target="Suppliers"/>
+ <NavigationPropertyBinding Path="ProductDetail" Target="ProductDetails"/>
</EntitySet>
<EntitySet Name="ProductDetails" EntityType="ODataDemo.ProductDetail">
- <NavigationPropertyBinding Path="Product" Target="Products" />
+ <NavigationPropertyBinding Path="Product" Target="Products"/>
</EntitySet>
<EntitySet Name="Categories" EntityType="ODataDemo.Category">
- <NavigationPropertyBinding Path="Products" Target="Products" />
+ <NavigationPropertyBinding Path="Products" Target="Products"/>
</EntitySet>
<EntitySet Name="Suppliers" EntityType="ODataDemo.Supplier">
- <NavigationPropertyBinding Path="Products" Target="Products" />
+ <NavigationPropertyBinding Path="Products" Target="Products"/>
</EntitySet>
<EntitySet Name="Persons" EntityType="ODataDemo.Person">
- <NavigationPropertyBinding Path="PersonDetail" Target="PersonDetails" />
+ <NavigationPropertyBinding Path="PersonDetail" Target="PersonDetails"/>
</EntitySet>
<EntitySet Name="PersonDetails" EntityType="ODataDemo.PersonDetail">
- <NavigationPropertyBinding Path="Person" Target="Persons" />
+ <NavigationPropertyBinding Path="Person" Target="Persons"/>
</EntitySet>
<EntitySet Name="Advertisements" EntityType="ODataDemo.Advertisement">
- <NavigationPropertyBinding Path="FeaturedProduct" Target="Products" />
+ <NavigationPropertyBinding Path="FeaturedProduct" Target="Products"/>
</EntitySet>
</EntityContainer>
<Annotations Target="ODataDemo.DemoService">
- <Annotation Term="Org.OData.Display.V1.Description" String="This is a sample OData service with vocabularies" />
+ <Annotation Term="Org.OData.Display.V1.Description" String="This is a sample OData service with vocabularies"/>
</Annotations>
<Annotations Target="ODataDemo.Product">
- <Annotation Term="Org.OData.Display.V1.Description" String="All Products available in the online store" />
+ <Annotation Term="Org.OData.Display.V1.Description" String="All Products available in the online store"/>
</Annotations>
<Annotations Target="ODataDemo.Product/Name">
- <Annotation Term="Org.OData.Display.V1.DisplayName" String="Product Name" />
+ <Annotation Term="Org.OData.Display.V1.DisplayName" String="Product Name"/>
</Annotations>
<Annotations Target="ODataDemo.DemoService/Suppliers">
- <Annotation Term="Org.OData.Publication.V1.PublisherName" String="Microsoft Corp." />
- <Annotation Term="Org.OData.Publication.V1.PublisherId" String="MSFT" />
- <Annotation Term="Org.OData.Publication.V1.Keywords" String="Inventory, Supplier, Advertisers, Sales, Finance" />
- <Annotation Term="Org.OData.Publication.V1.AttributionUrl" String="http://www.odata.org/" />
- <Annotation Term="Org.OData.Publication.V1.AttributionDescription" String="All rights reserved" />
- <Annotation Term="Org.OData.Publication.V1.DocumentationUrl " String="http://www.odata.org/" />
- <Annotation Term="Org.OData.Publication.V1.TermsOfUseUrl" String="All rights reserved" />
- <Annotation Term="Org.OData.Publication.V1.PrivacyPolicyUrl" String="http://www.odata.org/" />
- <Annotation Term="Org.OData.Publication.V1.LastModified" String="4/2/2013" />
- <Annotation Term="Org.OData.Publication.V1.ImageUrl " String="http://www.odata.org/" />
+ <Annotation Term="Org.OData.Publication.V1.PublisherName" String="Microsoft Corp."/>
+ <Annotation Term="Org.OData.Publication.V1.PublisherId" String="MSFT"/>
+ <Annotation Term="Org.OData.Publication.V1.Keywords" String="Inventory, Supplier, Advertisers, Sales, Finance"/>
+ <Annotation Term="Org.OData.Publication.V1.AttributionUrl" String="http://www.odata.org/"/>
+ <Annotation Term="Org.OData.Publication.V1.AttributionDescription" String="All rights reserved"/>
+ <Annotation Term="Org.OData.Publication.V1.DocumentationUrl " String="http://www.odata.org/"/>
+ <Annotation Term="Org.OData.Publication.V1.TermsOfUseUrl" String="All rights reserved"/>
+ <Annotation Term="Org.OData.Publication.V1.PrivacyPolicyUrl" String="http://www.odata.org/"/>
+ <Annotation Term="Org.OData.Publication.V1.LastModified" String="4/2/2013"/>
+ <Annotation Term="Org.OData.Publication.V1.ImageUrl " String="http://www.odata.org/"/>
</Annotations>
</Schema>
</edmx:DataServices>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
index 5d872ca..74a71d4 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
@@ -43,7 +43,7 @@
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Type="Edm.Int32" Nullable="false"/>
- <Property Name="Description" Type="Edm.String" >
+ <Property Name="Description" Type="Edm.String">
<Annotation Term="Core.IsLanguageDependent"/>
</Property>
<Property Name="ReleaseDate" Type="Edm.Date"/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml
index 2a00bd8..36e5216 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc3-metadata.xml
@@ -29,70 +29,70 @@
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Annotations">
<Annotations Target="Test">
- <Annotation Term="org.example.display.EndTime" TimeOfDay="21:45:00"/>,
+ <Annotation Term="org.example.display.EndTime" TimeOfDay="21:45:00"/>
<Annotation Term="org.example.display.EndTime">
<TimeOfDay>21:45:00</TimeOfDay>
- </Annotation>,
- <Annotation Term='Test' Path="IsMale"/>,
+ </Annotation>
+ <Annotation Term='Test' Path="IsMale"/>
<Annotation Term='Test'>
<Not>
<Path>IsMale</Path>
</Not>
- </Annotation>,
+ </Annotation>
<Annotation Term='Test'>
<And>
<Path>IsMale</Path>
<Path>IsMarried</Path>
</And>
- </Annotation>,
- <Annotation Term="UI.ReferenceFacet" AnnotationPath="Product/Supplier/@UI.LineItem"/>,
+ </Annotation>
+ <Annotation Term="UI.ReferenceFacet" AnnotationPath="Product/Supplier/@UI.LineItem"/>
<Annotation Term="UI.ReferenceFacet">
<AnnotationPath>Product/Supplier/@UI.LineItem</AnnotationPath>
- </Annotation>,
+ </Annotation>
<Annotation Term="Vocabulary1.DisplayName">
<Apply Function="odata.concat">
<Path>Name</Path>
<String> in </String>
<Path>Address/CountryName</Path>
</Apply>
- </Annotation>,
+ </Annotation>
<Annotation Term="org.example.display.Threshold">
<Cast Type="Edm.Decimal">
<Path>Average</Path>
</Cast>
- </Annotation>,
+ </Annotation>
<Annotation Term="Vocabulary1.Tags">
<Collection>
<String>MasterData</String>
</Collection>
- </Annotation>,
+ </Annotation>
<Annotation Term="org.example.person.Gender">
<If>
<Bool>true</Bool>
<String>Female</String>
<String>Male</String>
</If>
- </Annotation>,
+ </Annotation>
<Annotation Term="org.example.person.Gender">
<If>
<Path>IsFemale</Path>
<String>Female</String>
<String>Male</String>
</If>
- </Annotation>,
+ </Annotation>
<Annotation Term="Self.IsPreferredCustomer">
<IsOf Type="Self.PreferredCustomer">
<Path>Customer</Path>
</IsOf>
- </Annotation>,
+ </Annotation>
<Annotation Term="org.example.display.DisplayName">
<LabeledElement Name="CustomerFirstName" Path="FirstName" />
- </Annotation>,
+ </Annotation>
<Annotation Term="org.example.display.DisplayName">
<LabeledElement Name="CustomerFirstName">
<Path>FirstName</Path>
</LabeledElement>
- </Annotation>,
+ </Annotation>
<Annotation Term="org.example.person.Employee">
<Record>
<PropertyValue Property="GivenName" Path="FirstName" />
@@ -107,7 +107,7 @@
</UrlRef>
</PropertyValue>
</Record>
- </Annotation>,
+ </Annotation>
<Annotation Term="Vocab.Supplier">
<UrlRef>
<Apply Function="odata.fillUriTemplate">
@@ -119,7 +119,7 @@
</LabeledElement>
</Apply>
</UrlRef>
- </Annotation>,
+ </Annotation>
<Annotation Term="Core.LongDescription">
<UrlRef>
<String>http://host/wiki/HowToUse</String>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc4-metadata.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc4-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc4-metadata.xml
new file mode 100644
index 0000000..6602960
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc4-metadata.xml
@@ -0,0 +1,164 @@
+<?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://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+ <edmx:DataServices>
+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Annotations">
+ <Annotations Target="Test">
+ <Annotation Term="org.example.display.Threshold">
+ <Cast Type="Edm.Decimal">
+ <Path>Average</Path>
+ </Cast>
+ </Annotation>
+ <Annotation Term="And">
+ <And>
+ <Path>IsMale</Path>
+ <Path>IsMarried</Path>
+ </And>
+ </Annotation>
+ <Annotation Term="Or">
+ <Or>
+ <Path>IsMale</Path>
+ <Path>IsMarried</Path>
+ </Or>
+ </Annotation>
+ <Annotation Term="Not">
+ <Not>
+ <Path>IsMale</Path>
+ </Not>
+ </Annotation>
+ <Annotation Term="Eq">
+ <Eq>
+ <Null/>
+ <Path>IsMale</Path>
+ </Eq>
+ </Annotation>
+ <Annotation Term="UI.ReferenceFacet" AnnotationPath="Product/Supplier/@UI.LineItem"/>
+ <Annotation Term="UI.CollectionFacet" Qualifier="Contacts">
+ <Collection>
+ <AnnotationPath>Supplier/@Communication.Contact</AnnotationPath>
+ <AnnotationPath>Customer/@Communication.Contact</AnnotationPath>
+ </Collection>
+ </Annotation>
+ <Annotation Term="org.example.display.DisplayName">
+ <Apply Function="odata.concat">
+ <String>Product: </String>
+ <Path>ProductName</Path>
+ <String> (</String>
+ <Path>Available/Quantity</Path>
+ <String> </String>
+ <Path>Available/Unit</Path>
+ <String> available)</String>
+ </Apply>
+ </Annotation>
+ <Annotation Term="Apply2">
+ <Apply Function="odata.fillUriTemplate">
+ <String>http://host/service/Genres('{genreName}')</String>
+ <LabeledElement Name="genreName" Path="NameOfMovieGenre"/>
+ </Apply>
+ </Annotation>
+ <Annotation Term="Apply3">
+ <Apply Function="odata.fillUriTemplate">
+ <String>http://host/service/Genres({genreName})</String>
+ <LabeledElement Name="genreName">
+ <Apply Function="odata.uriEncode" >
+ <Path>NameOfMovieGenre</Path>
+ </Apply>
+ </LabeledElement>
+ </Apply>
+ </Annotation>
+ <Annotation Term="org.example.seo.SeoTerms">
+ <Collection>
+ <String>Product</String>
+ <String>Supplier</String>
+ <String>Customer</String>
+ </Collection>
+ </Annotation>
+ <Annotation Term="org.example.person.Gender">
+ <If>
+ <Path>IsFemale</Path>
+ <String>Female</String>
+ <String>Male</String>
+ </If>
+ </Annotation>
+ <Annotation Term="Self.IsPreferredCustomer">
+ <IsOf Type="Self.PreferredCustomer">
+ <Path>Customer</Path>
+ </IsOf>
+ </Annotation>
+ <Annotation Term="org.example.display.DisplayName">
+ <LabeledElement Name="CustomerFirstName" Path="FirstName"/>
+ </Annotation>
+ <Annotation Term="org.example.display.DisplayName">
+ <LabeledElement Name="CustomerFirstName">
+ <Path>FirstName</Path>
+ </LabeledElement>
+ </Annotation>
+ <Annotation Term="org.example.display.DisplayName">
+ <LabeledElementReference>Model.CustomerFirstName</LabeledElementReference>
+ </Annotation>
+ <Annotation Term="UI.HyperLink" NavigationPropertyPath="Supplier"/>
+ <Annotation Term="Capabilities.UpdateRestrictions">
+ <Record>
+ <PropertyValue Property="NonUpdatableNavigationProperties">
+ <Collection>
+ <NavigationPropertyPath>Supplier</NavigationPropertyPath>
+ <NavigationPropertyPath>Category</NavigationPropertyPath>
+ </Collection>
+ </PropertyValue>
+ </Record>
+ </Annotation>
+ <Annotation Term="org.example.display.DisplayName" Path="FirstName"/>
+ <Annotation Term="org.example.display.DisplayName">
+ <Path>@vCard.Address#work/FullName</Path>
+ </Annotation>
+ <Annotation Term="UI.RefreshOnChangeOf" PropertyPath="ChangedAt"/>
+ <Annotation Term="Capabilities.UpdateRestrictions">
+ <Record>
+ <PropertyValue Property="NonUpdatableProperties">
+ <Collection>
+ <PropertyPath>CreatedAt</PropertyPath>
+ <PropertyPath>ChangedAt</PropertyPath>
+ </Collection>
+ </PropertyValue>
+ </Record>
+ </Annotation>
+ <Annotation Term="Vocab.Supplier">
+ <UrlRef>
+ <Apply Function="odata.fillUriTemplate">
+ <String>http://host/service/Suppliers({suppID})</String>
+ <LabeledElement Name="suppID">
+ <Apply Function="odata.uriEncode">
+ <Path>SupplierId</Path>
+ </Apply>
+ </LabeledElement>
+ </Apply>
+ </UrlRef>
+ </Annotation>
+ <Annotation Term="Core.LongDescription">
+ <UrlRef>
+ <String>http://host/wiki/HowToUse</String>
+ </UrlRef>
+ </Annotation>
+ </Annotations>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 770f81c..17a65eb 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -236,11 +236,18 @@ public interface Constants {
public static final String ATOM_ELEM_DELETED_ENTRY = "deleted-entry";
-// error stuff
+ // error stuff
public static final String ERROR_CODE = "code";
public static final String ERROR_MESSAGE = "message";
public static final String ERROR_TARGET = "target";
+ // canonical functions to be applied via dynamic annotation <tt>Apply</tt>
+ public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";
+
+ public static final String CANONICAL_FUNCTION_FILLURITEMPLATE = "odata.fillUriTemplate";
+
+ public static final String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
index fa417f1..ad6dfb4 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/Edm.java
@@ -35,6 +35,14 @@ public interface Edm {
List<EdmSchema> getSchemas();
/**
+ * Get schema by namespace.
+ *
+ * @param namespace must not be null
+ * @return {@link EdmSchema}
+ */
+ EdmSchema getSchema(String namespace);
+
+ /**
* Get entity container by full qualified name.
* <br/>
* See {@link EdmEntityContainer} for more information.
@@ -133,6 +141,39 @@ public interface Edm {
Boolean isBindingParameterCollection, List<String> parameterNames);
/**
+ * Get Term full by qualified name.
+ *
+ * @param termName must not be null
+ * @return {@link EdmTerm}
+ */
+ EdmTerm getTerm(FullQualifiedName termName);
+
+ /**
+ * Get {@link EdmAnnotations} by target.
+ *
+ * @param targetName <tt>edm:Annotations</tt> target
+ * @return {@link EdmAnnotations}
+ */
+ EdmAnnotations getAnnotationGroup(FullQualifiedName targetName);
+
+ /**
+ * Get all {@link EdmAnnotation} by element FQN.
+ *
+ * @param annotatableName must not be null
+ * @return {@link EdmAnnotation}
+ */
+ List<EdmAnnotation> getAnnotations(FullQualifiedName annotatableName);
+
+ /**
+ * Get {@link EdmAnnotation} by element FQN and term.
+ *
+ * @param annotatableName must not be null
+ * @param term <tt>edm:Annotation</tt> term
+ * @return {@link EdmAnnotation}
+ */
+ EdmAnnotation getAnnotation(FullQualifiedName annotatableName, EdmTerm term);
+
+ /**
* Get service metadata.
* <br/>
* See {@link EdmServiceMetadata} for more information.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotatable.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotatable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotatable.java
index 1ba20cd..4366b5a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotatable.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotatable.java
@@ -18,13 +18,12 @@
*/
package org.apache.olingo.commons.api.edm;
+import java.util.List;
+
/**
- * EdmAnnotatable can be applied to CSDL elements as described in the Conceptual Schema Definition Language.
+ * Can be applied to CSDL elements as described in the Conceptual Schema Definition Language.
*/
public interface EdmAnnotatable {
- EdmAnnotations getAnnotations();
-
- // TODO: enhance annotations
- Object getAnnotation();
+ List<EdmAnnotation> getAnnotations();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
new file mode 100644
index 0000000..ed567f6
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm;
+
+import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+
+public interface EdmAnnotation extends EdmAnnotatable {
+
+ EdmTerm getTerm();
+
+ String getQualifier();
+
+ EdmAnnotationExpression getExpression();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotations.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotations.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotations.java
index 2aea695..3c1b912 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotations.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotations.java
@@ -18,7 +18,24 @@
*/
package org.apache.olingo.commons.api.edm;
-//TODO: EDM Annotation Interfaces
+import java.util.List;
+
+/**
+ * This is used to apply a group of annotations to a single model element.
+ */
public interface EdmAnnotations {
+ /**
+ * @return a model element in the entity model to which this annotations is targeted
+ */
+ EdmAnnotationsTarget getTarget();
+
+ /**
+ * @return a string allowing annotation authors a means of conditionally applying an annotation
+ */
+ String getQualifier();
+
+ EdmAnnotation getAnnotation(EdmTerm term);
+
+ List<EdmAnnotation> getAnnotations();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotationsTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotationsTarget.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotationsTarget.java
new file mode 100644
index 0000000..a66b114
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotationsTarget.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm;
+
+/**
+ * Interface for CSDL elements thar can be evaluated as <tt>target</tt> for <tt>edm:Annotations</tt>.
+ *
+ * @see EdmAnnotations
+ */
+public interface EdmAnnotationsTarget {
+
+ enum TargetType {
+
+ ActionImport(EdmActionImport.class),
+ ComplexType(EdmComplexType.class),
+ EntityContainer(EdmEntityContainer.class),
+ EntitySet(EdmEntitySet.class),
+ EntityType(EdmEntityType.class),
+ EnumType(EdmEnumType.class),
+ FunctionImport(EdmFunctionImport.class),
+ Member(EdmMember.class),
+ NavigationProperty(EdmNavigationProperty.class),
+ Property(EdmProperty.class),
+ Singleton(EdmSingleton.class),
+ Term(EdmTerm.class),
+ TypeDefinition(EdmTypeDefinition.class);
+
+ private final Class<?> edmClass;
+
+ TargetType(final Class<?> edmClass) {
+ this.edmClass = edmClass;
+ }
+
+ public Class<?> getEdmClass() {
+ return edmClass;
+ }
+
+ }
+
+ /**
+ * @return {@link FullQualifiedName} of this target, or of the parent element if applicable
+ *
+ */
+ FullQualifiedName getAnnotationsTargetFQN();
+
+ /**
+ * @return name of child element, not null if not needed
+ */
+ String getAnnotationsTargetPath();
+
+ /**
+ * @return {@link TargetType} of this target
+ */
+ TargetType getAnnotationsTargetType();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
index 1c66b80..f09164f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java
@@ -24,7 +24,7 @@ import java.util.List;
* Entity Sets or Singletons can be bound to each other using a navigation property binding so an
* {@link EdmBindingTarget} can either be an {@link EdmEntitySet} or an {@link EdmSingleton}.
*/
-public interface EdmBindingTarget extends EdmNamed {
+public interface EdmBindingTarget extends EdmNamed, EdmAnnotationsTarget, EdmAnnotatable {
/**
* Returns the target for a given path.
@@ -38,7 +38,7 @@ public interface EdmBindingTarget extends EdmNamed {
* @return all navigation property bindings
*/
List<EdmNavigationPropertyBinding> getNavigationPropertyBindings();
-
+
/**
* Returns the entity container this target is contained in.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
index 519c11d..4db1e8e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
@@ -26,7 +26,7 @@ import java.util.List;
* <br/>
* EdmEntityContainer hold the information of EntitySets, Singletons, ActionImports and FunctionImports contained
*/
-public interface EdmEntityContainer extends EdmNamed {
+public interface EdmEntityContainer extends EdmNamed, EdmAnnotationsTarget, EdmAnnotatable {
/**
* @return namespace of this entity container
@@ -37,7 +37,7 @@ public interface EdmEntityContainer extends EdmNamed {
* @return full qualified name of this entity container
*/
FullQualifiedName getFullQualifiedName();
-
+
/**
* Returns whether this container is the default container in the current schema.
* <br/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
index dc1806d..cc4c1d7 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEnumType.java
@@ -23,7 +23,7 @@ import java.util.List;
/**
* An EdmEnumType represents a set of related values.
*/
-public interface EdmEnumType extends EdmPrimitiveType {
+public interface EdmEnumType extends EdmPrimitiveType, EdmAnnotationsTarget {
/**
* @param name
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmMember.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmMember.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmMember.java
index 888fe77..fe32c5c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmMember.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmMember.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.edm;
/**
* An {@link EdmEnumType} member element.
*/
-public interface EdmMember extends EdmNamed {
+public interface EdmMember extends EdmNamed, EdmAnnotationsTarget, EdmAnnotatable {
/**
* @return value of this member as string
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
index b53e617..199de6c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java
@@ -25,7 +25,7 @@ import java.util.List;
* <br/>
* EdmNavigationProperty allows navigation from one entity type to another via a relationship.
*/
-public interface EdmNavigationProperty extends EdmElement {
+public interface EdmNavigationProperty extends EdmElement, EdmAnnotationsTarget, EdmAnnotatable {
@Override
EdmEntityType getType();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java
index 28c1985..c916aea 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperation.java
@@ -23,7 +23,7 @@ import java.util.List;
/**
* A EdmOperation can either be an {@link EdmAction} or an {@link EdmFunction}.
*/
-public interface EdmOperation extends EdmType {
+public interface EdmOperation extends EdmType, EdmAnnotatable {
/**
* @param name
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperationImport.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperationImport.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperationImport.java
index ec0648d..f1f5965 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperationImport.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmOperationImport.java
@@ -21,13 +21,13 @@ package org.apache.olingo.commons.api.edm;
/**
* An EdmOperationImport can be an EdmActionImport or an EdmFunctionImport.
*/
-public interface EdmOperationImport extends EdmNamed {
+public interface EdmOperationImport extends EdmNamed, EdmAnnotationsTarget, EdmAnnotatable {
/**
* @return {@link FullQualifiedName} of this OperationImport
*/
FullQualifiedName getFullQualifiedName();
-
+
/**
* @return {@link EdmEntitySet} of this OperationImport
*/
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmParameter.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmParameter.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmParameter.java
index a0cfe67..a3505f8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmParameter.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmParameter.java
@@ -18,10 +18,12 @@
*/
package org.apache.olingo.commons.api.edm;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+
/**
* A CSDL parameter element
*/
-public interface EdmParameter extends EdmElement, EdmMappable {
+public interface EdmParameter extends EdmElement, EdmMappable, EdmAnnotatable {
/**
* @return true if nullable or null if not specified
@@ -42,4 +44,9 @@ public interface EdmParameter extends EdmElement, EdmMappable {
* @return the scale as an Integer or null if not specified
*/
Integer getScale();
+
+ /**
+ * @return a non-negative integer or the special value <tt>variable</tt>
+ */
+ SRID getSrid();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmProperty.java
index fdaf67e..d6e7583 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmProperty.java
@@ -18,12 +18,14 @@
*/
package org.apache.olingo.commons.api.edm;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+
/**
* A CSDL Property element.
* <br/>
* EdmProperty defines a simple type or a complex type.
*/
-public interface EdmProperty extends EdmElement, EdmMappable {
+public interface EdmProperty extends EdmElement, EdmMappable, EdmAnnotationsTarget, EdmAnnotatable {
/**
* Gets the related MIME type for the property.
@@ -60,6 +62,11 @@ public interface EdmProperty extends EdmElement, EdmMappable {
Integer getScale();
/**
+ * @return a non-negative integer or the special value <tt>variable</tt>
+ */
+ SRID getSrid();
+
+ /**
* @return true if unicode or null if not specified
*/
Boolean isUnicode();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
index f30dea5..a61362f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.edm;
/**
* A referential constraint of a navigation property.
*/
-public interface EdmReferentialConstraint {
+public interface EdmReferentialConstraint extends EdmAnnotatable {
/**
* @return property name of the property inside this entity type or complex type.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReturnType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReturnType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReturnType.java
index 9bb849f..540d2ab 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReturnType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReturnType.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.commons.api.edm;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+
/**
* An {@link EdmReturnType} of an {@link EdmOperation}.
*/
@@ -42,4 +44,9 @@ public interface EdmReturnType extends EdmTyped {
* @return the scale as an Integer or null if not specified
*/
Integer getScale();
+
+ /**
+ * @return a non-negative integer or the special value <tt>variable</tt>
+ */
+ SRID getSrid();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
index 73dcdfb..a2147d8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSchema.java
@@ -23,7 +23,7 @@ import java.util.List;
/**
* A csdl schema element
*/
-public interface EdmSchema {
+public interface EdmSchema extends EdmAnnotatable {
/**
* @return the namespace for this schema
@@ -61,6 +61,21 @@ public interface EdmSchema {
List<EdmFunction> getFunctions();
/**
+ * @return all {@link EdmTypeDefinition} for this schema.
+ */
+ List<EdmTypeDefinition> getTypeDefinitions();
+
+ /**
+ * @return all {@link EdmTerm} for this schema.
+ */
+ List<EdmTerm> getTerms();
+
+ /**
+ * @return all {@link EdmAnnotations} for this schema.
+ */
+ List<EdmAnnotations> getAnnotationGroups();
+
+ /**
* @return the entity container for this schema. May be null.
*/
EdmEntityContainer getEntityContainer();
@@ -83,9 +98,4 @@ public interface EdmSchema {
*/
EdmEntityContainer getEntityContainer(FullQualifiedName name);
- /**
- * @return all {@link EdmTypeDefinition} for this schema.
- */
- List<EdmTypeDefinition> getTypeDefinitions();
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmServiceMetadata.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmServiceMetadata.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmServiceMetadata.java
index b186fdd..01d685f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmServiceMetadata.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmServiceMetadata.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.api.edm;
import java.io.InputStream;
import java.util.List;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* This interface gives access to the metadata of a service, the calculated Data Service Version and an info list of all
@@ -35,7 +36,7 @@ public interface EdmServiceMetadata {
/**
* @return <b>String</b> data service version of this service
*/
- String getDataServiceVersion();
+ ODataServiceVersion getDataServiceVersion();
/**
* @return a list of {@link EdmEntitySetInfo} objects inside the data model
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
index a0b5f1e..5c6fcd8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmStructuredType.java
@@ -25,7 +25,7 @@ import java.util.List;
*
* Complex types and entity types are described in the Conceptual Schema Definition of the OData protocol.
*/
-public interface EdmStructuredType extends EdmType {
+public interface EdmStructuredType extends EdmType, EdmAnnotationsTarget, EdmAnnotatable {
/**
* Get property by name
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTerm.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTerm.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTerm.java
index 25a2459..237bbb1 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTerm.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTerm.java
@@ -18,10 +18,34 @@
*/
package org.apache.olingo.commons.api.edm;
+import java.util.List;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+
/**
* An {@link EdmTerm} defines a term in a vocabulary.
*/
-public interface EdmTerm extends EdmNamed {
+public interface EdmTerm extends EdmNamed, EdmAnnotationsTarget, EdmAnnotatable {
+
+ /**
+ * @return type of value returned by the expression contained in an annotation using this term
+ */
+ EdmType getType();
+
+ FullQualifiedName getFullQualifiedName();
+
+ /**
+ * When applying a term with a base term,the base term MUST also be applied with the same qualifier, and so on until a
+ * term without a base term is reached.
+ *
+ * @return the base term if found or null otherwise
+ */
+ EdmTerm getBaseTerm();
+
+ /**
+ * @return list of CSDL element that this term can be applied to; if no value is supplied, the term is not restricted
+ * in its application.
+ */
+ List<Class<?>> getAppliesTo();
/**
* @return true if nullable or null if not specified
@@ -44,7 +68,13 @@ public interface EdmTerm extends EdmNamed {
Integer getScale();
/**
+ * @return a non-negative integer or the special value <tt>variable</tt>
+ */
+ SRID getSrid();
+
+ /**
* @return the default value as a String or null if not specified
*/
String getDefaultValue();
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTypeDefinition.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTypeDefinition.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTypeDefinition.java
index c16ed85..9a1eaa8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTypeDefinition.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmTypeDefinition.java
@@ -18,12 +18,14 @@
*/
package org.apache.olingo.commons.api.edm;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+
/**
* An {@link EdmTypeDefinition} defines a specialization of one of the possible primitive types.
* <br/>
* For more information on primitive types refer to {@link EdmPrimitiveType}.
*/
-public interface EdmTypeDefinition extends EdmPrimitiveType {
+public interface EdmTypeDefinition extends EdmPrimitiveType, EdmAnnotationsTarget, EdmAnnotatable {
/**
* @return {@link EdmPrimitiveType} this type definition is based upon
@@ -46,6 +48,11 @@ public interface EdmTypeDefinition extends EdmPrimitiveType {
Integer getScale();
/**
+ * @return a non-negative integer or the special value <tt>variable</tt>
+ */
+ SRID getSrid();
+
+ /**
* @return true if unicode or null if not specified
*/
Boolean isUnicode();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
new file mode 100644
index 0000000..a232c2e
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm.annotation;
+
+public interface EdmAnd extends EdmTwoParamsOpDynamicAnnotationExpression {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
new file mode 100644
index 0000000..2da9692
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm.annotation;
+
+public interface EdmAnnotationExpression {
+
+ boolean isConstant();
+
+ EdmConstantAnnotationExpression asConstant();
+
+ boolean isDynamic();
+
+ EdmDynamicAnnotationExpression asDynamic();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
new file mode 100644
index 0000000..b55e226
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm.annotation;
+
+public interface EdmAnnotationPath extends EdmDynamicAnnotationExpression {
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
new file mode 100644
index 0000000..cb666ca
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm.annotation;
+
+import java.util.List;
+import org.apache.olingo.commons.api.edm.EdmAnnotatable;
+
+public interface EdmApply extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+
+ /**
+ * A QualifiedName specifying the name of the client-side function to apply.
+ * <br/>
+ * OData defines three canonical functions. Services MAY support additional functions that MUST be qualified with a
+ * namespace or alias other than odata. Function names qualified with odata are reserved for this specification and
+ * its future versions.
+ *
+ * @see org.apache.olingo.commons.api.Constants#CANONICAL_FUNCTION_CONCAT
+ * @see org.apache.olingo.commons.api.Constants#CANONICAL_FUNCTION_FILLURITEMPLATE
+ * @see org.apache.olingo.commons.api.Constants#CANONICAL_FUNCTION_URIENCODE
+ * @return function full qualified name
+ */
+ String getFunction();
+
+ List<EdmAnnotationExpression> getParameters();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
new file mode 100644
index 0000000..cb28d08
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm.annotation;
+
+import org.apache.olingo.commons.api.edm.EdmAnnotatable;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+
+public interface EdmCast extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+
+ Integer getMaxLength();
+
+ Integer getPrecision();
+
+ Integer getScale();
+
+ SRID getSrid();
+
+ EdmType getType();
+
+ EdmDynamicAnnotationExpression getValue();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/726fbe52/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
new file mode 100644
index 0000000..7523d78
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package org.apache.olingo.commons.api.edm.annotation;
+
+import java.util.List;
+
+public interface EdmCollection extends EdmDynamicAnnotationExpression {
+
+ List<EdmAnnotationExpression> getItems();
+
+}