olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1045608 - in /websites/staging/olingo/trunk/content: ./ doc/odata4/tutorials/od4_basic_batch_client.html
Date Tue, 28 May 2019 06:16:11 GMT
Author: buildbot
Date: Tue May 28 06:16:10 2019
New Revision: 1045608

Log:
Staging update by buildbot for olingo

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

Propchange: websites/staging/olingo/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue May 28 06:16:10 2019
@@ -1 +1 @@
-1860172
+1860173

Modified: websites/staging/olingo/trunk/content/doc/odata4/tutorials/od4_basic_batch_client.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/odata4/tutorials/od4_basic_batch_client.html
(original)
+++ websites/staging/olingo/trunk/content/doc/odata4/tutorials/od4_basic_batch_client.html
Tue May 28 06:16:10 2019
@@ -98,7 +98,51 @@
   visibility: hidden;
 }
 h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover
> .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink
{ visibility: visible }</style>
-<h1 id="how-to-use-the-batch-client-api-in-odata-v4">How to use the Batch Client API
in OData V4<a class="headerlink" href="#how-to-use-the-batch-client-api-in-odata-v4" title="Permanent
link">&para;</a></h1><div align="center">
+<h1 id="how-to-use-the-batch-client-api-in-odata-v4">How to use the Batch Client API
in OData V4<a class="headerlink" href="#how-to-use-the-batch-client-api-in-odata-v4" title="Permanent
link">&para;</a></h1>
+<h3 id="construction-of-odata-client">Construction of OData Client<a class="headerlink"
href="#construction-of-odata-client" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="n">ODataClient</span> <span
class="n">odata</span> <span class="p">=</span> <span class="n">ODataClientFactory</span><span
class="p">.</span><span class="n">getClient</span><span class="p">();</span>
+<span class="n">odata</span><span class="p">.</span><span class="n">getConfiguration</span><span
class="p">().</span><span class="n">setDefaultPubFormat</span><span
class="p">(</span><span class="n">ContentType</span><span class="p">.</span><span
class="n">APPLICATION_JSON</span><span class="p">);</span>
+</pre></div>
+
+
+<h3 id="construction-of-a-client-entity-and-create-request">Construction of a client
entity and create request<a class="headerlink" href="#construction-of-a-client-entity-and-create-request"
title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="n">ClientObjectFactory</span>
<span class="n">factory</span> <span class="p">=</span> <span class="n">getClient</span><span
class="p">().</span><span class="n">getObjectFactory</span><span class="p">();</span>
+<span class="n">final</span> <span class="n">ClientEntity</span>
<span class="n">entity</span> <span class="p">=</span> <span class="n">factory</span><span
class="p">.</span><span class="n">newEntity</span><span class="p">(</span>&quot;<span
class="n">OData</span><span class="p">.</span><span class="n">Demo</span><span
class="p">.</span><span class="n">Manufacturer</span>&quot;<span
class="p">);</span>
+<span class="n">entity</span><span class="p">.</span><span class="n">getProperties</span><span
class="p">().</span><span class="n">add</span><span class="p">(</span><span
class="n">factory</span><span class="p">.</span><span class="n">newPrimitiveProperty</span><span
class="p">(</span>&quot;<span class="n">Name</span>&quot;<span
class="p">,</span> <span class="n">factory</span><span class="p">.</span><span
class="n">newPrimitiveValueBuilder</span><span class="p">().</span><span
class="n">buildString</span><span class="p">(</span>&quot;<span
class="n">MyCarManufacturer</span>&quot;<span class="p">)));</span>
+
+<span class="n">final</span> <span class="n">URI</span> <span
class="n">targetURI</span> <span class="p">=</span> <span class="n">getClient</span><span
class="p">().</span><span class="n">newURIBuilder</span><span class="p">(</span><span
class="n">serviceUrl</span><span class="p">).</span><span class="n">appendEntitySetSegment</span><span
class="p">(</span>&quot;<span class="n">Manufacturers</span>&quot;<span
class="p">).</span><span class="n">build</span><span class="p">();</span>
+<span class="n">final</span> <span class="n">ODataEntityCreateRequest</span><span
class="o">&lt;</span><span class="n">ClientEntity</span><span
class="o">&gt;</span> <span class="n">createRequest</span> <span
class="p">=</span> <span class="n">getClient</span><span class="p">().</span><span
class="n">getCUDRequestFactory</span><span class="p">().</span><span
class="n">getEntityCreateRequest</span><span class="p">(</span><span
class="n">targetURI</span><span class="p">,</span> <span class="n">entity</span><span
class="p">);</span>
+</pre></div>
+
+
+<h3 id="add-a-create-request-to-a-changeset">Add a create request to a changeset<a
class="headerlink" href="#add-a-create-request-to-a-changeset" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="n">BatchManager</span>
<span class="n">payloadManager</span> <span class="p">=</span> <span
class="n">getClient</span><span class="p">().</span><span class="n">getBatchRequestFactory</span><span
class="p">().</span><span class="n">getBatchRequest</span><span class="p">(</span><span
class="n">serviceUrl</span><span class="p">).</span><span class="n">payloadManager</span><span
class="p">();</span>
+<span class="n">final</span> <span class="n">ODataChangeset</span>
<span class="n">changeset</span> <span class="p">=</span> <span
class="n">payloadManager</span><span class="p">.</span><span class="n">addChangeset</span><span
class="p">();</span>
+
+<span class="n">changeset</span><span class="p">.</span><span
class="n">addRequest</span><span class="p">(</span><span class="n">createRequest</span><span
class="p">);</span>
+</pre></div>
+
+
+<h3 id="construction-of-a-query-request">Construction of a query request<a class="headerlink"
href="#construction-of-a-query-request" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="n">final</span> <span
class="n">URI</span> <span class="n">targetURI</span> <span class="p">=</span>
<span class="n">getClient</span><span class="p">().</span><span
class="n">newURIBuilder</span><span class="p">(</span><span class="n">serviceUrl</span><span
class="p">).</span><span class="n">appendEntitySetSegment</span><span
class="p">(</span>&quot;<span class="n">Manufacturers</span>&quot;<span
class="p">).</span><span class="n">appendKeySegment</span><span class="p">(</span>1<span
class="p">).</span><span class="n">build</span><span class="p">();</span>
+<span class="n">final</span> <span class="n">URI</span> <span
class="n">uri</span> <span class="p">=</span> <span class="n">isRelative</span>
? <span class="n">URI</span><span class="p">.</span><span class="n">create</span><span
class="p">(</span><span class="o">&lt;</span><span class="n">ServiceUri</span><span
class="o">&gt;</span><span class="p">).</span><span class="n">relativize</span><span
class="p">(</span><span class="n">targetURI</span><span class="p">)</span>
<span class="p">:</span> <span class="n">targetURI</span><span
class="p">;</span>
+
+<span class="n">ODataEntityRequest</span><span class="o">&lt;</span><span
class="n">ClientEntity</span><span class="o">&gt;</span> <span
class="n">queryReq</span> <span class="p">=</span> <span class="n">getClient</span><span
class="p">().</span><span class="n">getRetrieveRequestFactory</span><span
class="p">().</span><span class="n">getEntityRequest</span><span class="p">(</span><span
class="n">uri</span><span class="p">);</span>
+<span class="n">queryReq</span><span class="p">.</span><span class="n">setAccept</span><span
class="p">(</span><span class="n">ContentType</span><span class="p">.</span><span
class="n">APPLICATION_JSON</span><span class="p">);</span>
+</pre></div>
+
+
+<h3 id="add-query-request-to-payloadmanager">Add query request to payloadManager<a
class="headerlink" href="#add-query-request-to-payloadmanager" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="n">payload</span><span
class="p">.</span><span class="n">addRequest</span><span class="p">(</span><span
class="n">queryReq</span><span class="p">);</span>
+</pre></div>
+
+
+<h3 id="fetch-the-batch-response">Fetch the batch response<a class="headerlink"
href="#fetch-the-batch-response" title="Permanent link">&para;</a></h3>
+<div class="codehilite"><pre><span class="n">final</span> <span
class="n">ODataBatchResponse</span> <span class="n">response</span> <span
class="p">=</span> <span class="n">payload</span><span class="p">.</span><span
class="n">getResponse</span><span class="p">();</span>
+
+<span class="n">final</span> <span class="n">Iterator</span><span
class="o">&lt;</span><span class="n">ODataBatchResponseItem</span><span
class="o">&gt;</span> <span class="n">responseBodyIter</span> <span
class="p">=</span> <span class="n">response</span><span class="p">.</span><span
class="n">getBody</span><span class="p">();</span>
+<span class="n">final</span> <span class="n">ODataBatchResponseItem</span>
<span class="n">changeSetResponse</span> <span class="p">=</span>
<span class="n">responseBodyIter</span><span class="p">.</span><span
class="n">next</span><span class="p">();</span>
+</pre></div><div align="center">
 <p>Copyright © 2013-2015, The Apache Software Foundation<br>
 				                Apache Olingo, Olingo, Apache, the Apache feather, and
 				the Apache Olingo project logo are trademarks of the Apache Software



Mime
View raw message