Author: buildbot
Date: Wed Oct 21 07:56:37 2015
New Revision: 969722
Log:
Staging update by buildbot for olingo
Modified:
websites/staging/olingo/trunk/content/ (props changed)
websites/staging/olingo/trunk/content/doc/odata4/tutorials/action/tutorial_action.html
Propchange: websites/staging/olingo/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Oct 21 07:56:37 2015
@@ -1 +1 @@
-1709738
+1709739
Modified:
websites/staging/olingo/trunk/content/doc/odata4/tutorials/action/tutorial_action.html
==============================================================================
---
websites/staging/olingo/trunk/content/doc/odata4/tutorials/action/tutorial_action.html
(original)
+++
websites/staging/olingo/trunk/content/doc/odata4/tutorials/action/tutorial_action.html
Wed Oct 21 07:56:37 2015
@@ -104,23 +104,21 @@ h2:hover > .headerlink, h3:hover > .head
<ul>
<li><a href="#how-to-build-an-odata-service-with-olingo-v4">How to build an
OData Service with Olingo V4</a></li>
<li><a href="#part-6-action-imports-and-function-imports">Part 6: Action
Imports and Function Imports</a><ul>
-<li><a href="#1-introduction">1. Introduction</a></li>
+<li><a href="#introduction">Introduction</a></li>
+<li><a href="#preparation">Preparation</a></li>
+<li><a href="#implementation">Implementation</a><ul>
+<li><a href="#extend-the-metadata-model">Extend the Metadata model</a></li>
</ul>
</li>
-<li><a href="#2-preparation">2. Preparation</a><ul>
-<li><a href="#31-implementation">3.1 Implementation</a><ul>
-<li><a href="#31-extend-the-metadata-model">3.1 Extend the Metadata
model</a></li>
+<li><a href="#extend-the-data-store">Extend the data store</a></li>
+<li><a
href="#extend-the-entity-collection-and-the-entity-processor-to-handle-function-imports">Extend
the entity collection and the entity processor to handle function
imports</a><ul>
+<li><a href="#implement-an-action-processor">Implement an action
processor</a></li>
</ul>
</li>
-<li><a href="#32-extend-the-data-store">3.2 Extend the data store</a></li>
-<li><a
href="#33-extend-the-entity-collection-and-the-entity-processor-to-handle-function-imports">3.3
Extend the entity collection and the entity processor to handle function
imports</a><ul>
-<li><a href="#34-implement-an-action-processor">3.4 Implement an action
processor</a></li>
+<li><a href="#run-the-implemented-service">Run the implemented service</a></li>
</ul>
</li>
-<li><a href="#4-run-the-implemented-service">4. Run the implemented
service</a></li>
-</ul>
-</li>
-<li><a href="#5-links">5. Links</a><ul>
+<li><a href="#links">Links</a><ul>
<li><a href="#tutorials">Tutorials</a></li>
<li><a href="#code-and-repository">Code and Repository</a></li>
<li><a href="#further-reading">Further reading</a></li>
@@ -128,7 +126,7 @@ h2:hover > .headerlink, h3:hover > .head
</li>
</ul>
</div>
-<h2 id="1-introduction">1. Introduction<a class="headerlink"
href="#1-introduction" title="Permanent link">¶</a></h2>
+<h2 id="introduction">Introduction<a class="headerlink" href="#introduction"
title="Permanent link">¶</a></h2>
<p>In the present tutorial, weâll implement a function import and an action
import as well.</p>
<p><strong>Note:</strong>
The final source code can be found in the project <a
href="https://git-wip-us.apache.org/repos/asf/olingo-odata4">git repository</a>.
@@ -207,11 +205,11 @@ root.</p>
<p>As you read in the definition, actions can have side effects (modifying the
data) but cannot be composed like functions.</p>
-<h1 id="2-preparation">2. Preparation<a class="headerlink"
href="#2-preparation" title="Permanent link">¶</a></h1>
+<h2 id="preparation">Preparation<a class="headerlink" href="#preparation"
title="Permanent link">¶</a></h2>
<p>You should read the previous tutorials first to have an idea how to read
entities and entity collections. In addition the following code is based on the
write tutorial merged with the navigation tutorial.</p>
<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/p9_action_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>
-<h2 id="31-implementation">3.1 Implementation<a class="headerlink"
href="#31-implementation" title="Permanent link">¶</a></h2>
+<h2 id="implementation">Implementation<a class="headerlink"
href="#implementation" title="Permanent link">¶</a></h2>
<p>We will using the given data model you are familiar with. To keep things
simple we implement one function import and one action import.</p>
<p><strong>Function Import: CountCategories</strong> <br />
This function takes a mandatory parameter â<em>Amount</em>â. The function
returns a collection of categories with the very same number of related
products.</p>
@@ -242,7 +240,7 @@ This action takes an optional parameter
<li>Extend the entity collection and the entity processor to handle function
imports</li>
<li>Implement an action processor</li>
</ul>
-<h3 id="31-extend-the-metadata-model">3.1 Extend the Metadata model<a
class="headerlink" href="#31-extend-the-metadata-model" title="Permanent
link">¶</a></h3>
+<h3 id="extend-the-metadata-model">Extend the Metadata model<a
class="headerlink" href="#extend-the-metadata-model" title="Permanent
link">¶</a></h3>
<p>Create the following constants in the DemoEdmProvider. These constants are
used to address the operations.</p>
<div class="codehilite"><pre><span class="c1">// Action</span>
<span class="kd">public</span> <span class="kd">static</span> <span
class="kd">final</span> <span class="n">String</span> <span
class="n">ACTION_RESET</span> <span class="o">=</span> <span
class="s">"Reset"</span><span class="o">;</span>
@@ -384,7 +382,7 @@ Add the following lines to the method <c
</pre></div>
-<h2 id="32-extend-the-data-store">3.2 Extend the data store<a
class="headerlink" href="#32-extend-the-data-store" title="Permanent
link">¶</a></h2>
+<h2 id="extend-the-data-store">Extend the data store<a class="headerlink"
href="#extend-the-data-store" title="Permanent link">¶</a></h2>
<p>We need two methods in the data store to read the function import
<code>CountCategories</code>.</p>
<p>The first method returns a collection of entites and the second returns a
single entity of this collection.</p>
<div class="codehilite"><pre><span class="kd">public</span> <span
class="n">EntityCollection</span> <span
class="nf">readFunctionImportCollection</span><span class="o">(</span><span
class="kd">final</span> <span class="n">UriResourceFunction</span> <span
class="n">uriResourceFunction</span><span class="o">,</span> <span
class="kd">final</span> <span class="n">ServiceMetadata</span> <span
class="n">serviceMetadata</span><span class="o">)</span> <span
class="kd">throws</span> <span class="n">ODataApplicationException</span> <span
class="o">{</span>
@@ -460,7 +458,7 @@ Add the following lines to the method <c
</pre></div>
-<h2
id="33-extend-the-entity-collection-and-the-entity-processor-to-handle-function-imports">3.3
Extend the entity collection and the entity processor to handle function
imports<a class="headerlink"
href="#33-extend-the-entity-collection-and-the-entity-processor-to-handle-function-imports"
title="Permanent link">¶</a></h2>
+<h2
id="extend-the-entity-collection-and-the-entity-processor-to-handle-function-imports">Extend
the entity collection and the entity processor to handle function imports<a
class="headerlink"
href="#extend-the-entity-collection-and-the-entity-processor-to-handle-function-imports"
title="Permanent link">¶</a></h2>
<p>We start with the entity collection processor
<code>DemoEntityCollectionProcessor</code>.
To keep things simple, the first steps is to distinguish between entity
collections and function imports.
A cleverer implementation can handle both cases in one method to avoid
duplicated code.</p>
@@ -570,7 +568,7 @@ A cleverer implementation can handle bot
</pre></div>
-<h3 id="34-implement-an-action-processor">3.4 Implement an action processor<a
class="headerlink" href="#34-implement-an-action-processor" title="Permanent
link">¶</a></h3>
+<h3 id="implement-an-action-processor">Implement an action processor<a
class="headerlink" href="#implement-an-action-processor" title="Permanent
link">¶</a></h3>
<p>Create a new class <code>DemoActionProcessor</code> make them implement the
interface <code>ActionVoidProcessor</code>.</p>
<div class="codehilite"><pre><span class="kd">public</span> <span
class="kd">class</span> <span class="nc">DemoActionProcessor</span> <span
class="kd">implements</span> <span class="n">ActionVoidProcessor</span> <span
class="o">{</span>
@@ -627,7 +625,7 @@ A cleverer implementation can handle bot
</pre></div>
-<h2 id="4-run-the-implemented-service">4. Run the implemented service<a
class="headerlink" href="#4-run-the-implemented-service" title="Permanent
link">¶</a></h2>
+<h2 id="run-the-implemented-service">Run the implemented service<a
class="headerlink" href="#run-the-implemented-service" title="Permanent
link">¶</a></h2>
<p>After building and deploying your service to your server, you can try the
following requests:</p>
<p><strong>Functions (Called via GET)</strong> </p>
<ul>
@@ -652,7 +650,7 @@ A cleverer implementation can handle bot
<ul>
<li><a
href="http://localhost:8080/DemoService-Action/DemoService.svc/Products">http://localhost:8080/DemoService-Action/DemoService.svc/Products</a></li>
</ul>
-<h1 id="5-links">5. Links<a class="headerlink" href="#5-links"
title="Permanent link">¶</a></h1>
+<h1 id="links">Links<a class="headerlink" href="#links" title="Permanent
link">¶</a></h1>
<h3 id="tutorials">Tutorials<a class="headerlink" href="#tutorials"
title="Permanent link">¶</a></h3>
<p>Further topics to be covered by follow-up tutorials:</p>
<ul>