Author: chrish
Date: Tue Oct 13 10:50:09 2015
New Revision: 1708322

URL: http://svn.apache.org/viewvc?rev=1708322&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=1708322&r1=1708321&r2=1708322&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 10:50:09 2015
@@ -75,7 +75,7 @@ As you can see, the XML tag `EntityType`
 
 ### Extend the metadata document
 
-If you have read the prevois tutorials, you should be familiar with the 
definition entity types. The only difference to regular (Non media enties) is, 
that they have a `hasStream` Property. If this property is not provided it 
defaults to false. So add the following code to class `DemoEdmProvider`:
+If you have read the prevois tutorials, you should be familiar with the 
definition entity types. The only difference to regular (Non media enties) is, 
that they have a `hasStream` property. If this property is not provided it 
defaults to false. So add the following code to class `DemoEdmProvider`:
 
 We start with method `DemoEdmProvider.getEntityType`
 
@@ -110,7 +110,7 @@ We start with method `DemoEdmProvider.ge
                return entityType;
        }
 
-Further a have to create a new entity set. Add the following snipped to 
`DemoEdmProvider.getEntitySet`
+Further we  have to create a new entity set. Add the following snipped to 
`DemoEdmProvider.getEntitySet`
 
        @Override
        public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, 
String entitySetName) {
@@ -153,6 +153,7 @@ And finally announce the entity type and
 In this tutorial, we will keep things simple. To store the value of media 
entities, we create a special property *$value*. Note this is not a valid OData 
Identifier.
 
 To read the content to a media entity, we simple return the value of the 
property *$value*.
+
        ::::java
         private static final String MEDIA_PROPERTY_NAME = "$value";
 
@@ -160,16 +161,18 @@ To read the content to a media entity, w
                return (byte[]) 
entity.getProperty(MEDIA_PROPERTY_NAME).asPrimitive();
        }
 
-If we update the content of a media entity, we must also the the Content Type 
of the content.  
+If we update the content of a media entity, we must also set the the Content 
Type of the content.
 
        ::::java
+       private List<Entity> advertisments;
+       
        public void updateMedia(final Entity entity, final String 
mediaContentType, final byte[] data) {
                
entity.getProperties().remove(entity.getProperty(MEDIA_PROPERTY_NAME));
                entity.addProperty(new Property(null, MEDIA_PROPERTY_NAME, 
ValueType.PRIMITIVE, data));
                entity.setMediaContentType(mediaContentType);
        }
 
-If a client creates a new media entity, the body of the requet contains the 
content of the media entity instead the regualr properties! So the other 
regular properties defaults to `null`. The Content Type of the  media content 
must also be set up.
+If a client creates a new media entity, the body of the requet contains the 
content of the media entity instead the regualr properties! So the other 
regular properties defaults to `null`. The Content Type of the  media content 
must also be set.
 
        ::::java
        public Entity createMediaEntity(final EdmEntityType edmEntityType, 
final String mediaContentType, final byte[] data) {
@@ -192,7 +195,7 @@ If a client creates a new media entity,
 
 ### Implement the interface `MediaEntityProcessor`
 
-As you can see the 
[`MediaEntityProcessor`](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`.
+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`.
 
 The easiest part is to delete an media entity. The method `deleteMediaEntity` 
is delegated to the method `deleteEntity(...)`.
 
@@ -204,7 +207,7 @@ The easiest part is to delete an media e
                deleteEntity(request, response, uriInfo);
        }
 
-Next implement the creation of media entites. First we fetch the addressed 
entity set and convert the body of the request to a byte array. Remember the 
whole body of the request contains the content of the media entity.
+Next the creation of media entites is implemented. First we fetch the 
addressed entity set and convert the body of the request to a byte array. 
Remember the whole body of the request contains the content of the media entity.
 
        ::::java
        @Override
@@ -302,17 +305,17 @@ Updating a media entity in our scenario
 
 After building and deploying the project, we can invoke our OData service.
 
-Read media entity set
+Read media entity set    
 **GET** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments)
 
-Read media entity
+Read media entity    
 **GET** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7))
 
-Read media entity content
+Read media entity content    
 **GET** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value)
 
-Create a new Media Entity
-**POST** [http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments
+Create a new Media Entity    
+**POST** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments    
 Content-Type: image/svg+xml]()
 
        ::::xml
@@ -324,15 +327,15 @@ Content-Type: image/svg+xml]()
        </svg>
 
 
-Update the content of a media entity
-**PUT**  
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value)
+Update the content of a media entity    
+**PUT**  
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value)
    
 Content-Type: text/plain
 
        ::::text
        Super super nice content
 
-Update the properties of a media entity
-**PUT** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7))
+Update the properties of a media entity    
+**PUT** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7))
    
 Content-Type: application/json
 
        ::::json
@@ -343,10 +346,10 @@ Content-Type: application/json
 
 
 
-Delete a media entity
+Delete a media entity    
 **DELETE** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7)](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(f89dee73-af9f-4cd4-b330-db93c25ff3c7))
 
-Delete a media entity
+Delete a media entity    
 **DELETE** 
[http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(db2d2186-1c29-4d1e-88ef-127f521b9c67)/$value](http://localhost:8080/DemoService-Media/DemoService.svc/Advertisments(db2d2186-1c29-4d1e-88ef-127f521b9c67)/$value)
 
 # 5. Links


Reply via email to