You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by tb...@apache.org on 2013/12/06 17:52:51 UTC
[09/50] [abbrv] git commit: Refactored Edm* annotations
Refactored Edm* annotations
Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/commit/7309d92e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/7309d92e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/7309d92e
Branch: refs/heads/ODataServlet
Commit: 7309d92ef668166f19044b08a64e7042a2955606
Parents: f6b68c9
Author: Michael Bolz <mi...@apache.org>
Authored: Thu Nov 14 06:30:53 2013 +0100
Committer: Tamara Boehm <ta...@sap.com>
Committed: Fri Dec 6 17:49:22 2013 +0100
----------------------------------------------------------------------
.../annotation/edm/AnnotationEdmProvider.java | 84 ++++++++++++++------
.../core/annotation/edm/AnnotationHelper.java | 13 ++-
.../processor/json/EdmAnnotationSerializer.java | 8 +-
.../odata2/core/annotation/model/Building.java | 9 ++-
.../odata2/core/annotation/model/City.java | 4 +-
.../odata2/core/annotation/model/Employee.java | 9 ++-
.../odata2/core/annotation/model/Location.java | 4 +-
.../odata2/core/annotation/model/Manager.java | 9 ++-
.../annotation/model/ModelSharedConstants.java | 2 +-
.../odata2/core/annotation/model/Room.java | 13 +--
.../odata2/core/annotation/model/Team.java | 11 +--
.../odata2/ref/annotation/model/Building.java | 9 ++-
.../odata2/ref/annotation/model/City.java | 4 +-
.../odata2/ref/annotation/model/Employee.java | 15 ++--
.../odata2/ref/annotation/model/Location.java | 4 +-
.../odata2/ref/annotation/model/Manager.java | 9 ++-
.../odata2/ref/annotation/model/Photo.java | 5 +-
.../odata2/ref/annotation/model/Room.java | 15 ++--
.../odata2/ref/annotation/model/Team.java | 9 ++-
.../api/annotation/edm/EdmComplexEntity.java | 31 --------
.../api/annotation/edm/EdmComplexType.java | 31 ++++++++
.../odata2/api/annotation/edm/EdmEntitySet.java | 31 ++++++++
.../api/annotation/edm/EdmEntityType.java | 3 -
.../odata2/api/annotation/edm/EdmFacets.java | 4 +-
.../api/annotation/edm/EdmFunctionImport.java | 49 ++++++++++++
.../edm/EdmFunctionImportParameter.java | 33 ++++++++
.../annotation/edm/EdmNavigationProperty.java | 4 +-
.../odata2/api/annotation/edm/EdmProperty.java | 3 -
.../api/annotation/edm/NavigationEnd.java | 3 +-
29 files changed, 290 insertions(+), 138 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
index 6fb69b7..4ce8563 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationEdmProvider.java
@@ -27,7 +27,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexEntity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceContent;
@@ -74,6 +75,7 @@ public class AnnotationEdmProvider extends EdmProvider {
private final Map<String, ContainerBuilder> containerName2ContainerBuilder = new HashMap<String, ContainerBuilder>();
private final Map<String, Schema> namespace2Schema = new HashMap<String, Schema>();
private EntityContainer defaultContainer;
+ private String DEFAULT_CONTAINER_NAME = "DefaultContainer";
public AnnotationEdmProvider(Collection<Class<?>> annotatedClasses) {
@@ -240,7 +242,7 @@ public class AnnotationEdmProvider extends EdmProvider {
if (et != null) {
updateSchema(aClass, et);
}
- EdmComplexEntity ect = aClass.getAnnotation(EdmComplexEntity.class);
+ EdmComplexType ect = aClass.getAnnotation(EdmComplexType.class);
if (ect != null) {
updateSchema(aClass, ect);
}
@@ -258,7 +260,7 @@ public class AnnotationEdmProvider extends EdmProvider {
b.addAssociations(typeBuilder.buildAssociations());
}
- private void updateSchema(Class<?> aClass, EdmComplexEntity et) {
+ private void updateSchema(Class<?> aClass, EdmComplexType et) {
String namespace = et.namespace();
SchemaBuilder b = namespace2SchemaBuilder.get(namespace);
if (b == null) {
@@ -270,22 +272,33 @@ public class AnnotationEdmProvider extends EdmProvider {
}
private void handleEntityContainer(Class<?> aClass) {
- EdmEntityType entity = aClass.getAnnotation(EdmEntityType.class);
- if (entity != null && !entity.entitySetName().isEmpty()) {
- String containerName = entity.container();
+ EdmEntityType entityType = aClass.getAnnotation(EdmEntityType.class);
+ if (entityType != null) {
+ String containerName = getContainerName(entityType);
ContainerBuilder builder = containerName2ContainerBuilder.get(containerName);
if (builder == null) {
- builder = ContainerBuilder.init(entity.namespace(), containerName);
+ builder = ContainerBuilder.init(entityType.namespace(), containerName);
containerName2ContainerBuilder.put(containerName, builder);
}
- builder.addEntitySet(createEntitySet(entity));
+ EdmEntitySet entitySet = aClass.getAnnotation(EdmEntitySet.class);
+ if(entitySet != null) {
+ FullQualifiedName typeName = createFqnForEntityType(aClass, entityType);
+ builder.addEntitySet(createEntitySet(typeName, entitySet));
+ }
}
}
- private EntitySet createEntitySet(EdmEntityType entity) {
- FullQualifiedName typeName = new FullQualifiedName(entity.namespace(), entity.name());
+ private EntitySet createEntitySet(FullQualifiedName typeName, EdmEntitySet entitySet) {
+ return new EntitySet().setName(entitySet.name()).setEntityType(typeName);
+ }
- return new EntitySet().setName(entity.entitySetName()).setEntityType(typeName);
+ private FullQualifiedName createFqnForEntityType(Class<?> annotatedClass, EdmEntityType entityType) {
+ String name = entityType.name();
+ if(name.isEmpty()) {
+ return new FullQualifiedName(entityType.namespace(), annotatedClass.getSimpleName());
+ } else {
+ return new FullQualifiedName(entityType.namespace(), entityType.name());
+ }
}
private void finish() {
@@ -309,6 +322,10 @@ public class AnnotationEdmProvider extends EdmProvider {
}
}
+ private String getContainerName(EdmEntityType entity) {
+ return DEFAULT_CONTAINER_NAME;
+ }
+
//
//
//
@@ -333,7 +350,7 @@ public class AnnotationEdmProvider extends EdmProvider {
return new TypeBuilder(entity.namespace(), entity.name()).withClass(aClass);
}
- public static TypeBuilder init(EdmComplexEntity entity, Class<?> aClass) {
+ public static TypeBuilder init(EdmComplexType entity, Class<?> aClass) {
return new TypeBuilder(entity.namespace(), entity.name()).withClass(aClass);
}
@@ -465,7 +482,7 @@ public class AnnotationEdmProvider extends EdmProvider {
cp.setName(entityName);
// settings from related complex entity
- EdmComplexEntity ece = field.getType().getAnnotation(EdmComplexEntity.class);
+ EdmComplexType ece = field.getType().getAnnotation(EdmComplexType.class);
String complexEntityNamespace = ece.namespace();
if (complexEntityNamespace.isEmpty()) {
complexEntityNamespace = defaultNamespace;
@@ -482,7 +499,7 @@ public class AnnotationEdmProvider extends EdmProvider {
entityName = getCanonicalName(field);
}
navProp.setName(entityName);
- navProp.setRelationship(new FullQualifiedName(namespace, enp.relationship()));
+ navProp.setRelationship(new FullQualifiedName(namespace, enp.association()));
//
NavigationEnd from = enp.from();
String fromRole = from.role();
@@ -547,30 +564,34 @@ public class AnnotationEdmProvider extends EdmProvider {
}
private Association createAssociation(Field field, NavigationProperty navProperty) {
- Association a = new Association();
- a.setName(navProperty.getRelationship().getName());
+ Association association = new Association();
+ association.setName(navProperty.getRelationship().getName());
EdmNavigationProperty navigation = field.getAnnotation(EdmNavigationProperty.class);
NavigationEnd from = navigation.from();
AssociationEnd fromEnd = new AssociationEnd();
fromEnd.setRole(navProperty.getFromRole());
- String typeName = from.type();
+ String typeName = extractEntitTypeName(from);
if (typeName.isEmpty()) {
- typeName = name;
+ Class<?> fromClass = field.getDeclaringClass();
+ EdmEntityType entityType = fromClass.getAnnotation(EdmEntityType.class);
+ typeName = entityType.name();
}
fromEnd.setType(new FullQualifiedName(namespace, typeName));
fromEnd.setMultiplicity(from.multiplicity());
- a.setEnd1(fromEnd);
+ association.setEnd1(fromEnd);
NavigationEnd to = navigation.to();
AssociationEnd toEnd = new AssociationEnd();
toEnd.setRole(navProperty.getToRole());
final FullQualifiedName toFqn;
- if (to.type().isEmpty()) {
+ String toTypeName = extractEntitTypeName(to);
+ if (toTypeName.isEmpty()) {
Class<?> toClass = field.getType();
- toFqn = new FullQualifiedName(namespace, toClass.getSimpleName());
+ EdmEntityType entityType = toClass.getAnnotation(EdmEntityType.class);
+ toFqn = new FullQualifiedName(namespace, entityType.name());
} else {
- toFqn = new FullQualifiedName(namespace, to.type());
+ toFqn = new FullQualifiedName(namespace, toTypeName);
}
toEnd.setType(toFqn);
@@ -584,9 +605,9 @@ public class AnnotationEdmProvider extends EdmProvider {
toEnd.setMultiplicity(toMultiplicity);
}
- a.setEnd2(toEnd);
+ association.setEnd2(toEnd);
- return a;
+ return association;
}
private String getCanonicalName(Field field) {
@@ -594,10 +615,22 @@ public class AnnotationEdmProvider extends EdmProvider {
}
private boolean isAnnotatedEntity(Class<?> clazz) {
- boolean isComplexEntity = clazz.getAnnotation(EdmComplexEntity.class) != null;
+ boolean isComplexEntity = clazz.getAnnotation(EdmComplexType.class) != null;
boolean isEntity = clazz.getAnnotation(EdmEntityType.class) != null;
return isComplexEntity || isEntity;
}
+
+ private String extractEntitTypeName(NavigationEnd navEnd) {
+ Class<?> entityTypeClass = navEnd.entitySet();
+ if(entityTypeClass == Object.class) {
+ return "";
+ }
+ EdmEntityType type = entityTypeClass.getAnnotation(EdmEntityType.class);
+ if(type == null) {
+ return "";
+ }
+ return type.name();
+ }
}
static class SchemaBuilder {
@@ -745,6 +778,7 @@ public class AnnotationEdmProvider extends EdmProvider {
return ec;
}
+
private String getEntitySetName(AssociationEnd end) {
for (EntitySet entitySet : entitySets) {
if(entitySet.getEntityType().equals(end.getType())) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
index 1e1d31b..d43f8c9 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/edm/AnnotationHelper.java
@@ -23,10 +23,9 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexEntity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
@@ -35,7 +34,6 @@ import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
import org.apache.olingo.odata2.api.edm.EdmSimpleTypeException;
import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
import org.apache.olingo.odata2.api.exception.ODataException;
-import org.apache.olingo.odata2.core.annotation.ds.DataStore;
import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
/**
@@ -109,7 +107,7 @@ public class AnnotationHelper {
for (Field sourcField : sourceFields) {
EdmNavigationProperty sourceNav = sourcField.getAnnotation(EdmNavigationProperty.class);
EdmNavigationProperty targetNav = targetField.getAnnotation(EdmNavigationProperty.class);
- if (sourceNav.relationship().equals(targetNav.relationship())) {
+ if (sourceNav.association().equals(targetNav.association())) {
return targetField;
}
}
@@ -388,8 +386,9 @@ public class AnnotationHelper {
return false;
} else {
final boolean isEntity = null != clazz.getAnnotation(EdmEntityType.class);
- final boolean isComplexEntity = null != clazz.getAnnotation(EdmComplexEntity.class);
- return isEntity || isComplexEntity;
+ final boolean isEntitySet = null != clazz.getAnnotation(EdmEntitySet.class);
+ final boolean isComplexEntity = null != clazz.getAnnotation(EdmComplexType.class);
+ return isEntity || isComplexEntity || isEntitySet;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
index 7dceba9..6e1d8ea 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/main/java/org/apache/olingo/odata2/core/annotation/processor/json/EdmAnnotationSerializer.java
@@ -25,8 +25,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
-import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
@@ -122,12 +122,12 @@ public class EdmAnnotationSerializer {
private boolean writeEdmNavigationProperty(Object entity, JsonWriter json, Field field)
throws IllegalArgumentException, IllegalAccessException {
EdmNavigationProperty navProperty = field.getAnnotation(EdmNavigationProperty.class);
- EdmEntityType entityType = entity.getClass().getAnnotation(EdmEntityType.class);
+ EdmEntitySet entitySet = entity.getClass().getAnnotation(EdmEntitySet.class);
if (navProperty != null) {
field.setAccessible(true);
Object keyValue = extractEdmKey(entity);
- json.writeStringProperty("uri", baseUri + entityType.entitySetName() + "('" + keyValue.toString() + "')"
- + "/" + navProperty.relationship());
+ json.writeStringProperty("uri", baseUri + entitySet.name() + "('" + keyValue.toString() + "')"
+ + "/" + navProperty.association());
return true;
}
return false;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Building.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Building.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Building.java
index 9427151..2abf4e3 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Building.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Building.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata2.core.annotation.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
@@ -33,8 +34,8 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name="Building", namespace=ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Buildings", container="Container1")
+@EdmEntityType(name="Building", namespace=ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Buildings")
public class Building {
@EdmKey
@EdmProperty(type = EdmSimpleTypeKind.String)
@@ -42,8 +43,8 @@ public class Building {
@EdmProperty
private String name;
private byte[] image;
- @EdmNavigationProperty(name="nb_rooms", relationship="BuildingRooms",
- to = @NavigationEnd(role = "r_Room", type="Room", multiplicity = EdmMultiplicity.MANY))
+ @EdmNavigationProperty(name="nb_rooms", association="BuildingRooms",
+ to = @NavigationEnd(role = "r_Room", entitySet=Room.class, multiplicity = EdmMultiplicity.MANY))
private List<Room> rooms = new ArrayList<Room>();
public Building() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/City.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/City.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/City.java
index c063ffe..7b866a3 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/City.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/City.java
@@ -18,14 +18,14 @@
******************************************************************************/
package org.apache.olingo.odata2.core.annotation.model;
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexEntity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
/**
*
*/
-@EdmComplexEntity(name="c_City", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmComplexType(name="c_City", namespace = ModelSharedConstants.NAMESPACE_1)
public class City {
@EdmProperty
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Employee.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Employee.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Employee.java
index 07a7dcb..6eda19c 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Employee.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Employee.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.core.annotation.model;
import java.text.DateFormat;
import java.util.Calendar;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
@@ -32,8 +33,8 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name="Employee", namespace=ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Employees", container=ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name="Employee", namespace=ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Employees")
public class Employee {
private static int counter = 1;
@EdmKey
@@ -43,8 +44,8 @@ public class Employee {
private String employeeName;
@EdmProperty
private int age;
- @EdmNavigationProperty(name="ne_Manager", relationship="ManagerEmployees",
- from = @NavigationEnd(role="r_Employees", multiplicity = EdmMultiplicity.MANY))//,
+ @EdmNavigationProperty(name="ne_Manager", association="ManagerEmployees",
+ from = @NavigationEnd(role="r_Employees", entitySet=Employee.class, multiplicity=EdmMultiplicity.MANY))//,
// to = @NavigationEnd(type = "Manager"))
private Manager manager;
private Team team;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Location.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Location.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Location.java
index 242b4cf..7f3f082 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Location.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Location.java
@@ -18,14 +18,14 @@
******************************************************************************/
package org.apache.olingo.odata2.core.annotation.model;
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexEntity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
/**
*
*/
-@EdmComplexEntity(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmComplexType(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1)
public class Location {
@EdmProperty
private String country;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Manager.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Manager.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Manager.java
index 187d4f8..fcfbf7d 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Manager.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Manager.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.core.annotation.model;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
@@ -28,12 +29,12 @@ import org.apache.olingo.odata2.api.annotation.edm.NavigationEnd;
/**
*
*/
-@EdmEntityType(name = "Manager", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Managers", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name = "Manager", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Managers")
public class Manager extends Employee {
- @EdmNavigationProperty(name = "nm_Employees", relationship = "ManagerEmployees",
- to = @NavigationEnd(role = "r_Employees", type = "Employee"))
+ @EdmNavigationProperty(name = "nm_Employees", association = "ManagerEmployees",
+ to = @NavigationEnd(role = "r_Employees", entitySet = Employee.class))
private List<Employee> employees = new ArrayList<Employee>();
public Manager(final int id, final String name) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/ModelSharedConstants.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/ModelSharedConstants.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/ModelSharedConstants.java
index f87165f..1d44498 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/ModelSharedConstants.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/ModelSharedConstants.java
@@ -21,5 +21,5 @@ package org.apache.olingo.odata2.core.annotation.model;
public interface ModelSharedConstants {
String NAMESPACE_1 = "RefScenario";
- String CONTAINER_1 = "Container1";
+ String CONTAINER_1 = "DefaultContainer";
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Room.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Room.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Room.java
index 3628ac8..2f6be68 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Room.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Room.java
@@ -17,6 +17,7 @@ package org.apache.olingo.odata2.core.annotation.model;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
@@ -27,20 +28,20 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
/**
*
*/
-@EdmEntityType(name = "Room", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Rooms", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name = "Room", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Rooms")
public class Room extends RefBase {
@EdmProperty
private Integer seats;
@EdmProperty
private Integer version;
- @EdmNavigationProperty(name = "nr_Building", relationship = "BuildingRooms",
+ @EdmNavigationProperty(name = "nr_Building", association = "BuildingRooms",
from = @NavigationEnd(role = "r_Room", multiplicity = EdmMultiplicity.MANY))
private Building building;
- @EdmNavigationProperty(name = "nr_Employees", relationship = "RoomEmployees",
- from = @NavigationEnd(role = "r_Room", type = "Room", multiplicity = EdmMultiplicity.ONE),
- to = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY))
+ @EdmNavigationProperty(name = "nr_Employees", association = "RoomEmployees",
+ from = @NavigationEnd(role = "r_Room", entitySet = Room.class, multiplicity = EdmMultiplicity.ONE),
+ to = @NavigationEnd(role = "r_Employees", entitySet = Employee.class, multiplicity = EdmMultiplicity.MANY))
private List<Employee> employees = new ArrayList<Employee>();
public Room(final int id, final String name) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Team.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Team.java b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Team.java
index e3ea0cc..2d37be4 100644
--- a/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Team.java
+++ b/odata2-edm-annotation/edm-annotation-core/src/test/java/org/apache/olingo/odata2/core/annotation/model/Team.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.core.annotation.model;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
@@ -31,14 +32,14 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name="Team", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Teams", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name="Team", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Teams")
public class Team extends RefBase {
@EdmProperty(type = EdmSimpleTypeKind.Boolean)
private Boolean isScrumTeam;
- @EdmNavigationProperty(name = "ne_Teams", relationship="TeamEmployees",
- from = @NavigationEnd(role = "r_Team", type = "Team"),
- to = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY))
+ @EdmNavigationProperty(name = "ne_Teams", association="TeamEmployees",
+ from = @NavigationEnd(role = "r_Team", entitySet = Team.class),
+ to = @NavigationEnd(role = "r_Employees", entitySet = Employee.class, multiplicity = EdmMultiplicity.MANY))
private List<Employee> employees = new ArrayList<Employee>();
public Team() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
index 66adb24..488c462 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Building.java
@@ -21,6 +21,7 @@ package org.apache.olingo.odata2.ref.annotation.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
@@ -32,8 +33,8 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name="Building", namespace=ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Buildings", container="Container1")
+@EdmEntityType(name="Building", namespace=ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Buildings")
public class Building {
@EdmKey
@EdmProperty(type = EdmSimpleTypeKind.Int32)
@@ -41,8 +42,8 @@ public class Building {
@EdmProperty
private String name;
private byte[] image;
- @EdmNavigationProperty(name="nb_rooms", relationship="BuildingRooms",
- to = @NavigationEnd(role = "r_Room", type="Room", multiplicity = EdmMultiplicity.MANY))
+ @EdmNavigationProperty(name="nb_rooms", association="BuildingRooms",
+ to = @NavigationEnd(role = "r_Room", entitySet=Room.class, multiplicity = EdmMultiplicity.MANY))
private List<Room> rooms = new ArrayList<Room>();
public String getId() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/City.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/City.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/City.java
index 40e030f..a4d5a56 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/City.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/City.java
@@ -18,13 +18,13 @@
******************************************************************************/
package org.apache.olingo.odata2.ref.annotation.model;
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexEntity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
/**
*
*/
-@EdmComplexEntity(name="c_City", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmComplexType(name="c_City", namespace = ModelSharedConstants.NAMESPACE_1)
public class City {
@EdmProperty
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
index 5092067..e946a5a 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Employee.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.ref.annotation.model;
import java.text.DateFormat;
import java.util.Calendar;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
@@ -31,8 +32,8 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name="Employee", namespace=ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Employees", container=ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name="Employee", namespace=ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name= "Employees")
public class Employee {
private static int counter = 1;
@EdmKey
@@ -42,13 +43,13 @@ public class Employee {
private String employeeName;
@EdmProperty
private int age;
- @EdmNavigationProperty(name="ne_Manager", relationship="ManagerEmployees",
- from = @NavigationEnd(role="r_Employees", multiplicity = EdmMultiplicity.MANY))//,
+ @EdmNavigationProperty(name="ne_Manager", association="ManagerEmployees",
+ from = @NavigationEnd(role="r_Employees", entitySet=Manager.class, multiplicity=EdmMultiplicity.MANY))//,
// to = @NavigationEnd(type = "Manager"))
private Manager manager;
- @EdmNavigationProperty(name = "ne_Team", relationship="TeamEmployees",
- from = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY),
- to = @NavigationEnd(role = "r_Team", type = "Team")
+ @EdmNavigationProperty(name = "ne_Team", association="TeamEmployees",
+ from = @NavigationEnd(role = "r_Employees", entitySet = Employee.class, multiplicity = EdmMultiplicity.MANY),
+ to = @NavigationEnd(role = "r_Team", entitySet = Team.class)
)
private Team team;
private Room room;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Location.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Location.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Location.java
index 809accf..9b0785c 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Location.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Location.java
@@ -18,13 +18,13 @@
******************************************************************************/
package org.apache.olingo.odata2.ref.annotation.model;
-import org.apache.olingo.odata2.api.annotation.edm.EdmComplexEntity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmComplexType;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
/**
*
*/
-@EdmComplexEntity(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmComplexType(name = "c_Location", namespace = ModelSharedConstants.NAMESPACE_1)
public class Location {
@EdmProperty
private String country;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
index 135753b..0fcd152 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Manager.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.ref.annotation.model;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
import org.apache.olingo.odata2.api.annotation.edm.NavigationEnd;
@@ -27,12 +28,12 @@ import org.apache.olingo.odata2.api.annotation.edm.NavigationEnd;
/**
*
*/
-@EdmEntityType(name = "Manager", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Managers", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name = "Manager", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Managers")
public class Manager extends Employee {
- @EdmNavigationProperty(name = "nm_Employees", relationship = "ManagerEmployees",
- to = @NavigationEnd(role = "r_Employees", type = "Employee"))
+ @EdmNavigationProperty(name = "nm_Employees", association = "ManagerEmployees",
+ to = @NavigationEnd(role = "r_Employees", entitySet = Employee.class))
private List<Employee> employees = new ArrayList<Employee>();
public List<Employee> getEmployees() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
index 432baba..3623b2b 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Photo.java
@@ -19,6 +19,7 @@
package org.apache.olingo.odata2.ref.annotation.model;
import java.util.Arrays;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmKey;
import org.apache.olingo.odata2.api.annotation.edm.EdmMediaResourceContent;
@@ -30,8 +31,8 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name = "Photo", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Photos", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name = "Photo", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Photos")
public class Photo {
@EdmProperty
@EdmKey
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
index 56e7e19..3d61a63 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Room.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.ref.annotation.model;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
@@ -29,20 +30,20 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
/**
*
*/
-@EdmEntityType(name = "Room", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Rooms", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name = "Room", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Rooms")
public class Room extends RefBase {
@EdmProperty
private Integer seats;
@EdmProperty
private Integer version;
- @EdmNavigationProperty(name="nr_Building", relationship="BuildingRooms",
- from = @NavigationEnd(role="r_Room", multiplicity = EdmMultiplicity.MANY))
+ @EdmNavigationProperty(name="nr_Building", association="BuildingRooms",
+ from = @NavigationEnd(role="r_Room", entitySet = Building.class, multiplicity = EdmMultiplicity.MANY))
private Building building;
- @EdmNavigationProperty(name="nr_Employees", relationship="RoomEmployees",
- from = @NavigationEnd(role = "r_Room", type = "Room", multiplicity = EdmMultiplicity.ONE),
- to = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY))
+ @EdmNavigationProperty(name="nr_Employees", association="RoomEmployees",
+ from = @NavigationEnd(role = "r_Room", entitySet = Room.class, multiplicity = EdmMultiplicity.ONE),
+ to = @NavigationEnd(role = "r_Employees", entitySet = Employee.class, multiplicity = EdmMultiplicity.MANY))
private List<Employee> employees = new ArrayList<Employee>();
public void setSeats(final int seats) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
----------------------------------------------------------------------
diff --git a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
index 6936517..1b04c32 100644
--- a/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
+++ b/odata2-edm-annotation/edm-annotation-webref/src/main/java/org/apache/olingo/odata2/ref/annotation/model/Team.java
@@ -20,6 +20,7 @@ package org.apache.olingo.odata2.ref.annotation.model;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata2.api.annotation.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.annotation.edm.EdmEntityType;
import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
@@ -30,14 +31,14 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
/**
*
*/
-@EdmEntityType(name="Team", namespace = ModelSharedConstants.NAMESPACE_1,
- entitySetName = "Teams", container = ModelSharedConstants.CONTAINER_1)
+@EdmEntityType(name="Team", namespace = ModelSharedConstants.NAMESPACE_1)
+@EdmEntitySet(name = "Teams")
public class Team extends RefBase {
@EdmProperty(type = EdmSimpleTypeKind.Boolean)
private Boolean isScrumTeam;
- @EdmNavigationProperty(name = "nt_Employees", relationship="TeamEmployees",
+ @EdmNavigationProperty(name = "nt_Employees", association="TeamEmployees",
// from = @NavigationEnd(role = "r_Team", type = "Team"),
- to = @NavigationEnd(role = "r_Employees", type = "Employee", multiplicity = EdmMultiplicity.MANY)
+ to = @NavigationEnd(role = "r_Employees", entitySet = Employee.class, multiplicity = EdmMultiplicity.MANY)
)
private List<Employee> employees = new ArrayList<Employee>();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java
deleted file mode 100644
index adec2d7..0000000
--- a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexEntity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.odata2.api.annotation.edm;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-public @interface EdmComplexEntity {
- String name() default "";
- String namespace();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexType.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexType.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexType.java
new file mode 100644
index 0000000..b6b52f3
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmComplexType.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.odata2.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EdmComplexType {
+ String name() default "";
+ String namespace();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntitySet.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntitySet.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntitySet.java
new file mode 100644
index 0000000..4a7fa6e
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntitySet.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.odata2.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EdmEntitySet {
+ String name() default "";
+// String container() default "";
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
index ed5d802..67a363d 100644
--- a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmEntityType.java
@@ -28,7 +28,4 @@ import java.lang.annotation.Target;
public @interface EdmEntityType {
String name() default "";
String namespace();
- /* If set this entity is exposed as entity set with given name. If not set theire will be no entity set generated. */
- String entitySetName() default "";
- String container() default "";
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
index 4ea2bd5..98edf8c 100644
--- a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFacets.java
@@ -26,8 +26,8 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface EdmFacets {
- int maxLength() default 0;
+ int maxLength() default -1;
int scale() default -1;
- int precision() default 0;
+ int precision() default -1;
boolean nullable() default false;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImport.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImport.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImport.java
new file mode 100644
index 0000000..dd85784
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImport.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.odata2.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.olingo.odata2.api.annotation.edmx.HttpMethod;
+import org.apache.olingo.odata2.api.annotation.edmx.HttpMethod.Name;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface EdmFunctionImport {
+
+ enum Type {
+ SIMPLE, ENTITY, COMPLEX
+ }
+
+ @interface ReturnType {
+ Type type();
+ boolean isCollection() default false;
+ }
+
+ String name() default "";
+
+ String entitySet() default "";
+
+ ReturnType returnType();
+
+ HttpMethod httpMethod() default @HttpMethod(name = Name.GET);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImportParameter.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImportParameter.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImportParameter.java
new file mode 100644
index 0000000..d5b2e80
--- /dev/null
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmFunctionImportParameter.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.odata2.api.annotation.edm;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+public @interface EdmFunctionImportParameter {
+ String name();
+ EdmSimpleTypeKind type() default EdmSimpleTypeKind.Null;
+ Facets facets() default @Facets;
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
index cf898df..544471b 100644
--- a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmNavigationProperty.java
@@ -28,8 +28,8 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
@Target(ElementType.FIELD)
public @interface EdmNavigationProperty {
String name();
- String relationship();
-
+ String association() default ""; // if not set -> will be generated
+
//
NavigationEnd from() default @NavigationEnd;
NavigationEnd to() default @NavigationEnd;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
index 66c5282..14911ce 100644
--- a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/EdmProperty.java
@@ -29,8 +29,5 @@ import org.apache.olingo.odata2.api.edm.EdmSimpleTypeKind;
public @interface EdmProperty {
EdmSimpleTypeKind type() default EdmSimpleTypeKind.Null;
String name() default "";
- /* only for complex property */
- String namespace() default "";
EdmFacets facets() default @EdmFacets;
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/7309d92e/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
index 2ce5ef1..6846dba 100644
--- a/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
+++ b/odata2-lib/odata-annotation/src/main/java/org/apache/olingo/odata2/api/annotation/edm/NavigationEnd.java
@@ -28,7 +28,8 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
@Target(ElementType.FIELD)
public @interface NavigationEnd {
String role() default "";
- String type() default "";
+ // because entityset is mandatory for some cases set it as default to 'Object.class'
+ Class<?> entitySet() default Object.class;
EdmMultiplicity multiplicity() default EdmMultiplicity.ONE;
}