olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r922392 [18/23] - in /websites/staging/olingo/trunk/content: ./ doc/ doc/javascript/ doc/odata2/ doc/odata2/tutorials/ doc/odata4/ doc/odata4/tutorials/ doc/tutorials/
Date Tue, 16 Sep 2014 12:34:20 GMT
Added: websites/staging/olingo/trunk/content/doc/odata4/tutorials/basicread.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/odata4/tutorials/basicread.html (added)
+++ websites/staging/olingo/trunk/content/doc/odata4/tutorials/basicread.html Tue Sep 16 12:34:18 2014
@@ -0,0 +1,723 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="Apache Olingo provides libraries which enable developers to implement OData producers and OData consumers. The available OData Java library implements OData version 2.0. In future on goal is to provide an OData 4.0 compliant library once the OData standard is published at OASIS. The focus within the community is currently on the Java technology but it is up to the community to discuss if other environments find interest.">
+    <meta name="author" content="">
+    <link rel="icon" href="/favicon.ico">
+    <title>
+      Apache Olingo
+    </title><!-- Bootstrap core CSS -->
+    <link href="/css/bootstrap.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link href="/css/navbar.css" rel="stylesheet" type="text/css"><!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <link href="/css/offcanvas.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link rel="stylesheet" href="/css/main.css">
+    <!--[if lt IE 9]><script src="/js/ie8-responsive-file-warning.js"></script><![endif]-->
+
+    <script src="/js/ie-emulation-modes-warning.js" type="text/javascript">
+</script><!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+
+    <script src="/js/ie10-viewport-bug-workaround.js" type="text/javascript">
+</script><!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="/js/html5shiv.min.js"></script>
+      <script src="/js/respond.min.js"></script>
+    <![endif]-->
+  </head>
+
+  <body>
+    <div class="container">
+      <!-- Static navbar -->
+      <div class="navbar navbar-default" role="navigation">
+        <div class="container-fluid">
+          <div class="navbar-header">
+            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+              <span class="sr-only">Toggle navigation</span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+            </button>
+              <img class="navbar-brand" src="/img/OlingoOrangeTM.png" style="width:62px;" >
+              <a class="navbar-brand" href="#">Apache Olingo™</a>
+          </div>
+          <div class="navbar-collapse collapse">
+            <ul class="nav navbar-nav">
+
+              <li><a href="/">Home</a></li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">ASF <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="http://www.apache.org/foundation/">ASF Home</a></li>
+                      <li><a href="http://projects.apache.org/">Projects</a></li>
+                      <li><a href="http://people.apache.org/">People</a></li>
+                      <li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a></li>
+                      <li><a href="http://www.apache.org/dyn/closer.cgi">Download</a></li>
+                      <li><a href="http://www.apache.org/security/">Security</a></li>
+                      <li><a href="http://www.apache.org/foundation/sponsorship.html">Support Apache</a></li>
+                  </ul>
+              </li>
+
+              <li><a href="http://www.apache.org/licenses/">License</a></li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Download <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="/doc/odata2/download.html">Download OData 2.0 Java</a></li>
+                      <li><a href="/doc/javascript/download.html">Download OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                    <li><a href="/doc/odata2/index.html">Documentation OData 2.0 Java</a></li>
+                    <li><a href="/doc/javascript/index.html">Documentation OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+              <li><a href="/support.html">Support</a></li>
+
+            </ul>
+
+			  <img class="navbar-right" height="50px" src="/img/asf-logo.gif">
+
+			</div><!--/.nav-collapse -->
+        </div><!--/.container-fluid -->
+      </div><!-- Main component for a primary marketing message or call to action --><h1 id="read-scenario">Read Scenario</h1>
+<hr />
+<h3 id="how-to-guide-for-building-a-sample-odata-service-with-the-odata-library-java">How To Guide for building a Sample OData service with the OData Library (Java)</h3>
+<p>This How To Guide prerequisites a Project Setup (Git, Maven, etc.) and then shows how to develop an OData Service and make the same available.
+It shows in addition how to implement the Model Provider to expose the Entity Data Model (EDM) and the Data Provider to expose the runtime data.
+The implementation of the Data Provider (ODataSingleProcessor) illustrates how to expose a single entry, a feed and how to follow associations.</p>
+<h3 id="prerequisites">Prerequisites</h3>
+<p><a href="../project-setup.html">Project Setup</a> is successfully done and the project is ready to start in your <code>$ODATA_PROJECT_HOME</code>.</p>
+<h3 id="implement-your-odata-service">Implement your OData Service</h3>
+<h5 id="shortcut">Shortcut</h5>
+<p>As a shortcut you can download the <a href="apache-olingo-tutorial-basic_read.zip">Olingo Tutorial 'Basic-Read' Project</a>.</p>
+<h3 id="deployment-descriptor">Deployment Descriptor</h3>
+<h5 id="sample-code">Sample Code</h5>
+<div class="codehilite"><pre><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
+<span class="nt">&lt;web-app</span> <span class="na">xmlns:xsi=</span><span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
+    <span class="na">xmlns=</span><span class="s">&quot;http://java.sun.com/xml/ns/javaee&quot;</span> <span class="na">xmlns:web=</span><span class="s">&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span>
+    <span class="na">xsi:schemaLocation=</span><span class="s">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span>
+    <span class="na">id=</span><span class="s">&quot;WebApp_ID&quot;</span> <span class="na">version=</span><span class="s">&quot;2.5&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;display-name&gt;</span>org.apache.olingo.odata2.sample<span class="nt">&lt;/display-name&gt;</span>
+    <span class="nt">&lt;servlet&gt;</span>
+        <span class="nt">&lt;servlet-name&gt;</span>MyODataSampleServlet<span class="nt">&lt;/servlet-name&gt;</span>
+        <span class="nt">&lt;servlet-class&gt;</span>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet<span class="nt">&lt;/servlet-class&gt;</span>
+        <span class="nt">&lt;init-param&gt;</span>
+            <span class="nt">&lt;param-name&gt;</span>javax.ws.rs.Application<span class="nt">&lt;/param-name&gt;</span>
+            <span class="nt">&lt;param-value&gt;</span>org.apache.olingo.odata2.core.rest.app.ODataApplication<span class="nt">&lt;/param-value&gt;</span>
+        <span class="nt">&lt;/init-param&gt;</span>
+        <span class="nt">&lt;init-param&gt;</span>
+            <span class="nt">&lt;param-name&gt;</span>org.apache.olingo.odata2.service.factory<span class="nt">&lt;/param-name&gt;</span>
+            <span class="nt">&lt;param-value&gt;</span>org.apache.olingo.odata2.sample.service.MyServiceFactory<span class="nt">&lt;/param-value&gt;</span>
+        <span class="nt">&lt;/init-param&gt;</span>
+        <span class="nt">&lt;load-on-startup&gt;</span>1<span class="nt">&lt;/load-on-startup&gt;</span>
+    <span class="nt">&lt;/servlet&gt;</span>
+    <span class="nt">&lt;servlet-mapping&gt;</span>
+        <span class="nt">&lt;servlet-name&gt;</span>MyODataSampleServlet<span class="nt">&lt;/servlet-name&gt;</span>
+        <span class="nt">&lt;url-pattern&gt;</span>/MyODataSample.svc/*<span class="nt">&lt;/url-pattern&gt;</span>
+    <span class="nt">&lt;/servlet-mapping&gt;</span>
+<span class="nt">&lt;/web-app&gt;</span>
+</pre></div>
+
+
+<ul>
+<li>
+<p>Start the command line tool, go to folder <em>$ODATA_PROJECT_HOME\org.apache.olingo.odata2.sample.cars</em> and enter
+<code>mvn clean install</code> to build your projects </p>
+</li>
+<li>
+<p>The deployment Descriptor contains two <code>&lt;init-param&gt;</code> elements which define the OData Application <code>org.apache.olingo.odata2.core.rest.app.ODataApplication</code> and your Service Factory <code>org.apache.olingo.odata2.sample.service.MyServiceFactory</code>. The OData Application is implemented in the OData Library (Core) and registers a root locator and an exception mapper. The root locator looks up your registered Service Factory to get access to the Entity Data Model Provider and the OData Processor which provides the runtime data. In addition the root locator looks up a parameter <code>org.apache.olingo.odata2.path.split</code> (not present in the deployment descriptor above) which indicates how many path segments are reserved for the OData Service via an Integer value (default is 0, which means that the OData Service name corresponds to the defined <code>url-pattern</code>). </p>
+</li>
+</ul>
+<h3 id="implement-the-odata-service-factory">Implement the OData Service Factory</h3>
+<ul>
+<li>Create a new source folder <em>src/main/java</em> in the eclipse project </li>
+<li>Create a new package <code>org.apache.olingo.odata2.sample.service</code> in the source folder</li>
+<li>Create a class <code>MyServiceFactory</code> which extends <code>org.apache.olingo.odata2.api.ODataServiceFactory</code> in the new package and contains the following implementation </li>
+</ul>
+<h5 id="sample-code_1">Sample Code</h5>
+<div class="codehilite"><pre><span class="kn">package</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">odata2</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">service</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.ODataService</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.ODataServiceFactory</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.edm.provider.EdmProvider</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.exception.ODataException</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.processor.ODataContext</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.processor.ODataSingleProcessor</span><span class="o">;</span>
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyServiceFactory</span> <span class="kd">extends</span> <span class="n">ODataServiceFactory</span> <span class="o">{</span>
+
+  <span class="nd">@Override</span>
+  <span class="kd">public</span> <span class="n">ODataService</span> <span class="nf">createService</span><span class="o">(</span><span class="n">ODataContext</span> <span class="n">ctx</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+
+<span class="n">EdmProvider</span> <span class="n">edmProvider</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MyEdmProvider</span><span class="o">();</span>
+<span class="n">ODataSingleProcessor</span> <span class="n">singleProcessor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MyODataSingleProcessor</span><span class="o">();</span>
+
+<span class="k">return</span> <span class="nf">createODataSingleProcessorService</span><span class="o">(</span><span class="n">edmProvider</span><span class="o">,</span> <span class="n">singleProcessor</span><span class="o">);</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li>In order to make your coding able to compile you have to create Java classes for 
+ <code>MyEdmProvider</code> which extends <code>org.apache.olingo.odata2.api.edm.provider.EdmProvider</code> and 
+ <code>MyODataSingleProcessor</code> which extends <code>org.apache.olingo.odata2.api.processor.ODataSingleProcessor</code> </li>
+<li>After these steps compile your project with <code>mvn clean install</code> </li>
+</ul>
+<h3 id="implement-the-entity-data-model-provider">Implement the Entity Data Model Provider</h3>
+<p>In this paragraph you will implement the <code>MyEdmProvider</code> class by overriding all methods of <code>org.apache.olingo.odata2.api.edm.provider.EdmProvider</code>.</p>
+<ul>
+<li>You will implement the following Entity Data Model.</li>
+</ul>
+<p><img alt="alt text" src="/img/ODataCarsModel.JPG" /></p>
+<ul>
+<li>As we have a static model we define constants for all top level elements of the schema (declared in the <code>MyEdmProvider</code> class).</li>
+</ul>
+<h5 id="sample-code_2">Sample Code</h5>
+<div class="codehilite"><pre>  <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_SET_NAME_MANUFACTURERS</span> <span class="o">=</span> <span class="s">&quot;Manufacturers&quot;</span><span class="o">;</span>
+  <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_SET_NAME_CARS</span> <span class="o">=</span> <span class="s">&quot;Cars&quot;</span><span class="o">;</span>
+  <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_NAME_MANUFACTURER</span> <span class="o">=</span> <span class="s">&quot;Manufacturer&quot;</span><span class="o">;</span>
+  <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_NAME_CAR</span> <span class="o">=</span> <span class="s">&quot;Car&quot;</span><span class="o">;</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">NAMESPACE</span> <span class="o">=</span> <span class="s">&quot;org.apache.olingo.odata2.ODataCars&quot;</span><span class="o">;</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">FullQualifiedName</span> <span class="n">ENTITY_TYPE_1_1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="n">ENTITY_NAME_CAR</span><span class="o">);</span>
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">FullQualifiedName</span> <span class="n">ENTITY_TYPE_1_2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="n">ENTITY_NAME_MANUFACTURER</span><span class="o">);</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">FullQualifiedName</span> <span class="n">COMPLEX_TYPE</span> <span class="o">=</span> <span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="s">&quot;Address&quot;</span><span class="o">);</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">FullQualifiedName</span> <span class="n">ASSOCIATION_CAR_MANUFACTURER</span> <span class="o">=</span> <span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="s">&quot;Car_Manufacturer_Manufacturer_Cars&quot;</span><span class="o">);</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ROLE_1_1</span> <span class="o">=</span> <span class="s">&quot;Car_Manufacturer&quot;</span><span class="o">;</span>
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ROLE_1_2</span> <span class="o">=</span> <span class="s">&quot;Manufacturer_Cars&quot;</span><span class="o">;</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_CONTAINER</span> <span class="o">=</span> <span class="s">&quot;ODataCarsEntityContainer&quot;</span><span class="o">;</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ASSOCIATION_SET</span> <span class="o">=</span> <span class="s">&quot;Cars_Manufacturers&quot;</span><span class="o">;</span>
+</pre></div>
+
+
+<ul>
+<li>Implement <code>MyEdmProvider.getSchemas</code>. This method is used to retrieve the complete structural information in order to build the metadata document and the service document. The implementation makes use of other getter methods of this class for simplicity reasons. If a very performant way of building the whole structural information was required, other implementation strategies could be used. </li>
+</ul>
+<h5 id="sample-code_3">Sample Code</h5>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">Schema</span><span class="o">&gt;</span> <span class="n">getSchemas</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="n">List</span><span class="o">&lt;</span><span class="n">Schema</span><span class="o">&gt;</span> <span class="n">schemas</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Schema</span><span class="o">&gt;();</span>
+
+<span class="n">Schema</span> <span class="n">schema</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="o">();</span>
+<span class="n">schema</span><span class="o">.</span><span class="na">setNamespace</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">EntityType</span><span class="o">&gt;</span> <span class="n">entityTypes</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">EntityType</span><span class="o">&gt;();</span>
+<span class="n">entityTypes</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getEntityType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">));</span>
+<span class="n">entityTypes</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getEntityType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="o">));</span>
+<span class="n">schema</span><span class="o">.</span><span class="na">setEntityTypes</span><span class="o">(</span><span class="n">entityTypes</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">ComplexType</span><span class="o">&gt;</span> <span class="n">complexTypes</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">ComplexType</span><span class="o">&gt;();</span>
+<span class="n">complexTypes</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getComplexType</span><span class="o">(</span><span class="n">COMPLEX_TYPE</span><span class="o">));</span>
+<span class="n">schema</span><span class="o">.</span><span class="na">setComplexTypes</span><span class="o">(</span><span class="n">complexTypes</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">Association</span><span class="o">&gt;</span> <span class="n">associations</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Association</span><span class="o">&gt;();</span>
+<span class="n">associations</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getAssociation</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">));</span>
+<span class="n">schema</span><span class="o">.</span><span class="na">setAssociations</span><span class="o">(</span><span class="n">associations</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">EntityContainer</span><span class="o">&gt;</span> <span class="n">entityContainers</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">EntityContainer</span><span class="o">&gt;();</span>
+<span class="n">EntityContainer</span> <span class="n">entityContainer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">EntityContainer</span><span class="o">();</span>
+<span class="n">entityContainer</span><span class="o">.</span><span class="na">setName</span><span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">).</span><span class="na">setDefaultEntityContainer</span><span class="o">(</span><span class="kc">true</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">EntitySet</span><span class="o">&gt;</span> <span class="n">entitySets</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">EntitySet</span><span class="o">&gt;();</span>
+<span class="n">entitySets</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getEntitySet</span><span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_CARS</span><span class="o">));</span>
+<span class="n">entitySets</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getEntitySet</span><span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">));</span>
+<span class="n">entityContainer</span><span class="o">.</span><span class="na">setEntitySets</span><span class="o">(</span><span class="n">entitySets</span><span class="o">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">AssociationSet</span><span class="o">&gt;</span> <span class="n">associationSets</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">AssociationSet</span><span class="o">&gt;();</span>
+<span class="n">associationSets</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getAssociationSet</span><span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">,</span> <span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">,</span> <span class="n">ROLE_1_2</span><span class="o">));</span>
+<span class="n">entityContainer</span><span class="o">.</span><span class="na">setAssociationSets</span><span class="o">(</span><span class="n">associationSets</span><span class="o">);</span>
+
+<span class="n">entityContainers</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">entityContainer</span><span class="o">);</span>
+<span class="n">schema</span><span class="o">.</span><span class="na">setEntityContainers</span><span class="o">(</span><span class="n">entityContainers</span><span class="o">);</span>
+
+<span class="n">schemas</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">schema</span><span class="o">);</span>
+
+<span class="k">return</span> <span class="n">schemas</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getEntityType(FullQualifiedName edmFQName)</code> returns an Entity Type according to the full qualified name specified. The Entity Type holds all information about its structure like simple properties, complex properties, navigation properties and the definition of its key property (or properties). </li>
+</ul>
+<h5 id="sample-code_4">Sample Code</h5>
+<div class="codehilite"><pre><span class="nd">@Override</span>
+  <span class="kd">public</span> <span class="n">EntityType</span> <span class="nf">getEntityType</span><span class="o">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="k">if</span> <span class="o">(</span><span class="n">NAMESPACE</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getNamespace</span><span class="o">()))</span> <span class="o">{</span>
+
+  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+
+    <span class="c1">//Properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">Int32</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Model&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">100</span><span class="o">).</span><span class="na">setDefaultValue</span><span class="o">(</span><span class="s">&quot;Hugo&quot;</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setCustomizableFeedMappings</span><span class="o">(</span><span class="k">new</span> <span class="n">CustomizableFeedMappings</span><span class="o">().</span><span class="na">setFcTargetPath</span><span class="o">(</span><span class="n">EdmTargetPath</span><span class="o">.</span><span class="na">SYNDICATION_TITLE</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;ManufacturerId&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">Int32</span><span class="o">));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Price&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">Decimal</span><span class="o">));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Currency&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">3</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;ModelYear&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">4</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Updated&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">DateTime</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setConcurrencyMode</span><span class="o">(</span><span class="n">EdmConcurrencyMode</span><span class="o">.</span><span class="na">Fixed</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setCustomizableFeedMappings</span><span class="o">(</span><span class="k">new</span> <span class="n">CustomizableFeedMappings</span><span class="o">().</span><span class="na">setFcTargetPath</span><span class="o">(</span><span class="n">EdmTargetPath</span><span class="o">.</span><span class="na">SYNDICATION_UPDATED</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;ImagePath&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">));</span>
+
+    <span class="c1">//Navigation Properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;</span> <span class="n">navigationProperties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;();</span>
+    <span class="n">navigationProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">NavigationProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Manufacturer&quot;</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setRelationship</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">).</span><span class="na">setFromRole</span><span class="o">(</span><span class="n">ROLE_1_1</span><span class="o">).</span><span class="na">setToRole</span><span class="o">(</span><span class="n">ROLE_1_2</span><span class="o">));</span>
+
+    <span class="c1">//Key</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;</span> <span class="n">keyProperties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;();</span>
+    <span class="n">keyProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">PropertyRef</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">));</span>
+    <span class="n">Key</span> <span class="n">key</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Key</span><span class="o">().</span><span class="na">setKeys</span><span class="o">(</span><span class="n">keyProperties</span><span class="o">);</span>
+
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">EntityType</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">setProperties</span><span class="o">(</span><span class="n">properties</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setKey</span><span class="o">(</span><span class="n">key</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setNavigationProperties</span><span class="o">(</span><span class="n">navigationProperties</span><span class="o">);</span>
+
+  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+
+    <span class="c1">//Properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">Int32</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Name&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">100</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setCustomizableFeedMappings</span><span class="o">(</span><span class="k">new</span> <span class="n">CustomizableFeedMappings</span><span class="o">().</span><span class="na">setFcTargetPath</span><span class="o">(</span><span class="n">EdmTargetPath</span><span class="o">.</span><span class="na">SYNDICATION_TITLE</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">ComplexProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Address&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="s">&quot;Address&quot;</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Updated&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">DateTime</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setConcurrencyMode</span><span class="o">(</span><span class="n">EdmConcurrencyMode</span><span class="o">.</span><span class="na">Fixed</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setCustomizableFeedMappings</span><span class="o">(</span><span class="k">new</span> <span class="n">CustomizableFeedMappings</span><span class="o">().</span><span class="na">setFcTargetPath</span><span class="o">(</span><span class="n">EdmTargetPath</span><span class="o">.</span><span class="na">SYNDICATION_UPDATED</span><span class="o">)));</span>
+
+    <span class="c1">//Navigation Properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;</span> <span class="n">navigationProperties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;();</span>
+    <span class="n">navigationProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">NavigationProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Cars&quot;</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setRelationship</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">).</span><span class="na">setFromRole</span><span class="o">(</span><span class="n">ROLE_1_2</span><span class="o">).</span><span class="na">setToRole</span><span class="o">(</span><span class="n">ROLE_1_1</span><span class="o">));</span>
+
+    <span class="c1">//Key</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;</span> <span class="n">keyProperties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;();</span>
+    <span class="n">keyProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">PropertyRef</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">));</span>
+    <span class="n">Key</span> <span class="n">key</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Key</span><span class="o">().</span><span class="na">setKeys</span><span class="o">(</span><span class="n">keyProperties</span><span class="o">);</span>
+
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">EntityType</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">setProperties</span><span class="o">(</span><span class="n">properties</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setHasStream</span><span class="o">(</span><span class="kc">true</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setKey</span><span class="o">(</span><span class="n">key</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setNavigationProperties</span><span class="o">(</span><span class="n">navigationProperties</span><span class="o">);</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getComplexType(FullQualifiedName edmFQName)</code> </li>
+</ul>
+<h5 id="sample-code_5">Sample Code</h5>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="n">ComplexType</span> <span class="nf">getComplexType</span><span class="o">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="k">if</span> <span class="o">(</span><span class="n">NAMESPACE</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getNamespace</span><span class="o">()))</span> <span class="o">{</span>
+  <span class="k">if</span> <span class="o">(</span><span class="n">COMPLEX_TYPE</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Street&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;City&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;ZipCode&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Country&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">));</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">ComplexType</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">COMPLEX_TYPE</span><span class="o">.</span><span class="na">getName</span><span class="o">()).</span><span class="na">setProperties</span><span class="o">(</span><span class="n">properties</span><span class="o">);</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getAssociation(FullQualifiedName edmFQName)</code> </li>
+</ul>
+<h5 id="sample-code_6">Sample Code</h5>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="n">Association</span> <span class="nf">getAssociation</span><span class="o">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="k">if</span> <span class="o">(</span><span class="n">NAMESPACE</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getNamespace</span><span class="o">()))</span> <span class="o">{</span>
+  <span class="k">if</span> <span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">Association</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">setEnd1</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationEnd</span><span class="o">().</span><span class="na">setType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">).</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_1</span><span class="o">).</span><span class="na">setMultiplicity</span><span class="o">(</span><span class="n">EdmMultiplicity</span><span class="o">.</span><span class="na">MANY</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setEnd2</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationEnd</span><span class="o">().</span><span class="na">setType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="o">).</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_2</span><span class="o">).</span><span class="na">setMultiplicity</span><span class="o">(</span><span class="n">EdmMultiplicity</span><span class="o">.</span><span class="na">ONE</span><span class="o">));</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getEntityContainerInfo(String name)</code> </li>
+</ul>
+<h5 id="sample-code_7">Sample Code</h5>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="n">EntityContainerInfo</span> <span class="nf">getEntityContainerInfo</span><span class="o">(</span><span class="n">String</span> <span class="n">name</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="k">if</span> <span class="o">(</span><span class="n">name</span> <span class="o">==</span> <span class="kc">null</span> <span class="o">||</span> <span class="s">&quot;ODataCarsEntityContainer&quot;</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">name</span><span class="o">))</span> <span class="o">{</span>
+  <span class="k">return</span> <span class="k">new</span> <span class="nf">EntityContainerInfo</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;ODataCarsEntityContainer&quot;</span><span class="o">).</span><span class="na">setDefaultEntityContainer</span><span class="o">(</span><span class="kc">true</span><span class="o">);</span>
+<span class="o">}</span>
+
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getEntitySet(String entityContainer, String name)</code></li>
+</ul>
+<h5 id="sample-code_8">Sample Code</h5>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="n">EntitySet</span> <span class="nf">getEntitySet</span><span class="o">(</span><span class="n">String</span> <span class="n">entityContainer</span><span class="o">,</span> <span class="n">String</span> <span class="n">name</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entityContainer</span><span class="o">))</span> <span class="o">{</span>
+  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">name</span><span class="o">))</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">EntitySet</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">name</span><span class="o">).</span><span class="na">setEntityType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">);</span>
+  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">name</span><span class="o">))</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">EntitySet</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">name</span><span class="o">).</span><span class="na">setEntityType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="o">);</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getAssociationSet(String entityContainer, FullQualifiedName association, String sourceEntitySetName, String sourceEntitySetRole)</code></li>
+</ul>
+<h5 id="sample-code_9">Sample Code</h5>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="n">AssociationSet</span> <span class="nf">getAssociationSet</span><span class="o">(</span><span class="n">String</span> <span class="n">entityContainer</span><span class="o">,</span> <span class="n">FullQualifiedName</span> <span class="n">association</span><span class="o">,</span> <span class="n">String</span> <span class="n">sourceEntitySetName</span><span class="o">,</span> <span class="n">String</span> <span class="n">sourceEntitySetRole</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+<span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entityContainer</span><span class="o">))</span> <span class="o">{</span>
+  <span class="k">if</span> <span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">association</span><span class="o">))</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">AssociationSet</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ASSOCIATION_SET</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setAssociation</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setEnd1</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationSetEnd</span><span class="o">().</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_2</span><span class="o">).</span><span class="na">setEntitySet</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setEnd2</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationSetEnd</span><span class="o">().</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_1</span><span class="o">).</span><span class="na">setEntitySet</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="o">));</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<h4 id="conclusion">Conclusion</h4>
+<p>After the implementation of the Edm Provider the web application can be executed to show the Service Document and the Metadata Document.</p>
+<ul>
+<li>Build your project <code>mvn clean install</code> </li>
+<li>Deploy the Web Application to the server. </li>
+<li>Show the Service Document: http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/</li>
+<li>Show the Metadata Document: http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/$metadata </li>
+</ul>
+<h3 id="implement-the-odata-processor-which-provides-the-runtime-data">Implement the OData Processor which provides the runtime data</h3>
+<p>You already created the <code>MyODataSingleProcessor</code> class which we now extend with some needed imports and a reference to a DataStore which contains our data (and will be implemented in the next step).</p>
+<h5 id="sample-code_10">Sample Code</h5>
+<div class="codehilite"><pre><span class="kn">package</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">odata2</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">service</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">static</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">odata2</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">service</span><span class="o">.</span><span class="na">MyEdmProvider</span><span class="o">.</span><span class="na">ENTITY_SET_NAME_CARS</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">static</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">odata2</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">service</span><span class="o">.</span><span class="na">MyEdmProvider</span><span class="o">.</span><span class="na">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">org.apache.olingo.odata2.api.processor.ODataSingleProcessor</span><span class="o">;</span>
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyODataSingleProcessor</span> <span class="kd">extends</span> <span class="n">ODataSingleProcessor</span> <span class="o">{</span>
+  <span class="kd">private</span> <span class="n">DataStore</span> <span class="n">dataStore</span> <span class="o">=</span> <span class="k">new</span> <span class="n">DataStore</span><span class="o">();</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li>As next steps we will implement the read access to the Car and Manufacturer entries and the read access to the Cars and Manufacturers feed. As we need some basis for sample data we create a very simple DataStore which contains the data as well as access methods to serve the required data: </li>
+</ul>
+<h5 id="sample-code_11">Sample Code</h5>
+<div class="codehilite"><pre><span class="kn">package</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">odata2</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">service</span><span class="o">;</span>
+
+<span class="kn">import</span> <span class="nn">java.util.ArrayList</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Calendar</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.HashMap</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.Map</span><span class="o">;</span>
+<span class="kn">import</span> <span class="nn">java.util.TimeZone</span><span class="o">;</span>
+
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">DataStore</span> <span class="o">{</span>
+
+  <span class="c1">//Data accessors</span>
+  <span class="kd">public</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">getCar</span><span class="o">(</span><span class="kt">int</span> <span class="n">id</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+
+<span class="n">Calendar</span> <span class="n">updated</span> <span class="o">=</span> <span class="n">Calendar</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">TimeZone</span><span class="o">.</span><span class="na">getTimeZone</span><span class="o">(</span><span class="s">&quot;GMT&quot;</span><span class="o">));</span>
+
+<span class="k">switch</span> <span class="o">(</span><span class="n">id</span><span class="o">)</span> <span class="o">{</span>
+<span class="k">case</span> <span class="mi">1</span><span class="o">:</span>
+  <span class="n">updated</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">2012</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createCar</span><span class="o">(</span><span class="mi">1</span><span class="o">,</span> <span class="s">&quot;F1 W03&quot;</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="mf">189189.43</span><span class="o">,</span> <span class="s">&quot;EUR&quot;</span><span class="o">,</span> <span class="s">&quot;2012&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">,</span> <span class="s">&quot;file://imagePath/w03&quot;</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">case</span> <span class="mi">2</span><span class="o">:</span>
+  <span class="n">updated</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">2013</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createCar</span><span class="o">(</span><span class="mi">2</span><span class="o">,</span> <span class="s">&quot;F1 W04&quot;</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="mf">199999.99</span><span class="o">,</span> <span class="s">&quot;EUR&quot;</span><span class="o">,</span> <span class="s">&quot;2013&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">,</span> <span class="s">&quot;file://imagePath/w04&quot;</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">case</span> <span class="mi">3</span><span class="o">:</span>
+  <span class="n">updated</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">2012</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createCar</span><span class="o">(</span><span class="mi">3</span><span class="o">,</span> <span class="s">&quot;F2012&quot;</span><span class="o">,</span> <span class="mi">2</span><span class="o">,</span> <span class="mf">137285.33</span><span class="o">,</span> <span class="s">&quot;EUR&quot;</span><span class="o">,</span> <span class="s">&quot;2012&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">,</span> <span class="s">&quot;http://pathToImage/f2012&quot;</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">case</span> <span class="mi">4</span><span class="o">:</span>
+  <span class="n">updated</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">2013</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">,</span> <span class="mi">12</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createCar</span><span class="o">(</span><span class="mi">4</span><span class="o">,</span> <span class="s">&quot;F2013&quot;</span><span class="o">,</span> <span class="mi">2</span><span class="o">,</span> <span class="mf">145285.00</span><span class="o">,</span> <span class="s">&quot;EUR&quot;</span><span class="o">,</span> <span class="s">&quot;2013&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">,</span> <span class="s">&quot;http://pathToImage/f2013&quot;</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">case</span> <span class="mi">5</span><span class="o">:</span>
+  <span class="n">updated</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">2011</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">11</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createCar</span><span class="o">(</span><span class="mi">5</span><span class="o">,</span> <span class="s">&quot;F1 W02&quot;</span><span class="o">,</span> <span class="mi">1</span><span class="o">,</span> <span class="mf">167189.00</span><span class="o">,</span> <span class="s">&quot;EUR&quot;</span><span class="o">,</span> <span class="s">&quot;2011&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">,</span> <span class="s">&quot;file://imagePath/wXX&quot;</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">default</span><span class="o">:</span>
+  <span class="k">break</span><span class="o">;</span>
+<span class="o">}</span>
+
+<span class="k">return</span> <span class="n">data</span><span class="o">;</span>
+  <span class="o">}</span>
+
+
+  <span class="kd">private</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">createCar</span><span class="o">(</span><span class="kt">int</span> <span class="n">carId</span><span class="o">,</span> <span class="n">String</span> <span class="n">model</span><span class="o">,</span> <span class="kt">int</span> <span class="n">manufacturerId</span><span class="o">,</span> <span class="kt">double</span> <span class="n">price</span><span class="o">,</span> <span class="n">String</span> <span class="n">currency</span><span class="o">,</span> <span class="n">String</span> <span class="n">modelYear</span><span class="o">,</span> <span class="n">Calendar</span> <span class="n">updated</span><span class="o">,</span> <span class="n">String</span> <span class="n">imagePath</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;();</span>
+
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">,</span> <span class="n">carId</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Model&quot;</span><span class="o">,</span> <span class="n">model</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;ManufacturerId&quot;</span><span class="o">,</span> <span class="n">manufacturerId</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Price&quot;</span><span class="o">,</span> <span class="n">price</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Currency&quot;</span><span class="o">,</span> <span class="n">currency</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;ModelYear&quot;</span><span class="o">,</span> <span class="n">modelYear</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Updated&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;ImagePath&quot;</span><span class="o">,</span> <span class="n">imagePath</span><span class="o">);</span>
+
+<span class="k">return</span> <span class="n">data</span><span class="o">;</span>
+  <span class="o">}</span>
+
+  <span class="kd">public</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">getManufacturer</span><span class="o">(</span><span class="kt">int</span> <span class="n">id</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+<span class="n">Calendar</span> <span class="n">date</span> <span class="o">=</span> <span class="n">Calendar</span><span class="o">.</span><span class="na">getInstance</span><span class="o">(</span><span class="n">TimeZone</span><span class="o">.</span><span class="na">getTimeZone</span><span class="o">(</span><span class="s">&quot;GMT&quot;</span><span class="o">));</span>
+
+<span class="k">switch</span> <span class="o">(</span><span class="n">id</span><span class="o">)</span> <span class="o">{</span>
+<span class="k">case</span> <span class="mi">1</span><span class="o">:</span>
+  <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">addressStar</span> <span class="o">=</span> <span class="n">createAddress</span><span class="o">(</span><span class="s">&quot;Star Street 137&quot;</span><span class="o">,</span> <span class="s">&quot;Stuttgart&quot;</span><span class="o">,</span> <span class="s">&quot;70173&quot;</span><span class="o">,</span> <span class="s">&quot;Germany&quot;</span><span class="o">);</span>
+  <span class="n">date</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">1954</span><span class="o">,</span> <span class="mi">7</span><span class="o">,</span> <span class="mi">4</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createManufacturer</span><span class="o">(</span><span class="mi">1</span><span class="o">,</span> <span class="s">&quot;Star Powered Racing&quot;</span><span class="o">,</span> <span class="n">addressStar</span><span class="o">,</span> <span class="n">date</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">case</span> <span class="mi">2</span><span class="o">:</span>
+  <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">addressHorse</span> <span class="o">=</span> <span class="n">createAddress</span><span class="o">(</span><span class="s">&quot;Horse Street 1&quot;</span><span class="o">,</span> <span class="s">&quot;Maranello&quot;</span><span class="o">,</span> <span class="s">&quot;41053&quot;</span><span class="o">,</span> <span class="s">&quot;Italy&quot;</span><span class="o">);</span>
+  <span class="n">date</span><span class="o">.</span><span class="na">set</span><span class="o">(</span><span class="mi">1929</span><span class="o">,</span> <span class="mi">11</span><span class="o">,</span> <span class="mi">16</span><span class="o">);</span>
+  <span class="n">data</span> <span class="o">=</span> <span class="n">createManufacturer</span><span class="o">(</span><span class="mi">2</span><span class="o">,</span> <span class="s">&quot;Horse Powered Racing&quot;</span><span class="o">,</span> <span class="n">addressHorse</span><span class="o">,</span> <span class="n">date</span><span class="o">);</span>
+  <span class="k">break</span><span class="o">;</span>
+
+<span class="k">default</span><span class="o">:</span>
+  <span class="k">break</span><span class="o">;</span>
+<span class="o">}</span>
+
+<span class="k">return</span> <span class="n">data</span><span class="o">;</span>
+  <span class="o">}</span>
+
+  <span class="kd">private</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">createManufacturer</span><span class="o">(</span><span class="kt">int</span> <span class="n">id</span><span class="o">,</span> <span class="n">String</span> <span class="n">name</span><span class="o">,</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">address</span><span class="o">,</span> <span class="n">Calendar</span> <span class="n">updated</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;();</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">,</span> <span class="n">id</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Name&quot;</span><span class="o">,</span> <span class="n">name</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Address&quot;</span><span class="o">,</span> <span class="n">address</span><span class="o">);</span>
+<span class="n">data</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Updated&quot;</span><span class="o">,</span> <span class="n">updated</span><span class="o">);</span>
+<span class="k">return</span> <span class="n">data</span><span class="o">;</span>
+  <span class="o">}</span>
+
+  <span class="kd">private</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">createAddress</span><span class="o">(</span><span class="n">String</span> <span class="n">street</span><span class="o">,</span> <span class="n">String</span> <span class="n">city</span><span class="o">,</span> <span class="n">String</span> <span class="n">zipCode</span><span class="o">,</span> <span class="n">String</span> <span class="n">country</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">address</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;();</span>
+<span class="n">address</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Street&quot;</span><span class="o">,</span> <span class="n">street</span><span class="o">);</span>
+<span class="n">address</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;City&quot;</span><span class="o">,</span> <span class="n">city</span><span class="o">);</span>
+<span class="n">address</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;ZipCode&quot;</span><span class="o">,</span> <span class="n">zipCode</span><span class="o">);</span>
+<span class="n">address</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">&quot;Country&quot;</span><span class="o">,</span> <span class="n">country</span><span class="o">);</span>
+<span class="k">return</span> <span class="n">address</span><span class="o">;</span>
+  <span class="o">}</span>
+
+
+  <span class="kd">public</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">getCars</span><span class="o">()</span> <span class="o">{</span>
+<span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">cars</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;();</span>
+<span class="n">cars</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getCar</span><span class="o">(</span><span class="mi">1</span><span class="o">));</span>
+<span class="n">cars</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getCar</span><span class="o">(</span><span class="mi">2</span><span class="o">));</span>
+<span class="n">cars</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getCar</span><span class="o">(</span><span class="mi">3</span><span class="o">));</span>
+<span class="n">cars</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getCar</span><span class="o">(</span><span class="mi">4</span><span class="o">));</span>
+<span class="n">cars</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getCar</span><span class="o">(</span><span class="mi">5</span><span class="o">));</span>
+<span class="k">return</span> <span class="n">cars</span><span class="o">;</span>
+  <span class="o">}</span>
+
+  <span class="kd">public</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">getManufacturers</span><span class="o">()</span> <span class="o">{</span>
+<span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">manufacturers</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;();</span>
+<span class="n">manufacturers</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getManufacturer</span><span class="o">(</span><span class="mi">1</span><span class="o">));</span>
+<span class="n">manufacturers</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getManufacturer</span><span class="o">(</span><span class="mi">2</span><span class="o">));</span>
+<span class="k">return</span> <span class="n">manufacturers</span><span class="o">;</span>
+  <span class="o">}</span>
+
+
+  <span class="kd">public</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">getCarsFor</span><span class="o">(</span><span class="kt">int</span> <span class="n">manufacturerId</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">cars</span> <span class="o">=</span> <span class="n">getCars</span><span class="o">();</span>
+<span class="n">List</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">carsForManufacturer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Object</span><span class="o">&gt;&gt;();</span>
+
+<span class="k">for</span> <span class="o">(</span><span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span><span class="n">Object</span><span class="o">&gt;</span> <span class="nl">car:</span> <span class="n">cars</span><span class="o">)</span> <span class="o">{</span>
+  <span class="k">if</span><span class="o">(</span><span class="n">Integer</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">manufacturerId</span><span class="o">).</span><span class="na">equals</span><span class="o">(</span><span class="n">car</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">&quot;ManufacturerId&quot;</span><span class="o">)))</span> <span class="o">{</span>
+    <span class="n">carsForManufacturer</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">car</span><span class="o">);</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+
+<span class="k">return</span> <span class="n">carsForManufacturer</span><span class="o">;</span>
+  <span class="o">}</span>
+
+  <span class="kd">public</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">getManufacturerFor</span><span class="o">(</span><span class="kt">int</span> <span class="n">carId</span><span class="o">)</span> <span class="o">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">car</span> <span class="o">=</span> <span class="n">getCar</span><span class="o">(</span><span class="n">carId</span><span class="o">);</span>
+<span class="k">if</span><span class="o">(</span><span class="n">car</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+  <span class="n">Object</span> <span class="n">manufacturerId</span> <span class="o">=</span> <span class="n">car</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">&quot;ManufacturerId&quot;</span><span class="o">);</span>
+  <span class="k">if</span><span class="o">(</span><span class="n">manufacturerId</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="nf">getManufacturer</span><span class="o">((</span><span class="n">Integer</span><span class="o">)</span> <span class="n">manufacturerId</span><span class="o">);</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+<span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+  <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<ul>
+<li>Implement <code>MyODataSingleProcessor.readEntity(GetEntityUriInfo uriParserResultInfo)</code> by overriding the corresponding method of the ODataSingleProcessor</li>
+</ul>
+<h5 id="sample-code_12">Sample Code</h5>

[... 126 lines stripped ...]


Mime
View raw message