OLINGO-682: adding  support for

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

Branch: refs/heads/master
Commit: ad10381a5988cc48c3c0b2b0dd7a06c9f6b2359c
Parents: 181e463
Author: Ramesh Reddy <[email protected]>
Authored: Tue Jun 2 17:49:03 2015 -0500
Committer: Ramesh Reddy <[email protected]>
Committed: Tue Jun 2 17:53:19 2015 -0500

----------------------------------------------------------------------
 .../core/serializer/json/ODataJsonSerializer.java     | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ad10381a/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 d5cd3c6..08f557a 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
@@ -330,13 +330,14 @@ public class ODataJsonSerializer implements 
ODataSerializer {
           final Link navigationLink = 
linked.getNavigationLink(property.getName());
           final ExpandItem innerOptions = expandAll ? null :
               ExpandSelectHelper.getExpandItem(expand.getExpandItems(), 
propertyName);
-          if (innerOptions != null && (innerOptions.isRef() || 
innerOptions.getLevelsOption() != null)) {
-            throw new SerializerException("Expand options $ref and $levels are 
not supported.",
+          if (innerOptions != null && innerOptions.getLevelsOption() != null) {
+            throw new SerializerException("Expand option $levels is not 
supported.",
                 SerializerException.MessageKeys.NOT_IMPLEMENTED);
           }
           writeExpandedNavigationProperty(metadata, property, navigationLink,
               innerOptions == null ? null : innerOptions.getExpandOption(),
-              innerOptions == null ? null : innerOptions.getSelectOption(),
+              innerOptions == null ? null : innerOptions.getSelectOption(), 
+              innerOptions == null ? false: innerOptions.isRef(),
               json);
         }
       }
@@ -345,7 +346,8 @@ public class ODataJsonSerializer implements ODataSerializer 
{
 
   protected void writeExpandedNavigationProperty(final ServiceMetadata 
metadata,
       final EdmNavigationProperty property, final Link navigationLink,
-      final ExpandOption innerExpand, final SelectOption innerSelect, final 
JsonGenerator json)
+      final ExpandOption innerExpand, final SelectOption innerSelect, boolean 
onlyReference, 
+      final JsonGenerator json)
       throws IOException, SerializerException {
     json.writeFieldName(property.getName());
     if (property.isCollection()) {
@@ -354,14 +356,14 @@ public class ODataJsonSerializer implements 
ODataSerializer {
         json.writeEndArray();
       } else {
         writeEntitySet(metadata, property.getType(), 
navigationLink.getInlineEntitySet(), innerExpand,
-            innerSelect, false, json);
+            innerSelect, onlyReference, json);
       }
     } else {
       if (navigationLink == null || navigationLink.getInlineEntity() == null) {
         json.writeNull();
       } else {
         writeEntity(metadata, property.getType(), 
navigationLink.getInlineEntity(), null,
-            innerExpand, innerSelect, false, json);
+            innerExpand, innerSelect, onlyReference, json);
       }
     }
   }

Reply via email to