Repository: olingo-odata2
Updated Branches:
  refs/heads/master e403c5595 -> 9d06c3228


[OLINGO-970] Check for Complex Type value

Signed-off-by: mibo <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/9d06c322
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/9d06c322
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/9d06c322

Branch: refs/heads/master
Commit: 9d06c3228bd483a281392f56632bb767ff53c514
Parents: e403c55
Author: Shankara G <[email protected]>
Authored: Tue Jun 14 10:01:14 2016 +0530
Committer: mibo <[email protected]>
Committed: Mon Jan 16 19:59:45 2017 +0100

----------------------------------------------------------------------
 .../processor/core/access/data/JPAEntity.java   | 37 +++++++++++---------
 1 file changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9d06c322/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
----------------------------------------------------------------------
diff --git 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
index bda0a1b..10a6f54 100644
--- 
a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
+++ 
b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/access/data/JPAEntity.java
@@ -443,24 +443,27 @@ public class JPAEntity {
             JPAEntityParser.ACCESS_MODIFIER_SET);
 
     for (String edmPropertyName : edmComplexType.getPropertyNames()) {
-      EdmTyped edmTyped = (EdmTyped) 
edmComplexType.getProperty(edmPropertyName);
-      accessModifier = accessModifiers.get(edmPropertyName);
-      if 
(edmTyped.getType().getKind().toString().equals(EdmTypeKind.COMPLEX.toString()))
 {
-        EdmStructuralType structualType = (EdmStructuralType) 
edmTyped.getType();
-        if (propertyName != null) {
-          setComplexProperty(accessModifier, embeddableObject, structualType,
-              (HashMap<String, Object>) propertyValue.get(edmPropertyName), 
propertyName);
-        } else {
-          setComplexProperty(accessModifier, embeddableObject, structualType,
-              (HashMap<String, Object>) propertyValue.get(edmPropertyName));
-        }
-      } else {
-        if (propertyName != null) {
-          setProperty(accessModifier, embeddableObject, 
propertyValue.get(edmPropertyName),
-              (EdmSimpleType) edmTyped.getType(), edmPropertyName);
+      if (propertyValue != null) {
+        EdmTyped edmTyped = (EdmTyped) 
edmComplexType.getProperty(edmPropertyName);
+        accessModifier = accessModifiers.get(edmPropertyName);
+        if 
(edmTyped.getType().getKind().toString().equals(EdmTypeKind.COMPLEX.toString()))
 {
+          EdmStructuralType structualType = (EdmStructuralType) 
edmTyped.getType();
+          if (propertyName != null) {
+            setComplexProperty(accessModifier, embeddableObject, structualType,
+                (HashMap<String, Object>) propertyValue.get(edmPropertyName), 
propertyName);
+          } else {
+            setComplexProperty(accessModifier, embeddableObject, structualType,
+                (HashMap<String, Object>) propertyValue.get(edmPropertyName));
+          }
         } else {
-          setProperty(accessModifier, embeddableObject, 
propertyValue.get(edmPropertyName),
-              (EdmSimpleType) edmTyped.getType());
+          EdmSimpleType simpleType = (EdmSimpleType) edmTyped.getType();
+                 if (propertyName != null) {
+            setProperty(accessModifier, embeddableObject, 
propertyValue.get(edmPropertyName),
+                simpleType, edmPropertyName);
+          } else {
+            setProperty(accessModifier, embeddableObject, 
propertyValue.get(edmPropertyName),
+                simpleType);
+          }
         }
       }
     }

Reply via email to