You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by bu...@apache.org on 2015/11/18 02:55:09 UTC

svn commit: r972798 - in /websites/staging/olingo/trunk/content: ./ doc/odata4/tutorials/deep_insert/tutorial_deep_insert.html

Author: buildbot
Date: Wed Nov 18 01:55:09 2015
New Revision: 972798

Log:
Staging update by buildbot for olingo

Modified:
    websites/staging/olingo/trunk/content/   (props changed)
    websites/staging/olingo/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.html

Propchange: websites/staging/olingo/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Nov 18 01:55:09 2015
@@ -1 +1 @@
-1714916
+1714917

Modified: websites/staging/olingo/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.html (original)
+++ websites/staging/olingo/trunk/content/doc/odata4/tutorials/deep_insert/tutorial_deep_insert.html Wed Nov 18 01:55:09 2015
@@ -117,7 +117,7 @@ This tutorial can be found in subdirecto
 <p>In this tutorial shows how to handle "deep insert" requests. OData gives us the possibility to create  related entities, and bind existing entities to a new created entity in a single request. (More detailed information: <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398326">OData Version 4.0 Part 1: Protocol</a>, <a href="http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940637">OData JSON Format Version 4.0</a>)</p>
 <p>OData uses to create a related entity the same syntax as for an expanded navigation property, as descripted in <a href="http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940637">OData JSON Format</a>. To bind an existing entity, OData uses the <code>odata.bind</code> property annotation. The value of the annotation is either an entity-Id or a collection of entity-Ids. An <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398204">entity-Id</a> is a durable, opaque, globally unique <a href="https://www.ietf.org/rfc/rfc3987.txt">IRI</a>. The specification recommends to use the canonical URL of the entity. In this tutorial the relative canonical URL of an entity is used.</p>
 <p><strong>Example</strong></p>
-<p>For example you may want to create a new category and also create new products, which are related to the new created category. In addition you would like to bind an existing entity to the new created category.
+<p>For example you may want to create a new category and also create new products, which are related to the new created category. In addition you would like to bind an existing product to the new created category.
 Such a request is issued againest the URL of the entity set. </p>
 <p>In this example, a new Category "Food" and two products ("Bread", "Milk") are created. In addition the Product with the key 5 is bind to the just created entity.</p>
 <div class="codehilite"><pre><span class="n">POST</span> <span class="o">/</span><span class="n">Categories</span> <span class="n">HTTP</span><span class="o">/</span>1<span class="p">.</span>1
@@ -147,7 +147,7 @@ Such a request is issued againest the UR
 <p>As a shortcut you should checkout the prepared tutorial project in the <a href="https://git-wip-us.apache.org/repos/asf/olingo-odata4">git repository</a> in folder /samples/tutorials/p12_deep_insert_preparation.</p>
 <p>Afterwards do a Deploy and run: it should be working. At this state you can perform CRUD operations and do navigations between products and categories.</p>
 <h1 id="2-implementation">2. Implementation<a class="headerlink" href="#2-implementation" title="Permanent link">&para;</a></h1>
-<p>Before we start with the implementation, please have a look at the class <code>myservice.mynamespace.data.Storage</code>. In difference to the <a href="http://olingo.apache.org/doc/odata4/tutorials/navigation/tutorial_navigation.html">navigation tutorial</a> 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 creation of the sample data is called. After that the method <code>linkProductsAndCategories</code>is called. This methods sets a few links between the just created entities. <strong>The linked entites are stored as navigation link</strong></p>
+<p>Before we start with the implementation, please have a look at the class <code>myservice.mynamespace.data.Storage</code>. In difference to the <a href="http://olingo.apache.org/doc/odata4/tutorials/navigation/tutorial_navigation.html">navigation tutorial</a> 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 creation of the sample data is called. After that the method <code>linkProductsAndCategories</code>is called. This methods sets a few links between the just created entities. <strong>The linked entites are stored as navigation links</strong></p>
 <p>To express the relation between two entities, Olingo uses the class <a href="http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html">Link</a>. 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 <a href="http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Linked.html#getNavigationLink(java.lang.String)"><code>getNavigationLink(String name)</code></a> 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 <a href="http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getInlineEntity()"><code>getInlineEntity()</code></a> or <a href="http://olingo.apache.org/javadoc/odata4/o
 rg/apache/olingo/commons/api/data/Link.html#getInlineEntitySet()"><code>getInlineEntitySet()</code></a>
 The same can be done for bindings via the method <a href="http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Linked.html#getNavigationBinding(java.lang.String)"><code>getNavigationBinding(String name)</code></a>. The values of the Binding can be gotten by the methods <a href="http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getBindingLink()"><code>getBindingLink()</code></a> and <a href="http://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/data/Link.html#getBindingLinks()"><code>getBindingLinks()</code></a>. </p>
 <p>The point is that the Entity deserializer uses the same concept to represent the payload as Java objects.