olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chri...@apache.org
Subject [1/3] olingo-odata4 git commit: [OLINGO-575] Start merging ComplexValue and LinkedComplexValue
Date Wed, 04 Mar 2015 16:14:36 GMT
Repository: olingo-odata4
Updated Branches:
  refs/heads/master 033f35d61 -> 0d57a0763


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
index 0258edc..77d0ded 100755
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
@@ -33,7 +33,7 @@ import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Valuable;
@@ -51,7 +51,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
 import org.apache.olingo.commons.core.data.AnnotationImpl;
 import org.apache.olingo.commons.core.data.EntitySetImpl;
 import org.apache.olingo.commons.core.data.LinkImpl;
-import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
+import org.apache.olingo.commons.core.data.ComplexValueImpl;
 import org.apache.olingo.commons.core.data.PropertyImpl;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
@@ -146,7 +146,7 @@ public class JsonDeserializer implements ODataDeserializer {
   }
 
   protected String setInline(final String name, final String suffix, final JsonNode tree,
-          final ObjectCodec codec, final LinkImpl link) throws IOException {
+      final ObjectCodec codec, final LinkImpl link) throws IOException {
 
     final String entityNamePrefix = name.substring(0, name.indexOf(suffix));
     if (tree.has(entityNamePrefix)) {
@@ -172,7 +172,7 @@ public class JsonDeserializer implements ODataDeserializer {
   }
 
   protected void links(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
-          final JsonNode tree, final ObjectCodec codec) throws IOException {
+      final JsonNode tree, final ObjectCodec codec) throws IOException {
     if (serverMode) {
       serverLinks(field, linked, toRemove, tree, codec);
     } else {
@@ -181,7 +181,7 @@ public class JsonDeserializer implements ODataDeserializer {
   }
 
   private void clientLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
-          final JsonNode tree, final ObjectCodec codec) throws IOException {
+      final JsonNode tree, final ObjectCodec codec) throws IOException {
 
     if (field.getKey().endsWith(jsonNavigationLink)) {
       final LinkImpl link = new LinkImpl();
@@ -210,10 +210,10 @@ public class JsonDeserializer implements ODataDeserializer {
   }
 
   private void serverLinks(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
-          final JsonNode tree, final ObjectCodec codec) throws IOException {
+      final JsonNode tree, final ObjectCodec codec) throws IOException {
 
     if (field.getKey().endsWith(Constants.JSON_BIND_LINK_SUFFIX)
-            || field.getKey().endsWith(jsonNavigationLink)) {
+        || field.getKey().endsWith(jsonNavigationLink)) {
 
       if (field.getValue().isValueNode()) {
         final String suffix = field.getKey().replaceAll("^.*@", "@");
@@ -272,19 +272,19 @@ public class JsonDeserializer implements ODataDeserializer {
   }
 
   private EdmPrimitiveTypeKind guessPrimitiveTypeKind(final JsonNode node) {
-    return node.isShort()      ? EdmPrimitiveTypeKind.Int16   :
-           node.isInt()        ? EdmPrimitiveTypeKind.Int32   :
-           node.isLong()       ? EdmPrimitiveTypeKind.Int64   :
-           node.isBoolean()    ? EdmPrimitiveTypeKind.Boolean :
-           node.isFloat()      ? EdmPrimitiveTypeKind.Single  :
-           node.isDouble()     ? EdmPrimitiveTypeKind.Double  :
-           node.isBigDecimal() ? EdmPrimitiveTypeKind.Decimal :
-                                 EdmPrimitiveTypeKind.String;
+    return node.isShort() ? EdmPrimitiveTypeKind.Int16 :
+        node.isInt() ? EdmPrimitiveTypeKind.Int32 :
+            node.isLong() ? EdmPrimitiveTypeKind.Int64 :
+                node.isBoolean() ? EdmPrimitiveTypeKind.Boolean :
+                    node.isFloat() ? EdmPrimitiveTypeKind.Single :
+                        node.isDouble() ? EdmPrimitiveTypeKind.Double :
+                            node.isBigDecimal() ? EdmPrimitiveTypeKind.Decimal :
+                                EdmPrimitiveTypeKind.String;
   }
 
   protected void populate(final Annotatable annotatable, final List<Property> properties,
-          final ObjectNode tree, final ObjectCodec codec)
-          throws IOException, EdmPrimitiveTypeException {
+      final ObjectNode tree, final ObjectCodec codec)
+      throws IOException, EdmPrimitiveTypeException {
 
     String type = null;
     Annotation annotation = null;
@@ -310,8 +310,8 @@ public class JsonDeserializer implements ODataDeserializer {
         final PropertyImpl property = new PropertyImpl();
         property.setName(field.getKey());
         property.setType(type == null
-                ? null
-                : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
+            ? null
+            : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
         type = null;
 
         value(property, field.getValue(), codec);
@@ -327,45 +327,39 @@ public class JsonDeserializer implements ODataDeserializer {
 
   private Object fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) throws EdmPrimitiveTypeException {
     return node.isNull() ? null
-            : typeInfo == null ? node.asText()
+        : typeInfo == null ? node.asText()
             : typeInfo.getPrimitiveTypeKind().isGeospatial()
-            ? getGeoDeserializer().deserialize(node, typeInfo)
-            : ((EdmPrimitiveType) typeInfo.getType())
-            .valueOfString(node.asText(), true, null,
-                    Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, true,
-                    ((EdmPrimitiveType) typeInfo.getType()).getDefaultType());
+                ? getGeoDeserializer().deserialize(node, typeInfo)
+                : ((EdmPrimitiveType) typeInfo.getType())
+                    .valueOfString(node.asText(), true, null,
+                        Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, true,
+                        ((EdmPrimitiveType) typeInfo.getType()).getDefaultType());
   }
 
   private Object fromComplex(final ObjectNode node, final ObjectCodec codec)
-          throws IOException, EdmPrimitiveTypeException {
+      throws IOException, EdmPrimitiveTypeException {
 
-    if (version.compareTo(ODataServiceVersion.V40) < 0) {
-      final List<Property> properties = new ArrayList<Property>();
-      populate(null, properties, node, codec);
-      return properties;
-    } else {
-      final LinkedComplexValue linkComplexValue = new LinkedComplexValueImpl();
-      final Set<String> toRemove = new HashSet<String>();
-      for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
-        final Map.Entry<String, JsonNode> field = itor.next();
-
-        links(field, linkComplexValue, toRemove, node, codec);
-      }
-      node.remove(toRemove);
+    final ComplexValue complexValue = new ComplexValueImpl();
+    final Set<String> toRemove = new HashSet<String>();
+    for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+      final Map.Entry<String, JsonNode> field = itor.next();
 
-      populate(linkComplexValue, linkComplexValue.getValue(), node, codec);
-      return linkComplexValue;
+      links(field, complexValue, toRemove, node, codec);
     }
+    node.remove(toRemove);
+
+    populate(complexValue, complexValue.getValue(), node, codec);
+    return complexValue;
   }
 
   private void fromCollection(final Valuable valuable, final Iterator<JsonNode> nodeItor, final EdmTypeInfo typeInfo,
-          final ObjectCodec codec) throws IOException, EdmPrimitiveTypeException {
+      final ObjectCodec codec) throws IOException, EdmPrimitiveTypeException {
 
     final List<Object> values = new ArrayList<Object>();
     ValueType valueType = ValueType.COLLECTION_PRIMITIVE;
 
     final EdmTypeInfo type = typeInfo == null ? null
-            : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
+        : new EdmTypeInfo.Builder().setTypeExpression(typeInfo.getFullQualifiedName().toString()).build();
 
     while (nodeItor.hasNext()) {
       final JsonNode child = nodeItor.next();
@@ -384,8 +378,7 @@ public class JsonDeserializer implements ODataDeserializer {
           ((ObjectNode) child).remove(jsonType);
         }
         final Object value = fromComplex((ObjectNode) child, codec);
-        valueType = value instanceof LinkedComplexValue ? ValueType.COLLECTION_LINKED_COMPLEX
-                : ValueType.COLLECTION_COMPLEX;
+        valueType = ValueType.COLLECTION_COMPLEX;
         values.add(value);
       }
     }
@@ -393,10 +386,10 @@ public class JsonDeserializer implements ODataDeserializer {
   }
 
   protected void value(final Valuable valuable, final JsonNode node, final ObjectCodec codec)
-          throws IOException, EdmPrimitiveTypeException {
-    
+      throws IOException, EdmPrimitiveTypeException {
+
     EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType()) ? null
-            : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build();
+        : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build();
 
     final Map.Entry<ODataPropertyType, EdmTypeInfo> guessed = guessPropertyType(node);
     if (typeInfo == null) {
@@ -404,40 +397,40 @@ public class JsonDeserializer implements ODataDeserializer {
     }
 
     final ODataPropertyType propType = typeInfo == null ? guessed.getKey()
-            : typeInfo.isCollection() ? ODataPropertyType.COLLECTION
+        : typeInfo.isCollection() ? ODataPropertyType.COLLECTION
             : typeInfo.isPrimitiveType() ? ODataPropertyType.PRIMITIVE
-            : node.isValueNode() ? ODataPropertyType.ENUM : ODataPropertyType.COMPLEX;
+                : node.isValueNode() ? ODataPropertyType.ENUM : ODataPropertyType.COMPLEX;
 
     switch (propType) {
-      case COLLECTION:
-        fromCollection(valuable, node.elements(), typeInfo, codec);
-        break;
-
-      case COMPLEX:
-        if (node.has(jsonType)) {
-          valuable.setType(node.get(jsonType).asText());
-          ((ObjectNode) node).remove(jsonType);
-        }
-        final Object value = fromComplex((ObjectNode) node, codec);
-        valuable.setValue(value instanceof LinkedComplexValue ? ValueType.LINKED_COMPLEX : ValueType.COMPLEX, value);
-        break;
+    case COLLECTION:
+      fromCollection(valuable, node.elements(), typeInfo, codec);
+      break;
+
+    case COMPLEX:
+      if (node.has(jsonType)) {
+        valuable.setType(node.get(jsonType).asText());
+        ((ObjectNode) node).remove(jsonType);
+      }
+      final Object value = fromComplex((ObjectNode) node, codec);
+      valuable.setValue(ValueType.COMPLEX, value);
+      break;
 
-      case ENUM:
-        valuable.setValue(ValueType.ENUM, node.asText());
-        break;
+    case ENUM:
+      valuable.setValue(ValueType.ENUM, node.asText());
+      break;
 
-      case PRIMITIVE:
-        if (valuable.getType() == null && typeInfo != null) {
-          valuable.setType(typeInfo.getFullQualifiedName().toString());
-        }
-        final Object primitiveValue = fromPrimitive(node, typeInfo);
-        valuable.setValue(primitiveValue instanceof Geospatial ? ValueType.GEOSPATIAL : ValueType.PRIMITIVE,
-                primitiveValue);
-        break;
-
-      case EMPTY:
-      default:
-        valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY);
+    case PRIMITIVE:
+      if (valuable.getType() == null && typeInfo != null) {
+        valuable.setType(typeInfo.getFullQualifiedName().toString());
+      }
+      final Object primitiveValue = fromPrimitive(node, typeInfo);
+      valuable.setValue(primitiveValue instanceof Geospatial ? ValueType.GEOSPATIAL : ValueType.PRIMITIVE,
+          primitiveValue);
+      break;
+
+    case EMPTY:
+    default:
+      valuable.setValue(ValueType.PRIMITIVE, StringUtils.EMPTY);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
index 5b00a6a..14407a0 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
@@ -80,12 +80,12 @@ public class JsonPropertySerializer extends JsonSerializer {
       jgen.writeStringField(Constants.VALUE, property.asEnum().toString());
     } else if (property.isGeospatial() || property.isCollection()) {
       valuable(jgen, property, Constants.VALUE);
-    } else if (property.isLinkedComplex()) {
-      for (Property cproperty : property.asLinkedComplex().getValue()) {
+    } else if (property.isComplex()) {
+      for (Property cproperty : property.asComplex().getValue()) {
         valuable(jgen, cproperty, cproperty.getName());
       }
     } else if (property.isComplex()) {
-      for (Property cproperty : property.asComplex()) {
+      for (Property cproperty : property.asComplex().getValue()) {
         valuable(jgen, cproperty, cproperty.getName());
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
index 3db0ea9..6a50ad3 100755
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
@@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Valuable;
@@ -280,13 +280,7 @@ public class JsonSerializer implements ODataSerializer {
           break;
 
         case COLLECTION_COMPLEX:
-          @SuppressWarnings("unchecked")
-          final List<Property> complexItem = (List<Property>) item;
-          complexValue(jgen, itemTypeInfo, complexItem, null);
-          break;
-
-        case COLLECTION_LINKED_COMPLEX:
-          final LinkedComplexValue complexItem2 = (LinkedComplexValue) item;
+          final ComplexValue complexItem2 = (ComplexValue) item;
           complexValue(jgen, itemTypeInfo, complexItem2.getValue(), complexItem2);
           break;
 
@@ -357,10 +351,8 @@ public class JsonSerializer implements ODataSerializer {
       jgen.writeEndObject();
     } else if (value.isCollection()) {
       collection(jgen, typeInfo, value.getValueType(), value.asCollection());
-    } else if (value.isLinkedComplex()) {
-      complexValue(jgen, typeInfo, value.asLinkedComplex().getValue(), value.asLinkedComplex());
     } else if (value.isComplex()) {
-      complexValue(jgen, typeInfo, value.asComplex(), null);
+      complexValue(jgen, typeInfo, value.asComplex().getValue(), value.asComplex());
     }
   }
 
@@ -368,7 +360,7 @@ public class JsonSerializer implements ODataSerializer {
           throws IOException, EdmPrimitiveTypeException {
 
     if (!Constants.VALUE.equals(name) && !(valuable instanceof Annotation)
-            && !valuable.isComplex() && !valuable.isLinkedComplex()) {
+            && !valuable.isComplex() && !valuable.isComplex()) {
 
       String type = valuable.getType();
       if (StringUtils.isBlank(type) && valuable.isPrimitive() || valuable.isNull()) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
index c12fb27..bf03065 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.Link;
@@ -43,6 +44,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.data.ComplexValueImpl;
 import org.apache.olingo.commons.core.data.EntityImpl;
 import org.apache.olingo.commons.core.data.EntitySetImpl;
 import org.apache.olingo.commons.core.data.LinkImpl;
@@ -357,7 +359,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
   private Object readComplexNode(final EdmProperty edmProperty, final JsonNode jsonNode)
       throws DeserializerException {
     // read and add all complex properties
-    Object value = readComplexValue(edmProperty, jsonNode);
+    ComplexValue value = readComplexValue(edmProperty, jsonNode);
 
     final List<String> toRemove = new ArrayList<String>();
     Iterator<Entry<String, JsonNode>> fieldsIterator = jsonNode.fields();
@@ -430,7 +432,8 @@ public class ODataJsonDeserializer implements ODataDeserializer {
     }
   }
 
-  private Object readComplexValue(EdmProperty edmComplexProperty, JsonNode jsonNode) throws DeserializerException {
+  private ComplexValue readComplexValue(EdmProperty edmComplexProperty, JsonNode jsonNode)
+      throws DeserializerException {
     if (isValidNull(edmComplexProperty, jsonNode)) {
       return null;
     }
@@ -440,7 +443,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
           DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmComplexProperty.getName());
     }
     // Even if there are no properties defined we have to give back an empty list
-    List<Property> propertyList = new ArrayList<Property>();
+    ComplexValueImpl complexValue = new ComplexValueImpl();
     EdmComplexType edmType = (EdmComplexType) edmComplexProperty.getType();
     // Check and consume all Properties
     for (String propertyName : edmType.getPropertyNames()) {
@@ -452,11 +455,11 @@ public class ODataJsonDeserializer implements ODataDeserializer {
               DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, propertyName);
         }
         Property property = consumePropertyNode(edmProperty, subNode);
-        propertyList.add(property);
+        complexValue.getValue().add(property);
         ((ObjectNode) jsonNode).remove(propertyName);
       }
     }
-    return propertyList;
+    return complexValue;
   }
 
   private boolean isNullable(EdmProperty edmProperty) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
index 6067312..e7a9cfb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
@@ -25,12 +25,12 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.ContextURL;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmComplexType;
@@ -47,10 +47,10 @@ import org.apache.olingo.server.api.ODataServerError;
 import org.apache.olingo.server.api.ServiceMetadata;
 import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
 import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
+import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
 import org.apache.olingo.server.api.serializer.ODataSerializer;
 import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
 import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
 import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
 import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
 import org.apache.olingo.server.api.uri.queryoption.SelectOption;
@@ -318,11 +318,9 @@ public class ODataJsonSerializer implements ODataSerializer {
         }
       } else if (edmProperty.isCollection()) {
         writeComplexCollection((EdmComplexType) edmProperty.getType(), property, selectedPaths, json);
-      } else if (property.isLinkedComplex()) {
-        writeComplexValue((EdmComplexType) edmProperty.getType(), property.asLinkedComplex().getValue(),
-            selectedPaths, json);
       } else if (property.isComplex()) {
-        writeComplexValue((EdmComplexType) edmProperty.getType(), property.asComplex(), selectedPaths, json);
+        writeComplexValue((EdmComplexType) edmProperty.getType(), property.asComplex().getValue(),
+            selectedPaths, json);
       } else {
         throw new SerializerException("Property type not yet supported!",
             SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, edmProperty.getName());
@@ -364,11 +362,8 @@ public class ODataJsonSerializer implements ODataSerializer {
     json.writeStartArray();
     for (Object value : property.asCollection()) {
       switch (property.getValueType()) {
-      case COLLECTION_LINKED_COMPLEX:
-        writeComplexValue(type, ((LinkedComplexValue) value).getValue(), selectedPaths, json);
-        break;
       case COLLECTION_COMPLEX:
-        writeComplexValue(type, ((Property) value).asComplex(), selectedPaths, json);
+        writeComplexValue(type, ((ComplexValue) value).getValue(), selectedPaths, json);
         break;
       default:
         throw new SerializerException("Property type not yet supported!",
@@ -487,11 +482,11 @@ public class ODataJsonSerializer implements ODataSerializer {
       if (contextURL != null) {
         json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
       }
-      final List<Property> values = property.isNull() ? Collections.<Property> emptyList() :
-          property.isComplex() ? property.asComplex() : property.asLinkedComplex().getValue();
+      final List<Property> values =
+          property.isNull() ? Collections.<Property> emptyList() : property.asComplex().getValue();
       writeProperties(type, values, options == null ? null : options.getSelect(), json);
-      if (!property.isNull() && property.isLinkedComplex()) {
-        writeNavigationProperties(type, property.asLinkedComplex(),
+      if (!property.isNull() && property.isComplex()) {
+        writeNavigationProperties(type, property.asComplex(),
             options == null ? null : options.getExpand(), json);
       }
       json.writeEndObject();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
index da7cb08..742c5d5 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
@@ -28,10 +28,12 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.ContextURL;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ValueType;
 import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.core.data.ComplexValueImpl;
 import org.apache.olingo.commons.core.data.PropertyImpl;
 import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
 import org.junit.Test;
@@ -39,9 +41,9 @@ import org.junit.Test;
 public class ODataJsonSerializerTest {
   @Test
   public void testCollectionComplex() throws ODataException, IOException {
-    final List<Property> col = new ArrayList<Property>();
-    col.add(new PropertyImpl(null, "ComplexOne", ValueType.COMPLEX, getValues(1)));
-    col.add(new PropertyImpl(null, "ComplexTwo", ValueType.COMPLEX, getValues(2)));
+    final List<ComplexValue> col = new ArrayList<ComplexValue>();
+    col.add(getValues(1));
+    col.add(getValues(2));
     final Property complexCollection = new PropertyImpl(null, "ComplexCol", ValueType.COLLECTION_COMPLEX, col);
     
     final ODataJsonSerializer serializer = new ODataJsonSerializer(ODataFormat.APPLICATION_JSON);
@@ -60,12 +62,10 @@ public class ODataJsonSerializerTest {
 
   }
 
-  private List<Property> getValues(int i) {
-    final List<Property> values = new ArrayList<Property>();
-
-    values.add(new PropertyImpl(null, "prop1", ValueType.PRIMITIVE, "test" + i));
-    values.add(new PropertyImpl(null, "prop2", ValueType.PRIMITIVE, "test" + i + i));
-
-    return values;
+  private ComplexValue getValues(int i) {
+    ComplexValue value = new ComplexValueImpl();
+    value.getValue().add(new PropertyImpl(null, "prop1", ValueType.PRIMITIVE, "test" + i));
+    value.getValue().add(new PropertyImpl(null, "prop2", ValueType.PRIMITIVE, "test" + i + i));
+    return value;
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
index e56093b..d2e7a91 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java
@@ -32,13 +32,13 @@ import java.util.UUID;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ValueType;
 import org.apache.olingo.commons.core.data.EntityImpl;
 import org.apache.olingo.commons.core.data.EntitySetImpl;
 import org.apache.olingo.commons.core.data.LinkImpl;
-import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
+import org.apache.olingo.commons.core.data.ComplexValueImpl;
 import org.apache.olingo.commons.core.data.PropertyImpl;
 
 public class DataCreator {
@@ -97,10 +97,10 @@ public class DataCreator {
   
   private Entity createETKeyNavEntity(int propertyInt16, String propertyString) {
     // PropertyCompAllPrim
-    LinkedComplexValue cvCompAllPrim = createKeyNavAllPrimComplexValue();
+    ComplexValue cvCompAllPrim = createKeyNavAllPrimComplexValue();
     
     // CollPropertyComp
-    List<LinkedComplexValue> ccComp = new ArrayList<LinkedComplexValue>();
+    List<ComplexValue> ccComp = new ArrayList<ComplexValue>();
     ccComp.add(createCTPrimCompValue(1));
     ccComp.add(createCTPrimCompValue(2));
     ccComp.add(createCTPrimCompValue(3));
@@ -110,7 +110,7 @@ public class DataCreator {
       .addProperty(createPrimitive("PropertyString", propertyString))
       .addProperty(createComplex("PropertyComp", 
           createPrimitive("PropertyInt16", 1)))
-      .addProperty(new PropertyImpl(null, "PropertyCompAllPrim", ValueType.LINKED_COMPLEX,  cvCompAllPrim))
+      .addProperty(new PropertyImpl(null, "PropertyCompAllPrim", ValueType.COMPLEX,  cvCompAllPrim))
       .addProperty(createComplex("PropertyCompTwoPrim", 
           createPrimitive("PropertyInt16", 16), 
           createPrimitive("PropertyString", "Test123")))
@@ -119,18 +119,18 @@ public class DataCreator {
           "Employee2@company.example", 
           "Employee3@company.example"))
       .addProperty(createPrimitiveCollection("CollPropertyInt16", 1000, 2000, 30112))
-      .addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_LINKED_COMPLEX, ccComp))
+      .addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_COMPLEX, ccComp))
       .addProperty(createComplex("PropertyCompComp", 
           createPrimitive("PropertyString", "1"),
           createComplex("PropertyComp", createPrimitive("PropertyInt16", 1))));
   }
   
-  private LinkedComplexValue createCTPrimCompValue(int properyInt16) {
-    final LinkedComplexValue cvBasePrimCompNav = new LinkedComplexValueImpl();
-    final LinkedComplexValue cvAllPrim =  createKeyNavAllPrimComplexValue();
+  private ComplexValue createCTPrimCompValue(int properyInt16) {
+    final ComplexValue cvBasePrimCompNav = new ComplexValueImpl();
+    final ComplexValue cvAllPrim =  createKeyNavAllPrimComplexValue();
     
     cvBasePrimCompNav.getValue().add(createPrimitive("PropertyInt16", properyInt16));
-    cvBasePrimCompNav.getValue().add(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, cvAllPrim));
+    cvBasePrimCompNav.getValue().add(new PropertyImpl(null, "PropertyComp", ValueType.COMPLEX, cvAllPrim));
     
     return cvBasePrimCompNav;
   }
@@ -171,9 +171,9 @@ public class DataCreator {
               createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))
           )
        ))
-      .addProperty(new PropertyImpl(null, "PropertyCompNav", ValueType.LINKED_COMPLEX, createCTPrimCompValue(1)))
-      .addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_LINKED_COMPLEX, 
-          new ArrayList<LinkedComplexValue>()))
+      .addProperty(new PropertyImpl(null, "PropertyCompNav", ValueType.COMPLEX, createCTPrimCompValue(1)))
+      .addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_COMPLEX, 
+          new ArrayList<ComplexValue>()))
       .addProperty(createComplexCollection("CollPropertyCompNav", 
           Arrays.asList(createPrimitive("PropertyInt16", 1))))
       .addProperty(createPrimitiveCollection("CollPropertyString", 1, 2))
@@ -183,9 +183,9 @@ public class DataCreator {
       ));
   }
 
-  private LinkedComplexValue createKeyNavAllPrimComplexValue() {
-    LinkedComplexValue cvAllPrim;
-    cvAllPrim = new LinkedComplexValueImpl();
+  private ComplexValue createKeyNavAllPrimComplexValue() {
+    ComplexValue cvAllPrim;
+    cvAllPrim = new ComplexValueImpl();
     cvAllPrim.getValue().add(createPrimitive("PropertyString", "First Resource - positive values"));
     cvAllPrim.getValue().add(createPrimitive("PropertyBinary", new byte[] { 1, 35, 69, 103, -119, -85, -51, -17 } ));
     cvAllPrim.getValue().add(createPrimitive("PropertyBoolean", true));
@@ -677,21 +677,21 @@ public class DataCreator {
   }
 
   protected static Property createComplex(final String name, final Property... properties) {
-    LinkedComplexValue complexValue = new LinkedComplexValueImpl();
+    ComplexValue complexValue = new ComplexValueImpl();
     for (final Property property : properties) {
       complexValue.getValue().add(property);
     }
-    return new PropertyImpl(null, name, ValueType.LINKED_COMPLEX, complexValue);
+    return new PropertyImpl(null, name, ValueType.COMPLEX, complexValue);
   }
 
   protected static Property createComplexCollection(final String name, final List<Property>... propertiesList) {
-    List<LinkedComplexValue> complexCollection = new ArrayList<LinkedComplexValue>();
+    List<ComplexValue> complexCollection = new ArrayList<ComplexValue>();
     for (final List<Property> properties : propertiesList) {
-      LinkedComplexValue complexValue = new LinkedComplexValueImpl();
+      ComplexValue complexValue = new ComplexValueImpl();
       complexValue.getValue().addAll(properties);
       complexCollection.add(complexValue);
     }
-    return new PropertyImpl(null, name, ValueType.COLLECTION_LINKED_COMPLEX, complexCollection);
+    return new PropertyImpl(null, name, ValueType.COLLECTION_COMPLEX, complexCollection);
   }
 
   private Calendar getDateTime(final int year, final int month, final int day,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
index b0bbd38..b28d263 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
@@ -244,7 +244,7 @@ public class DataProvider {
             newProperty = newProperty2;
           } else {
             newProperty = DataCreator.createComplex(propertyName);
-            createProperties((EdmComplexType) edmProperty.getType(), newProperty.asLinkedComplex().getValue());
+            createProperties((EdmComplexType) edmProperty.getType(), newProperty.asComplex().getValue());
           }
         }
         properties.add(newProperty);
@@ -282,7 +282,7 @@ public class DataProvider {
 
   private void applyNavigationBinding(final String rawBaseUri, final EdmEntitySet edmEntitySet,
       final Entity entity, final List<Link> navigationBindings) throws DataProviderException {
-    
+
     for (final Link link : navigationBindings) {
       final EdmNavigationProperty edmNavProperty = edmEntitySet.getEntityType().getNavigationProperty(link.getTitle());
       final EdmEntitySet edmTargetEntitySet =
@@ -308,11 +308,11 @@ public class DataProvider {
       final List<UriParameter> keys = odata.createUriHelper()
           .getKeyPredicatesFromEntityLink(edm, bindingLink, rawBaseUri);
       final Entity entity = read(edmEntitySetTarget, keys);
-      
-      if(entity == null) {
+
+      if (entity == null) {
         throw new DataProviderException("Entity " + bindingLink + " not found");
       }
-      
+
       return entity;
     } catch (DeserializerException e) {
       throw new DataProviderException("Invalid entity binding link", e);
@@ -383,7 +383,7 @@ public class DataProvider {
   // TODO Duplicated code in DataCreator
   private void setLink(final EdmNavigationProperty navigationProperty, final Entity srcEntity,
       final Entity destEntity) {
-    
+
     Link link = srcEntity.getNavigationLink(navigationProperty.getName());
     if (link == null) {
       link = new LinkImpl();
@@ -423,10 +423,12 @@ public class DataProvider {
     } else {
       final EdmComplexType type = (EdmComplexType) edmProperty.getType();
       for (final String propertyName : type.getPropertyNames()) {
-        final List<Property> newProperties = newProperty == null ? null :
-            newProperty.isComplex() ? newProperty.asComplex() : newProperty.asLinkedComplex().getValue();
+        List<Property> newProperties = null;
+        if(newProperty != null && newProperty.asComplex() != null){
+          newProperties = newProperty.asComplex().getValue();
+        }
         updateProperty(type.getStructuralProperty(propertyName),
-            findProperty(propertyName, property.asLinkedComplex().getValue()),
+            findProperty(propertyName, property.asComplex().getValue()),
             newProperties == null ? null : findProperty(propertyName, newProperties),
             patch);
       }
@@ -459,7 +461,7 @@ public class DataProvider {
   public void setOData(final OData odata) {
     this.odata = odata;
   }
-  
+
   public static class DataProviderException extends ODataApplicationException {
     private static final long serialVersionUID = 5098059649321796156L;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
index 596fe95..bf1ffb5 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
@@ -259,7 +259,7 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
   private void deleteProperty(final ODataResponse response, final UriInfo uriInfo) throws ODataApplicationException {
     final UriInfoResource resource = uriInfo.asUriInfoResource();
     validatePath(resource);
-    getEdmEntitySet(uriInfo);  // including checks
+    getEdmEntitySet(uriInfo); // including checks
 
     final List<UriResource> resourceParts = resource.getUriResourceParts();
     final List<String> path = getPropertyPath(resourceParts, 0);
@@ -281,9 +281,8 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
       throws ODataApplicationException {
     Property property = entity.getProperty(path.get(0));
     for (final String name : path.subList(1, path.size())) {
-      if (property != null && (property.isLinkedComplex() || property.isComplex())) {
-        final List<Property> complex = property.isLinkedComplex() ?
-            property.asLinkedComplex().getValue() : property.asComplex();
+      if (property != null && (property.isComplex() || property.isComplex())) {
+        final List<Property> complex = property.asComplex().getValue();
         property = null;
         for (final Property innerProperty : complex) {
           if (innerProperty.getName().equals(name)) {
@@ -320,7 +319,7 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
     final UriInfoResource resource = uriInfo.asUriInfoResource();
     validateOptions(resource);
     validatePath(resource);
-    getEdmEntitySet(uriInfo);  // including checks
+    getEdmEntitySet(uriInfo); // including checks
 
     final List<UriResource> resourceParts = resource.getUriResourceParts();
     final List<String> path = getPropertyPath(resourceParts, 1);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
index bebe1f8..b72cfec 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java
@@ -189,9 +189,8 @@ public class ExpressionVisitorImpl implements ExpressionVisitor<VisitorOperand>
     for (int i = 1; i < uriResourceParts.size(); i++) {
       currentType = ((UriResourcePartTyped) uriResourceParts.get(i)).getType();
 
-      if (currentProperty.isComplex() || currentProperty.isLinkedComplex()) {
-        final List<Property> complex = currentProperty.isLinkedComplex() ?
-            currentProperty.asLinkedComplex().getValue() : currentProperty.asComplex();
+      if (currentProperty.isComplex()) {
+        final List<Property> complex = currentProperty.asComplex().getValue();
 
         for (final Property innerProperty : complex) {
           if (innerProperty.getName().equals(uriResourceParts.get(i).toString())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
index 63d8550..76edb33 100644
--- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
+++ b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
@@ -24,7 +24,7 @@ import java.util.List;
 
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -125,8 +125,8 @@ public class DataProviderTest {
     Assert.assertEquals(3, outSet.getEntities().size());
     Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size());
     Property complex = outSet.getEntities().get(0).getProperties().get(1);
-    Assert.assertTrue(complex.isLinkedComplex());
-    Assert.assertEquals(16, complex.asLinkedComplex().getValue().size());
+    Assert.assertTrue(complex.isComplex());
+    Assert.assertEquals(16, complex.asComplex().getValue().size());
     Assert.assertEquals(2, outSet.getEntities().get(1).getProperties().size());
     Assert.assertEquals(2, outSet.getEntities().get(2).getProperties().size());
   }
@@ -138,13 +138,13 @@ public class DataProviderTest {
     Assert.assertEquals(3, outSet.getEntities().size());
     Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size());
     Property complex = outSet.getEntities().get(0).getProperties().get(2);
-    Assert.assertTrue(complex.isLinkedComplex());
-    Assert.assertEquals(2, complex.asLinkedComplex().getValue().size());
+    Assert.assertTrue(complex.isComplex());
+    Assert.assertEquals(2, complex.asComplex().getValue().size());
     Property complexCollection = outSet.getEntities().get(0).getProperties().get(3);
     Assert.assertTrue(complexCollection.isCollection());
     List<?> linkedComplexValues = complexCollection.asCollection();
     Assert.assertEquals(3, linkedComplexValues.size());
-    LinkedComplexValue linkedComplexValue = (LinkedComplexValue) linkedComplexValues.get(0);
+    ComplexValue linkedComplexValue = (ComplexValue) linkedComplexValues.get(0);
     Assert.assertEquals(2, linkedComplexValue.getValue().size());
     Property lcProp = linkedComplexValue.getValue().get(0);
     Assert.assertFalse(lcProp.isCollection());

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/0d57a076/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
index ff54e1e..54a998c 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
@@ -35,6 +35,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.Property;
@@ -231,7 +232,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
 
     assertNotNull(entity.getProperty("PropertyComp"));
     assertNotNull(entity.getProperty("PropertyComp") instanceof List);
-    List<Property> complexProperties = entity.getProperty("PropertyComp").asComplex();
+    List<Property> complexProperties = entity.getProperty("PropertyComp").asComplex().getValue();
     assertEquals(16, complexProperties.size());
   }
 
@@ -284,7 +285,6 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     assertEquals(true, asCollection.get(2));
   }
 
-  @SuppressWarnings("unchecked")
   @Test
   public void simpleEntityETMixPrimCollComp() throws Exception {
     final String entityString = "{"
@@ -314,13 +314,12 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     assertEquals(3, asCollection.size());
 
     for (Object arrayElement : asCollection) {
-      assertTrue(arrayElement instanceof List);
-      List<Object> castedArrayElement = (List<Object>) arrayElement;
+      assertTrue(arrayElement instanceof ComplexValue);
+      List<Property> castedArrayElement = (List<Property>) ((ComplexValue) arrayElement).getValue();
       assertEquals(2, castedArrayElement.size());
     }
   }
 
-  @SuppressWarnings("unchecked")
   @Test
   public void eTMixPrimCollCompMIssingPropertyInComplexType() throws Exception {
     final String entityString = "{"
@@ -341,7 +340,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
 
     Property complexProperty = entity.getProperty("PropertyComp");
     assertEquals(ValueType.COMPLEX, complexProperty.getValueType());
-    List<Property> complexPropertyValues = (List<Property>) complexProperty.getValue();
+    List<Property> complexPropertyValues = (List<Property>) complexProperty.asComplex().getValue();
     assertEquals(1, complexPropertyValues.size());
 
     Property property = entity.getProperty("CollPropertyComp");
@@ -352,8 +351,8 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     assertEquals(3, asCollection.size());
 
     for (Object arrayElement : asCollection) {
-      assertTrue(arrayElement instanceof List);
-      List<Object> castedArrayElement = (List<Object>) arrayElement;
+      assertTrue(arrayElement instanceof ComplexValue);
+      List<Property> castedArrayElement = (List<Property>) ((ComplexValue) arrayElement).getValue();
       assertEquals(1, castedArrayElement.size());
     }
   }
@@ -495,7 +494,6 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     assertTrue(bindingToMany.getBindingLinks().isEmpty());
   }
 
-  @SuppressWarnings("unchecked")
   @Test
   public void eTMixEnumDefCollCompTest() throws Exception {
     InputStream stream = getFileAsStream("EntityETMixEnumDefCollComp.json");
@@ -515,7 +513,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     assertEquals("string", defProperty.getValue());
 
     Property complexProperty = entity.getProperty("PropertyCompMixedEnumDef");
-    List<Property> value = (List<Property>) complexProperty.getValue();
+    List<Property> value = (List<Property>) complexProperty.asComplex().getValue();
     assertEquals((short) 2, value.get(0).getValue());
   }
 
@@ -566,7 +564,6 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     assertNull(entity.getProperty("PropertyComp").getValue());
   }
 
-  @SuppressWarnings("unchecked")
   @Test
   public void validJsonValueForComplexCollectionNullValue() throws Exception {
     final String entityString = "{"
@@ -580,7 +577,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
         new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
     List<?> collPropertyComp = entity.getProperty("CollPropertyComp").asCollection();
     assertNull(collPropertyComp.get(0));
-    List<Property> complexPropertyProperties = (List<Property>) collPropertyComp.get(1);
+    List<Property> complexPropertyProperties = (List<Property>) ((ComplexValue) collPropertyComp.get(1)).getValue();
     assertEquals(Short.valueOf((short) 789), complexPropertyProperties.get(0).getValue());
     assertEquals("TEST 3", complexPropertyProperties.get(1).getValue());
   }
@@ -595,8 +592,8 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
     Entity entity = deserializer.entity(stream, edm.getEntityType(
         new FullQualifiedName("Namespace1_Alias", "ETCompAllPrim")));
 
-    assertEquals("TEST A", entity.getProperty("PropertyComp").asComplex().get(0).getValue());
-    assertNull(entity.getProperty("PropertyComp").asComplex().get(1).getValue());
+    assertEquals("TEST A", entity.getProperty("PropertyComp").asComplex().getValue().get(0).getValue());
+    assertNull(entity.getProperty("PropertyComp").asComplex().getValue().get(1).getValue());
   }
 
   @Test
@@ -614,7 +611,7 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
 
     assertEquals((short) 2, e.getProperty("PropertyEnumString").getValue());
     Property propertyCompMixedEnumDef = e.getProperty("PropertyCompMixedEnumDef");
-    assertNull(propertyCompMixedEnumDef.asComplex().get(0).getValue());
+    assertNull(propertyCompMixedEnumDef.asComplex().getValue().get(0).getValue());
   }
 
   @Test


Mime
View raw message