Author: buildbot
Date: Tue Apr 28 12:53:00 2015
New Revision: 949489
Log:
Staging update by buildbot for olingo
Modified:
websites/staging/olingo/trunk/content/ (props changed)
websites/staging/olingo/trunk/content/doc/odata4/tutorials/read/tutorial_read.html
Propchange: websites/staging/olingo/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Apr 28 12:53:00 2015
@@ -1 +1 @@
-1676521
+1676522
Modified:
websites/staging/olingo/trunk/content/doc/odata4/tutorials/read/tutorial_read.html
==============================================================================
---
websites/staging/olingo/trunk/content/doc/odata4/tutorials/read/tutorial_read.html
(original)
+++
websites/staging/olingo/trunk/content/doc/odata4/tutorials/read/tutorial_read.html
Tue Apr 28 12:53:00 2015
@@ -647,10 +647,8 @@ Because the <em>readEntityCollection</em
As a developer of the OData service, you have to know how and where the data
is stored. In many cases, this would be a database. At this point, you would
connect to your database and fetch the requested data with an appropriate SQL
statement. The data that is fetched from the data storage has to be put into an
<em>EntitySet</em> object.
Note that this object has to be of type <em>EntitySet</em>, not
<em>EdmEntitySet</em><br />
The package <em>org.apache.olingo.commons.api.data</em> provides interfaces
that describe the actual data, not the metadata.</p>
-</li>
-</ol>
<p><img alt="datapackage" src="datapackage.png" title="The package containing
the interfaces for handling runtime data" /></p>
-<ol>
+</li>
<li>
<p>Transform the data<br />
<em>Olingo</em> expects from us to provide the data as low-level
<em>InputStream</em> object. However, <em>Olingo</em> supports us in doing so,
by providing us with a proper "serializer".
@@ -663,14 +661,13 @@ Because the <em>readEntityCollection</em
And finally we have to set the content type. </p>
<p>:::java
public void readEntityCollection(ODataRequest request, ODataResponse
response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException
{</p>
-<div class="codehilite"><pre><span class="c1">// 1st retrieve the requested
EntitySet from the uriInfo (representation of the parsed URI)</span>
-<span class="n">List</span><span class="o"><</span><span
class="n">UriResource</span><span class="o">></span> <span
class="n">resourcePaths</span> <span class="o">=</span> <span
class="n">uriInfo</span><span class="p">.</span><span
class="n">getUriResourceParts</span><span class="p">();</span>
-<span class="c1">// in our example, the first segment is the EntitySet:</span>
-<span class="n">UriResourceEntitySet</span> <span
class="n">uriResourceEntitySet</span> <span class="o">=</span> <span
class="p">(</span><span class="n">UriResourceEntitySet</span><span
class="p">)</span> <span class="n">resourcePaths</span><span
class="p">.</span><span class="n">get</span><span class="p">(</span><span
class="mh">0</span><span class="p">);</span>
-<span class="n">EdmEntitySet</span> <span class="n">edmEntitySet</span> <span
class="o">=</span> <span class="n">uriResourceEntitySet</span><span
class="p">.</span><span class="n">getEntitySet</span><span class="p">();</span>
-
-<span class="c1">// 2nd: fetch the data from backend for this requested
EntitySetName and delivere as EntitySet</span>
+ throws ODataApplicationException, SerializerException {
+ // 1st retrieve the requested EntitySet from the uriInfo (representation
of the parsed URI)
+ List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
+ // in our example, the first segment is the EntitySet:
+ UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet)
resourcePaths.get(0);
+ EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();</p>
+<div class="codehilite"><pre><span class="c1">// 2nd: fetch the data from
backend for this requested EntitySetName and delivere as EntitySet</span>
<span class="n">EntitySet</span> <span class="n">entitySet</span> <span
class="o">=</span> <span class="n">getData</span><span class="p">(</span><span
class="n">edmEntitySet</span><span class="p">);</span>
<span class="c1">// 3rd: create a serializer based on the requested format
(json)</span>