You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2013/12/04 06:21:53 UTC
git commit: Removed dependcy from 'api-annotations' to 'api' (missing
parts)
Updated Branches:
refs/heads/PocEdmAnnotationsExtension 09344a5bc -> e19384d6a
Removed dependcy from 'api-annotations' to 'api' (missing parts)
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/e19384d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/tree/e19384d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/diff/e19384d6
Branch: refs/heads/PocEdmAnnotationsExtension
Commit: e19384d6a760f3785e94ff4c73fde61b3f81bb70
Parents: 09344a5
Author: Michael Bolz <mi...@apache.org>
Authored: Wed Dec 4 06:19:17 2013 +0100
Committer: Michael Bolz <mi...@apache.org>
Committed: Wed Dec 4 06:19:17 2013 +0100
----------------------------------------------------------------------
.../core/annotation/edm/AnnotationHelper.java | 12 +++++++++++-
.../odata2/core/annotation/model/Building.java | 4 ++--
.../odata2/core/annotation/model/Manager.java | 4 ++--
.../odata2/core/annotation/model/Team.java | 4 ++--
.../odata2/ref/annotation/model/Building.java | 4 ++--
.../odata2/ref/annotation/model/Manager.java | 4 ++--
.../odata2/ref/annotation/model/Team.java | 4 ++--
odata2-lib/odata-annotation/pom.xml | 8 --------
.../edm/EdmFunctionImportParameter.java | 6 +++---
.../annotation/edm/EdmNavigationProperty.java | 20 +++++++++++++++++---
10 files changed, 43 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 94edb0a..d1dd7cc 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
@@ -30,6 +30,7 @@ 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.EdmNavigationProperty.Multiplicity;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
import org.apache.olingo.odata2.api.edm.EdmLiteralKind;
import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
@@ -266,7 +267,7 @@ public class AnnotationHelper {
}
public EdmMultiplicity getMultiplicity(EdmNavigationProperty enp, Field field) {
- EdmMultiplicity multiplicity = enp.toMultiplicity();
+ EdmMultiplicity multiplicity = mapMultiplicity(enp.toMultiplicity());
final boolean isCollectionType = field.getType().isArray() || Collection.class.isAssignableFrom(field.getType());
if (multiplicity == EdmMultiplicity.ONE && isCollectionType) {
@@ -686,6 +687,15 @@ public class AnnotationHelper {
+ "' for mapping to EdmSimpleTypeKind.");
}
}
+
+ public EdmMultiplicity mapMultiplicity(Multiplicity multiplicity) {
+ switch (multiplicity) {
+ case ZERO_TO_ONE: return EdmMultiplicity.ZERO_TO_ONE;
+ case ONE: return EdmMultiplicity.ONE;
+ case MANY: return EdmMultiplicity.MANY;
+ default: throw new ODataRuntimeException("Unknown type '" + multiplicity + "' for mapping to EdmMultiplicity.");
+ }
+ }
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 bf43580..737b5e2 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
@@ -26,9 +26,9 @@ 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.EdmNavigationProperty.Multiplicity;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmType;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
/**
*
@@ -44,7 +44,7 @@ public class Building {
@EdmProperty(name = "Image", type = EdmType.BINARY)
private byte[] image;
@EdmNavigationProperty(name = "nb_Rooms", toType = Room.class,
- association = "BuildingRooms", toMultiplicity = EdmMultiplicity.MANY)
+ association = "BuildingRooms", toMultiplicity = Multiplicity.MANY)
private List<Room> rooms = new ArrayList<Room>();
public Building() {}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 7785d3c..e3edbd0 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
@@ -24,7 +24,7 @@ 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.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
/**
*
@@ -34,7 +34,7 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
public class Manager extends Employee {
@EdmNavigationProperty(name = "nm_Employees", association = "ManagerEmployees",
- toMultiplicity = EdmMultiplicity.MANY)
+ toMultiplicity = Multiplicity.MANY)
private List<Employee> employees = new ArrayList<Employee>();
public Manager(final String id, final String name) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 23ad181..e9b296f 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
@@ -24,9 +24,9 @@ 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.EdmNavigationProperty.Multiplicity;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmType;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
/**
*
@@ -36,7 +36,7 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
public class Team extends RefBase {
@EdmProperty(type = EdmType.BOOLEAN)
private Boolean isScrumTeam;
- @EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees", toMultiplicity = EdmMultiplicity.MANY)
+ @EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees", toMultiplicity = Multiplicity.MANY)
private List<Employee> employees = new ArrayList<Employee>();
public Team() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 503ccfd..668ac86 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
@@ -26,9 +26,9 @@ 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.EdmNavigationProperty.Multiplicity;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmType;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
/**
*
@@ -44,7 +44,7 @@ public class Building {
@EdmProperty(name = "Image", type = EdmType.BINARY)
private byte[] image;
@EdmNavigationProperty(name = "nb_Rooms", toType = Room.class,
- association = "BuildingRooms", toMultiplicity = EdmMultiplicity.MANY)
+ association = "BuildingRooms", toMultiplicity = Multiplicity.MANY)
private List<Room> rooms = new ArrayList<Room>();
public String getId() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 93974ab..57e6d78 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
@@ -24,7 +24,7 @@ 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.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.annotation.edm.EdmNavigationProperty.Multiplicity;
/**
*
@@ -34,7 +34,7 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
public class Manager extends Employee {
@EdmNavigationProperty(name = "nm_Employees", association = "ManagerEmployees",
- toMultiplicity = EdmMultiplicity.MANY)
+ toMultiplicity = Multiplicity.MANY)
private List<Employee> employees = new ArrayList<Employee>();
public List<Employee> getEmployees() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 8320c54..50d2ad2 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
@@ -24,9 +24,9 @@ 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.EdmNavigationProperty.Multiplicity;
import org.apache.olingo.odata2.api.annotation.edm.EdmProperty;
import org.apache.olingo.odata2.api.annotation.edm.EdmType;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
/**
*
@@ -36,7 +36,7 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
public class Team extends RefBase {
@EdmProperty(type = EdmType.BOOLEAN)
private Boolean isScrumTeam;
- @EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees", toMultiplicity = EdmMultiplicity.MANY)
+ @EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees", toMultiplicity = Multiplicity.MANY)
private List<Employee> employees = new ArrayList<Employee>();
public Boolean isScrumTeam() {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/odata2-lib/odata-annotation/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-annotation/pom.xml b/odata2-lib/odata-annotation/pom.xml
index 689e49e..c943ee1 100644
--- a/odata2-lib/odata-annotation/pom.xml
+++ b/odata2-lib/odata-annotation/pom.xml
@@ -23,12 +23,4 @@
<artifactId>olingo-odata2-api-annotation-incubating</artifactId>
<name>${project.artifactId}</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-odata2-api-incubating</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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
index dca3d44..3301166 100644
--- 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
@@ -24,9 +24,9 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * <p>Annotation for definition of an {@link EdmFunctionImportParameter} for an {@link EdmFunctionImport}
- * which contains the {@link EdmFunctionImportParameter} as a parameter.</p>
- * The EdmProperty annotation has to be used on a parameter within a {@link EdmFunctionImport} annotated method.
+ * <p>Annotation for definition of an EdmFunctionImportParameter for an EdmFunctionImport
+ * which contains the EdmFunctionImportParameter as a parameter.</p>
+ * The EdmProperty annotation has to be used on a parameter within a EdmFunctionImport annotated method.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/e19384d6/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 c193e13..168784c 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
@@ -23,8 +23,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
-
/**
* <p>Annotation for definition of an EdmNavigationProperty for an EdmEntityType
* which contains the navigation property as a field.</p>
@@ -34,6 +32,22 @@ import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
@Target(ElementType.FIELD)
public @interface EdmNavigationProperty {
/**
+ * <p>EdmMultiplicity indicates the number of entity type instances
+ * an association end can relate to:
+ * <dl>
+ * <dt>0..1</dt><dd>one or none</dd>
+ * <dt> 1</dt><dd>exactly one</dd>
+ * <dt> *</dt><dd>many</dd>
+ * </dl>
+ * </p>
+ *
+ */
+ public enum Multiplicity {
+ ZERO_TO_ONE, ONE, MANY;
+ }
+
+
+ /**
* Define the name for the Navigation Property.
* If not set a default value has to be generated by the EDM provider.
*
@@ -72,5 +86,5 @@ public @interface EdmNavigationProperty {
*
* @return multiplicity to the target EdmEntity of the Navigation Property.
*/
- EdmMultiplicity toMultiplicity() default EdmMultiplicity.ONE;
+ Multiplicity toMultiplicity() default Multiplicity.ONE;
}
\ No newline at end of file