You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/09/08 13:44:53 UTC

svn commit: r1701779 - /olingo/site/trunk/content/doc/odata4/tutorials/readep/tutorial_readep.mdtext

Author: chrish
Date: Tue Sep  8 11:44:52 2015
New Revision: 1701779

URL: http://svn.apache.org/r1701779
Log:
CMS commit to olingo by chrish

Modified:
    olingo/site/trunk/content/doc/odata4/tutorials/readep/tutorial_readep.mdtext

Modified: olingo/site/trunk/content/doc/odata4/tutorials/readep/tutorial_readep.mdtext
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/readep/tutorial_readep.mdtext?rev=1701779&r1=1701778&r2=1701779&view=diff
==============================================================================
--- olingo/site/trunk/content/doc/odata4/tutorials/readep/tutorial_readep.mdtext (original)
+++ olingo/site/trunk/content/doc/odata4/tutorials/readep/tutorial_readep.mdtext Tue Sep  8 11:44:52 2015
@@ -306,7 +306,6 @@ Copy the following code into this class:
 
     import org.apache.olingo.commons.api.data.Entity;
     import org.apache.olingo.commons.api.data.EntityCollection;
-    import org.apache.olingo.commons.api.edm.EdmEntitySet;
     import org.apache.olingo.commons.api.edm.EdmEntityType;
     import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
     import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -314,10 +313,7 @@ Copy the following code into this class:
     import org.apache.olingo.commons.api.edm.EdmType;
     import org.apache.olingo.commons.api.http.HttpStatusCode;
     import org.apache.olingo.server.api.ODataApplicationException;
-    import org.apache.olingo.server.api.uri.UriInfoResource;
     import org.apache.olingo.server.api.uri.UriParameter;
-    import org.apache.olingo.server.api.uri.UriResource;
-    import org.apache.olingo.server.api.uri.UriResourceEntitySet;
 
     public class Util {
 
@@ -526,7 +522,7 @@ The steps to be followed in the implemen
     After fetching the Entity object from the backend, we have to convert it to an `InputStream`, using the proper `ODataSerializer` method:
 
         :::java
-        ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+        ODataSerializer serializer = odata.createSerializer(responseFormat);
         SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
         InputStream entityStream = serializerResult.getContent();
 
@@ -562,8 +558,7 @@ The following snippet shows the implemen
         // expand and select currently not supported
     	EntitySerializerOptions options = EntitySerializerOptions.with().contextURL(contextUrl).build();
 
-    	ODataFormat oDataFormat = ODataFormat.fromContentType(responseFormat);
-    	ODataSerializer serializer = this.odata.createSerializer(oDataFormat);
+    	ODataSerializer serializer = odata.createSerializer(responseFormat);
     	SerializerResult serializerResult = serializer.entity(serviceMetadata, entityType, entity, options);
     	InputStream entityStream = serializerResult.getContent();
 
@@ -670,16 +665,21 @@ Create the class `DemoPrimitiveProcessor
 
 We have to create a Constructor that takes the `Storage` instance and stores it as a member variable:
 
-     :::java
-     public class DemoEntityCollectionProcessor implements EntityCollectionProcessor {
-
+    :::java
+    public class DemoPrimitiveProcessor implements PrimitiveProcessor {
+    
         private OData odata;
         private Storage storage;
-
-        public DemoEntityCollectionProcessor(Storage storage) {
+        private ServiceMetadata serviceMetadata;
+        
+        public DemoPrimitiveProcessor(Storage storage) {
             this.storage = storage;
         }
-     }
+        
+        public void init(OData odata, ServiceMetadata serviceMetadata) {
+            this.odata = odata;
+            this.serviceMetadata = serviceMetadata;
+        }
 
 **readPrimitive**
 
@@ -741,13 +741,12 @@ Again, we have the following 4 steps to
                  Object value = property.getValue();
                  if (value != null) {
                       // 3.1. configure the serializer
-                      ODataFormat format = ODataFormat.fromContentType(responseFormat);
-                      ODataSerializer serializer = odata.createSerializer(format);
+                      ODataSerializer serializer = odata.createSerializer(responseFormat);
 
                       ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).navOrPropertyPath(edmPropertyName).build();
                       PrimitiveSerializerOptions options = PrimitiveSerializerOptions.with().contextURL(contextUrl).build();
                       // 3.2. serialize
-                      SerializerResult serializerResult = serializer.primitive(edmPropertyType, property, options);
+                      SerializerResult serializerResult = serializer.primitive(serviceMetadata, edmPropertyType, property, options);
                       InputStream propertyStream = serializerResult.getContent();
 
                       //4. configure the response object