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/10/13 13:49:34 UTC

svn commit: r1708355 - /olingo/site/trunk/content/doc/odata4/tutorials/media/tutorial_media.mdtext

Author: chrish
Date: Tue Oct 13 11:49:34 2015
New Revision: 1708355

URL: http://svn.apache.org/viewvc?rev=1708355&view=rev
Log:
CMS commit to olingo by chrish

Modified:
    olingo/site/trunk/content/doc/odata4/tutorials/media/tutorial_media.mdtext

Modified: olingo/site/trunk/content/doc/odata4/tutorials/media/tutorial_media.mdtext
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/media/tutorial_media.mdtext?rev=1708355&r1=1708354&r2=1708355&view=diff
==============================================================================
--- olingo/site/trunk/content/doc/odata4/tutorials/media/tutorial_media.mdtext (original)
+++ olingo/site/trunk/content/doc/odata4/tutorials/media/tutorial_media.mdtext Tue Oct 13 11:49:34 2015
@@ -194,6 +194,35 @@ If a client creates a new media entity,
         return entity;
     }
 
+Add an initial set of data to our data store:
+
+    ::::java
+    private void initAdvertismentSampleData() {
+        Entity entity = new Entity();
+        entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, UUID.fromString("f89dee73-af9f-4cd4-b330-db93c25ff3c7")));
+        entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Old School Lemonade Store, Retro Style"));
+        entity.addProperty(new Property(null, "AirDate", ValueType.PRIMITIVE, Timestamp.valueOf("2012-11-07 00:00:00")));
+        entity.addProperty(new Property(null, MEDIA_PROPERTY_NAME, ValueType.PRIMITIVE, "Super content".getBytes()));
+        entity.setMediaContentType(ContentType.parse("text/plain").toContentTypeString());
+        advertisments.add(entity);
+    
+        entity = new Entity();
+        entity.addProperty(new Property(null, "ID", ValueType.PRIMITIVE, 
+        UUID.fromString("db2d2186-1c29-4d1e-88ef-a127f521b9c67")));
+        entity.addProperty(new Property(null, "Name", ValueType.PRIMITIVE, "Early morning start, need coffee"));
+        entity.addProperty(new Property(null, "AirDate", ValueType.PRIMITIVE, Timestamp.valueOf("2000-02-29 00:00:00")));
+        entity.addProperty(new Property(null, MEDIA_PROPERTY_NAME, ValueType.PRIMITIVE, "Super content2".getBytes()));
+        entity.setMediaContentType(ContentType.parse("text/plain").toContentTypeString());
+        advertisments.add(entity);
+    }
+
+Call `initAdvertismentSampleData()` in the constructor.
+
+    public Storage() {
+        // ...
+        initAdvertismentSampleData();
+    }
+
 ### Implement the interface `MediaEntityProcessor`
 
 As you can see the [`MediaEntityProcessor`(Javadoc)](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/server/api/processor/MediaEntityProcessor.html) extends [`EntityProcessor`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/server/api/processor/EntityProcessor.html), therefore we will implement `MediaEntityProcessor` in class `DemoEntityProcessor`.