Author: chrish
Date: Tue Nov 17 14:36:05 2015
New Revision: 1714796

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

Modified:
    
olingo/site/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.mdtext

Modified: 
olingo/site/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.mdtext
URL: 
http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.mdtext?rev=1714796&r1=1714795&r2=1714796&view=diff
==============================================================================
--- 
olingo/site/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.mdtext
 (original)
+++ 
olingo/site/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.mdtext
 Tue Nov 17 14:36:05 2015
@@ -85,7 +85,7 @@ Afterwards do a Deploy and run: it shoul
 
 Before we start with the implementation, please have a look at the class 
`myservice.mynamespace.data.Storage`. In difference to the [navigation 
tutorial](http://olingo.apache.org/doc/odata4/tutorials/navigation/tutorial_navigation.html)
 the relations between two entities can not be hard coded because we would like 
to create and change relations between entities dynamically. In the constructor 
of the data storage the sample data is created. After that the method 
`linkProductsAndCategories`is called. This methods sets a few links between the 
just created entities.
 
-To express the relation between two entities, Olingo uses the class 
[Link](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html).
 This class is used for related entites (directly connected via Java 
references) and bindings (which are actually strings) to other entities. To get 
the related entites for a particual navigation property, you can ask an entity 
with the method [`getNavigationLink(String 
name)`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Linked.html#getNavigationLink(java.lang.String))
 for an navigation property. The link will contain either an entity or a 
collection of entities dependenting on the type of the navigation property. To 
get the actual entities use the methods 
[`getInlineEntity()`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getInlineEntity())
 or 
[`getInlineEntitySet()`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#get
 InlineEntitySet())
+To express the relation between two entities, Olingo uses the class 
[Link](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html).
 This class is used for related entites (directly connected via Java 
references) and bindings (which are actually strings) to other entities. To get 
the related entites for a particual navigation property, you can ask an entity 
with the method [`getNavigationLink(String 
name)`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Linked.html#getNavigationLink(java.lang.String))
 for an navigation property link. The link will contain either an entity or a 
collection of entities dependenting on the type of the navigation property. To 
get the actual entities use the methods 
[`getInlineEntity()`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getInlineEntity())
 or 
[`getInlineEntitySet()`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.htm
 l#getInlineEntitySet())
 The same can be done for bindings via the method [`getNavigationBinding(String 
name)`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Linked.html#getNavigationBinding(java.lang.String)).
 The values of the Binding can be gotten by the methods 
[`getBindingLink()`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getBindingLink())
 and 
[`getBindingLinks()`](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getBindingLinks()).
 
 
 The point is that the Entity deserializer uses the same concept to represent 
the payload as Java objects.
@@ -121,8 +121,9 @@ The implementation should look like the
     }
 
 The implementation is split in two steps:
-   * Handle entity bindings
-   * Handle related entities
+
+  - Handle entity bindings
+  - Handle related entities
 
 ## Handle entity bindings
 
@@ -130,6 +131,7 @@ To handle entity bindings we need two he
 
 The first method takes an entity-Id and returns the addressed entity. The 
OData objects provides a helper object to parse entity-ids. (See 
[UriHelper](http://olingo.apache.org/javadoc/odata4/org/apache/olingo/server/api/uri/UriHelper.html)).
 After parsing the id we have to check if the addressed entity set fits to the 
entity set the navigation property points to. After that the data is read by 
calling `readEntityData`.
 
+    ::::java
     private Entity readEntityByBindingLink(final String entityId, final 
EdmEntitySet edmEntitySet, 
         final String rawServiceUri) throws ODataApplicationException {
 
@@ -152,6 +154,7 @@ The first method takes an entity-Id and
 
 The second method helps us to link entities together. If the navigation 
property has partner navigation property the link is set in both directions.
 
+    ::::java
     private void createLink(final EdmNavigationProperty navigationProperty, 
final Entity srcEntity,
         final Entity destEntity) {
 
@@ -165,6 +168,7 @@ The second method helps us to link entit
 
 If the client has used the `odata.bind` property annotation, we can get the 
bindings by calling `getNavigationBindings()`. The implementation loops over 
all bindings and links the addressed entity to the new created one.
 
+    ::::java
     // 2.1.) Apply binding links
     for(final Link link : entity.getNavigationBindings()) {
         final EdmNavigationProperty edmNavigationProperty = 
edmEntityType.getNavigationProperty(link.getTitle());
@@ -185,6 +189,7 @@ If the client has used the `odata.bind`
 
 The creation of related entities is similar. First the implementation loops 
over all navigation properties with related entites in the payload. The 
simplest way to create releated entities is to call the method 
`createEntityData`. So the the implementation is called recursively and can 
handle deep inserts with arbitrary depth.
 
+    ::::java
     // 2.2.) Create nested entities
     for(final Link link : entity.getNavigationLinks()) {
         final EdmNavigationProperty edmNavigationProperty = 
edmEntityType.getNavigationProperty(link.getTitle());


Reply via email to