Repository: olingo-odata2 Updated Branches: refs/heads/master f71f456e4 -> 91bd4b897
[OLINGO-1244]Annotation edm provider ignoring facets set on complex types Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/91bd4b89 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/91bd4b89 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/91bd4b89 Branch: refs/heads/master Commit: 91bd4b897683f69b6f877a2ea630af4c2dde46e2 Parents: f71f456 Author: ramya vasanth <ramya.vasa...@sap.com> Authored: Wed Mar 21 13:25:33 2018 +0530 Committer: ramya vasanth <ramya.vasa...@sap.com> Committed: Wed Mar 21 13:25:33 2018 +0530 ---------------------------------------------------------------------- .../annotation/processor/core/edm/AnnotationEdmProvider.java | 6 ++++-- .../processor/core/edm/AnnotationEdmProviderTest.java | 1 + .../odata2/annotation/processor/core/model/Employee.java | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/91bd4b89/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java ---------------------------------------------------------------------- diff --git a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java index 3ccf6e4..bd0123b 100644 --- a/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java +++ b/odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProvider.java @@ -468,7 +468,7 @@ public class AnnotationEdmProvider extends EdmProvider { private Property createProperty(final EdmProperty ep, final Field field) { if (isAnnotatedEntity(field.getType())) { - return createComplexProperty(field); + return createComplexProperty(ep, field); } else { return createSimpleProperty(ep, field); } @@ -505,7 +505,7 @@ public class AnnotationEdmProvider extends EdmProvider { return resultFacets; } - private Property createComplexProperty(final Field field) { + private Property createComplexProperty(EdmProperty ep, final Field field) { ComplexProperty cp = new ComplexProperty(); // settings from property String entityName = ANNOTATION_HELPER.getPropertyName(field); @@ -515,6 +515,8 @@ public class AnnotationEdmProvider extends EdmProvider { FullQualifiedName fqn = ANNOTATION_HELPER.extractComplexTypeFqn(field.getType()); cp.setType(fqn); + cp.setFacets(createFacets(ep.facets(), field.getAnnotation(EdmConcurrencyControl.class))); + return cp; } http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/91bd4b89/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java ---------------------------------------------------------------------- diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java index 778d349..f77a6f8 100644 --- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java +++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/edm/AnnotationEdmProviderTest.java @@ -453,6 +453,7 @@ public class AnnotationEdmProviderTest { new FullQualifiedName(ModelSharedConstants.NAMESPACE_1, "c_Location")); assertEquals("c_Location", locationType.getName()); assertEquals(2, locationType.getProperties().size()); + assertEquals(false, location.getFacets().isNullable()); } @Test http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/91bd4b89/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Employee.java ---------------------------------------------------------------------- diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Employee.java b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Employee.java index ce709d7..3509b1b 100644 --- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Employee.java +++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/model/Employee.java @@ -58,7 +58,7 @@ public class Employee { private String imageUrl; @EdmProperty(name = "EntryDate", type = EdmType.DATE_TIME) private Calendar entryDate; - @EdmProperty(name = "Location") + @EdmProperty(name = "Location", facets = @EdmFacets(nullable = false)) private Location location; public Employee(final String employeeId, final String name) {