olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r878174 [2/2] - in /websites/staging/olingo/trunk/content: ./ doc/tutorials/ doc/tutorials/basicread.html
Date Thu, 12 Sep 2013 15:01:56 GMT
Added: websites/staging/olingo/trunk/content/doc/tutorials/basicread.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/tutorials/basicread.html (added)
+++ websites/staging/olingo/trunk/content/doc/tutorials/basicread.html Thu Sep 12 15:01:56 2013
@@ -0,0 +1,737 @@
+<!DOCTYPE html>
+<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
+    <head>
+        <meta charset="utf-8">
+            <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+                <title></title>
+                <meta name="description" content="Apache Olingo (incubating) 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="viewport" content="width=device-width">
+                        
+		<link rel="stylesheet" href="/css/bootstrap.min.css">
+                            <style>
+                                body {
+                                    padding-top: 60px;
+                                    padding-bottom: 40px;
+                                }
+                                </style>
+		<link rel="stylesheet" href="/css/bootstrap-responsive.min.css">
+		<link rel="stylesheet" href="/css/main.css">
+                                    
+		<script src="j/s/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
+                                    </head>
+    <body>
+        <!--[if lt IE 7]>
+         <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
+         <![endif]-->
+        
+        <!-- This code is taken from http://twitter.github.com/bootstrap/examples/hero.html -->
+        <div class="navbar navbar-inverse  navbar-fixed-top">
+            <div class="navbar-inner">
+                <div class="container">
+                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+                        <span class="icon-bar"></span>
+                        <span class="icon-bar"></span>
+                        <span class="icon-bar"></span>
+                    </a>
+                    <a class="brand" href="#">Apache Olingo™</a>
+                    <div class="nav-collapse collapse">
+                        <ul class="nav">
+                            <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 class="active"><a href="/">Home</a></li>
+                            <li><a href="/documentation.html">Documentation</a></li>
+                            <li><a href="/support.html">Support</a></li>
+                        </ul>
+                        <form class="navbar-form pull-right" name="search" id="search" action="http://www.google.com/search" method="get">
+                            <input value="olingo.incubator.apache.org" name="sitesearch" type="hidden"/>
+                            <input class="span2" type="text" name="q" id="query">
+                                <input class="btn"type="submit" id="submit" value="Search">
+                                    </form>
+                    </div><!--/.nav-collapse -->
+                </div>
+            </div>
+        </div>
+        
+        <div class="container">
+            
+            
+            
+            <h1 id="read-scenario-odata-library-java">Read Scenario - OData Library (Java)</h1>
+<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>
+<h2 id="prerequisites">Prerequisites</h2>
+<p><strong><em>Project Setup</em></strong> is successfully done. <strong>[link tbd]</strong></p>
+<h2 id="implement-your-odata-service">Implement your OData Service</h2>
+<h3 id="shortcut">Shortcut</h3>
+<p>As a shortcut you can download the <strong><em>Cars-Sample-Read-Basic Project</em></strong>. <strong>[link tbd]</strong></p>
+<h3 id="deployment-descriptor">Deployment Descriptor</h3>
+<ul>
+<li>The sample-web project contains a Deployment Descriptor. Create the web.xml file in the org.apache.olingo.odata2.sample.web project by generating a Deployment Descriptor Stub. Replace the xml in the stub with the following deployment descriptor xml. </li>
+</ul>
+<h6 id="sample-code">Sample Code</h6>
+<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, goto folder <em>~git_repository~\org.apache.olingo.odata2.sample</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>
+<h6 id="sample-code_1">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">package</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">sample</span><span class="p">.</span><span class="n">service</span><span class="p">;</span>
+
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">ODataService</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">ODataServiceFactory</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">edm</span><span class="p">.</span><span class="n">provider</span><span class="p">.</span><span class="n">EdmProvider</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">exception</span><span class="p">.</span><span class="n">ODataException</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">processor</span><span class="p">.</span><span class="n">ODataContext</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">processor</span><span class="p">.</span><span class="n">ODataSingleProcessor</span><span class="p">;</span>
+
+<span class="n">public</span> <span class="n">class</span> <span class="n">MyServiceFactory</span> <span class="n">extends</span> <span class="n">ODataServiceFactory</span> <span class="p">{</span>
+
+  <span class="p">@</span><span class="n">Override</span>
+  <span class="n">public</span> <span class="n">ODataService</span> <span class="n">createService</span><span class="p">(</span><span class="n">ODataContext</span> <span class="n">ctx</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+
+<span class="n">EdmProvider</span> <span class="n">edmProvider</span> <span class="p">=</span> <span class="n">new</span> <span class="n">MyEdmProvider</span><span class="p">();</span>
+<span class="n">ODataSingleProcessor</span> <span class="n">singleProcessor</span> <span class="p">=</span> <span class="n">new</span> <span class="n">MyODataSingleProcessor</span><span class="p">();</span>
+
+<span class="k">return</span> <span class="n">createODataSingleProcessorService</span><span class="p">(</span><span class="n">edmProvider</span><span class="p">,</span> <span class="n">singleProcessor</span><span class="p">);</span>
+  <span class="p">}</span>
+<span class="p">}</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><strong>[GRAPHIC TBD]</strong></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>
+<h6 id="sample-code_2">Sample Code</h6>
+<div class="codehilite"><pre>  <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ENTITY_SET_NAME_MANUFACTURERS</span> <span class="p">=</span> &quot;<span class="n">Manufacturers</span>&quot;<span class="p">;</span>
+  <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ENTITY_SET_NAME_CARS</span> <span class="p">=</span> &quot;<span class="n">Cars</span>&quot;<span class="p">;</span>
+  <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ENTITY_NAME_MANUFACTURER</span> <span class="p">=</span> &quot;<span class="n">Manufacturer</span>&quot;<span class="p">;</span>
+  <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ENTITY_NAME_CAR</span> <span class="p">=</span> &quot;<span class="n">Car</span>&quot;<span class="p">;</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">NAMESPACE</span> <span class="p">=</span> &quot;<span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">ODataCars</span>&quot;<span class="p">;</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">FullQualifiedName</span> <span class="n">ENTITY_TYPE_1_1</span> <span class="p">=</span> <span class="n">new</span> <span class="n">FullQualifiedName</span><span class="p">(</span><span class="n">NAMESPACE</span><span class="p">,</span> <span class="n">ENTITY_NAME_CAR</span><span class="p">);</span>
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">FullQualifiedName</span> <span class="n">ENTITY_TYPE_1_2</span> <span class="p">=</span> <span class="n">new</span> <span class="n">FullQualifiedName</span><span class="p">(</span><span class="n">NAMESPACE</span><span class="p">,</span> <span class="n">ENTITY_NAME_MANUFACTURER</span><span class="p">);</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">FullQualifiedName</span> <span class="n">COMPLEX_TYPE</span> <span class="p">=</span> <span class="n">new</span> <span class="n">FullQualifiedName</span><span class="p">(</span><span class="n">NAMESPACE</span><span class="p">,</span> &quot;<span class="n">Address</span>&quot;<span class="p">);</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">FullQualifiedName</span> <span class="n">ASSOCIATION_CAR_MANUFACTURER</span> <span class="p">=</span> <span class="n">new</span> <span class="n">FullQualifiedName</span><span class="p">(</span><span class="n">NAMESPACE</span><span class="p">,</span> &quot;<span class="n">Car_Manufacturer_Manufacturer_Cars</span>&quot;<span class="p">);</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ROLE_1_1</span> <span class="p">=</span> &quot;<span class="n">Car_Manufacturer</span>&quot;<span class="p">;</span>
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ROLE_1_2</span> <span class="p">=</span> &quot;<span class="n">Manufacturer_Cars</span>&quot;<span class="p">;</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ENTITY_CONTAINER</span> <span class="p">=</span> &quot;<span class="n">ODataCarsEntityContainer</span>&quot;<span class="p">;</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">ASSOCIATION_SET</span> <span class="p">=</span> &quot;<span class="n">Cars_Manufacturers</span>&quot;<span class="p">;</span>
+
+  <span class="n">private</span> <span class="n">static</span> <span class="n">final</span> <span class="n">String</span> <span class="n">FUNCTION_IMPORT</span> <span class="p">=</span> &quot;<span class="n">NumberOfCars</span>&quot;<span class="p">;</span>
+</pre></div>
+
+
+<ul>
+<li>Implement <code>MyEdmProvider.getSchemas</code>. This method is used to retrieve the complete structural information on order to build the <code>$metadata</code> file and the service document. The implementation makes use of other getter 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>
+<h6 id="sample-code_3">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">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="p">()</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Schema</span><span class="o">&gt;</span><span class="p">();</span>
+
+<span class="n">Schema</span> <span class="n">schema</span> <span class="p">=</span> <span class="n">new</span> <span class="n">Schema</span><span class="p">();</span>
+<span class="n">schema</span><span class="p">.</span><span class="n">setNamespace</span><span class="p">(</span><span class="n">NAMESPACE</span><span class="p">);</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">EntityType</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">entityTypes</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getEntityType</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="p">));</span>
+<span class="n">entityTypes</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getEntityType</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="p">));</span>
+<span class="n">schema</span><span class="p">.</span><span class="n">setEntityTypes</span><span class="p">(</span><span class="n">entityTypes</span><span class="p">);</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">ComplexType</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">complexTypes</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getComplexType</span><span class="p">(</span><span class="n">COMPLEX_TYPE</span><span class="p">));</span>
+<span class="n">schema</span><span class="p">.</span><span class="n">setComplexTypes</span><span class="p">(</span><span class="n">complexTypes</span><span class="p">);</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Association</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">associations</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getAssociation</span><span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">));</span>
+<span class="n">schema</span><span class="p">.</span><span class="n">setAssociations</span><span class="p">(</span><span class="n">associations</span><span class="p">);</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">EntityContainer</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">EntityContainer</span> <span class="n">entityContainer</span> <span class="p">=</span> <span class="n">new</span> <span class="n">EntityContainer</span><span class="p">();</span>
+<span class="n">entityContainer</span><span class="p">.</span><span class="n">setName</span><span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">).</span><span class="n">setDefaultEntityContainer</span><span class="p">(</span><span class="n">true</span><span class="p">);</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">EntitySet</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">entitySets</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getEntitySet</span><span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">,</span> <span class="n">ENTITY_SET_NAME_CARS</span><span class="p">));</span>
+<span class="n">entitySets</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getEntitySet</span><span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">,</span> <span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="p">));</span>
+<span class="n">entityContainer</span><span class="p">.</span><span class="n">setEntitySets</span><span class="p">(</span><span class="n">entitySets</span><span class="p">);</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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">AssociationSet</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">associationSets</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getAssociationSet</span><span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">,</span> <span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">,</span> <span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="p">,</span> <span class="n">ROLE_1_2</span><span class="p">));</span>
+<span class="n">entityContainer</span><span class="p">.</span><span class="n">setAssociationSets</span><span class="p">(</span><span class="n">associationSets</span><span class="p">);</span>
+
+<span class="n">List</span><span class="o">&lt;</span><span class="n">FunctionImport</span><span class="o">&gt;</span> <span class="n">functionImports</span> <span class="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">FunctionImport</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="k">function</span><span class="nf">Imports.add(getFunctionImport</span><span class="p">(</span>ENTITY_CONTAINER, FUNCTION_IMPORT)<span class="p">);</span>
+<span class="n">entityContainer</span><span class="p">.</span><span class="n">setFunctionImports</span><span class="p">(</span><span class="n">functionImports</span><span class="p">);</span>
+
+<span class="n">entityContainers</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">entityContainer</span><span class="p">);</span>
+<span class="n">schema</span><span class="p">.</span><span class="n">setEntityContainers</span><span class="p">(</span><span class="n">entityContainers</span><span class="p">);</span>
+
+<span class="n">schemas</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">schema</span><span class="p">);</span>
+
+<span class="k">return</span> <span class="n">schemas</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getEntityType(FullQualifiedName edmFQName)</code>. Returning 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>
+<h6 id="sample-code_4">Sample Code</h6>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Override</span>
+  <span class="n">public</span> <span class="n">EntityType</span> <span class="n">getEntityType</span><span class="p">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">NAMESPACE</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getNamespace</span><span class="p">()))</span> <span class="p">{</span>
+
+  <span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="p">.</span><span class="n">getName</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getName</span><span class="p">()))</span> <span class="p">{</span>
+
+    <span class="o">//</span><span class="n">Properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="k">properties</span> <span class="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Id</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">Int32</span><span class="p">).</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setNullable</span><span class="p">(</span><span class="n">false</span><span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Model</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">).</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setNullable</span><span class="p">(</span><span class="n">false</span><span class="p">).</span><span class="n">setMaxLength</span><span class="p">(</span>100<span class="p">).</span><span class="n">setDefaultValue</span><span class="p">(</span>&quot;<span class="n">Hugo</span>&quot;<span class="p">))</span>
+        <span class="p">.</span><span class="n">setCustomizableFeedMappings</span><span class="p">(</span><span class="n">new</span> <span class="n">CustomizableFeedMappings</span><span class="p">().</span><span class="n">setFcTargetPath</span><span class="p">(</span><span class="n">EdmTargetPath</span><span class="p">.</span><span class="n">SYNDICATION_TITLE</span><span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">ManufacturerId</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">Int32</span><span class="p">));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Price</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">Decimal</span><span class="p">));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Currency</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">).</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setMaxLength</span><span class="p">(</span>3<span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">ModelYear</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">).</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setMaxLength</span><span class="p">(</span>4<span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Updated</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">DateTime</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setNullable</span><span class="p">(</span><span class="n">false</span><span class="p">).</span><span class="n">setConcurrencyMode</span><span class="p">(</span><span class="n">EdmConcurrencyMode</span><span class="p">.</span><span class="n">Fixed</span><span class="p">))</span>
+        <span class="p">.</span><span class="n">setCustomizableFeedMappings</span><span class="p">(</span><span class="n">new</span> <span class="n">CustomizableFeedMappings</span><span class="p">().</span><span class="n">setFcTargetPath</span><span class="p">(</span><span class="n">EdmTargetPath</span><span class="p">.</span><span class="n">SYNDICATION_UPDATED</span><span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">ImagePath</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">));</span>
+
+    <span class="o">//</span><span class="n">Navigation</span> <span class="n">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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">navigationProperties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">NavigationProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Manufacturer</span>&quot;<span class="p">)</span>
+        <span class="p">.</span><span class="n">setRelationship</span><span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">).</span><span class="n">setFromRole</span><span class="p">(</span><span class="n">ROLE_1_1</span><span class="p">).</span><span class="n">setToRole</span><span class="p">(</span><span class="n">ROLE_1_2</span><span class="p">));</span>
+
+    <span class="o">//</span><span class="n">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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">keyProperties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">PropertyRef</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Id</span>&quot;<span class="p">));</span>
+    <span class="n">Key</span> <span class="n">key</span> <span class="p">=</span> <span class="n">new</span> <span class="n">Key</span><span class="p">().</span><span class="n">setKeys</span><span class="p">(</span><span class="n">keyProperties</span><span class="p">);</span>
+
+    <span class="k">return</span> <span class="n">new</span> <span class="n">EntityType</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="p">.</span><span class="n">getName</span><span class="p">())</span>
+        <span class="p">.</span><span class="n">setProperties</span><span class="p">(</span><span class="k">properties</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setKey</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setNavigationProperties</span><span class="p">(</span><span class="n">navigationProperties</span><span class="p">);</span>
+
+  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="p">.</span><span class="n">getName</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getName</span><span class="p">()))</span> <span class="p">{</span>
+
+    <span class="o">//</span><span class="n">Properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="k">properties</span> <span class="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Id</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">Int32</span><span class="p">).</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setNullable</span><span class="p">(</span><span class="n">false</span><span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Name</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">).</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setNullable</span><span class="p">(</span><span class="n">false</span><span class="p">).</span><span class="n">setMaxLength</span><span class="p">(</span>100<span class="p">))</span>
+        <span class="p">.</span><span class="n">setCustomizableFeedMappings</span><span class="p">(</span><span class="n">new</span> <span class="n">CustomizableFeedMappings</span><span class="p">().</span><span class="n">setFcTargetPath</span><span class="p">(</span><span class="n">EdmTargetPath</span><span class="p">.</span><span class="n">SYNDICATION_TITLE</span><span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">ComplexProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Address</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">new</span> <span class="n">FullQualifiedName</span><span class="p">(</span><span class="n">NAMESPACE</span><span class="p">,</span> &quot;<span class="n">Address</span>&quot;<span class="p">)));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Updated</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">DateTime</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setFacets</span><span class="p">(</span><span class="n">new</span> <span class="n">Facets</span><span class="p">().</span><span class="n">setNullable</span><span class="p">(</span><span class="n">false</span><span class="p">).</span><span class="n">setConcurrencyMode</span><span class="p">(</span><span class="n">EdmConcurrencyMode</span><span class="p">.</span><span class="n">Fixed</span><span class="p">))</span>
+        <span class="p">.</span><span class="n">setCustomizableFeedMappings</span><span class="p">(</span><span class="n">new</span> <span class="n">CustomizableFeedMappings</span><span class="p">().</span><span class="n">setFcTargetPath</span><span class="p">(</span><span class="n">EdmTargetPath</span><span class="p">.</span><span class="n">SYNDICATION_UPDATED</span><span class="p">)));</span>
+
+    <span class="o">//</span><span class="n">Navigation</span> <span class="n">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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">navigationProperties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">NavigationProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Cars</span>&quot;<span class="p">)</span>
+        <span class="p">.</span><span class="n">setRelationship</span><span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">).</span><span class="n">setFromRole</span><span class="p">(</span><span class="n">ROLE_1_2</span><span class="p">).</span><span class="n">setToRole</span><span class="p">(</span><span class="n">ROLE_1_1</span><span class="p">));</span>
+
+    <span class="o">//</span><span class="n">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="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">keyProperties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">PropertyRef</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Id</span>&quot;<span class="p">));</span>
+    <span class="n">Key</span> <span class="n">key</span> <span class="p">=</span> <span class="n">new</span> <span class="n">Key</span><span class="p">().</span><span class="n">setKeys</span><span class="p">(</span><span class="n">keyProperties</span><span class="p">);</span>
+
+    <span class="k">return</span> <span class="n">new</span> <span class="n">EntityType</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="p">.</span><span class="n">getName</span><span class="p">())</span>
+        <span class="p">.</span><span class="n">setProperties</span><span class="p">(</span><span class="k">properties</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setHasStream</span><span class="p">(</span><span class="n">true</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setKey</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setNavigationProperties</span><span class="p">(</span><span class="n">navigationProperties</span><span class="p">);</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getComplexType(FullQualifiedName edmFQName)</code> </li>
+</ul>
+<h6 id="sample-code_5">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">ComplexType</span> <span class="n">getComplexType</span><span class="p">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">NAMESPACE</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getNamespace</span><span class="p">()))</span> <span class="p">{</span>
+  <span class="k">if</span> <span class="p">(</span><span class="n">COMPLEX_TYPE</span><span class="p">.</span><span class="n">getName</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getName</span><span class="p">()))</span> <span class="p">{</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="k">properties</span> <span class="p">=</span> <span class="n">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Street</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">City</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">ZipCode</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">));</span>
+    <span class="k">properties</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">new</span> <span class="n">SimpleProperty</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">Country</span>&quot;<span class="p">).</span><span class="n">setType</span><span class="p">(</span><span class="n">EdmSimpleTypeKind</span><span class="p">.</span><span class="n">String</span><span class="p">));</span>
+    <span class="k">return</span> <span class="n">new</span> <span class="n">ComplexType</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">COMPLEX_TYPE</span><span class="p">.</span><span class="n">getName</span><span class="p">()).</span><span class="n">setProperties</span><span class="p">(</span><span class="k">properties</span><span class="p">);</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getAssociation(FullQualifiedName edmFQName)</code> </li>
+</ul>
+<h6 id="sample-code_6">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">Association</span> <span class="n">getAssociation</span><span class="p">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">NAMESPACE</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getNamespace</span><span class="p">()))</span> <span class="p">{</span>
+  <span class="k">if</span> <span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">.</span><span class="n">getName</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span><span class="n">edmFQName</span><span class="p">.</span><span class="n">getName</span><span class="p">()))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="n">new</span> <span class="n">Association</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">.</span><span class="n">getName</span><span class="p">())</span>
+        <span class="p">.</span><span class="n">setEnd1</span><span class="p">(</span><span class="n">new</span> <span class="n">AssociationEnd</span><span class="p">().</span><span class="n">setType</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="p">).</span><span class="n">setRole</span><span class="p">(</span><span class="n">ROLE_1_1</span><span class="p">).</span><span class="n">setMultiplicity</span><span class="p">(</span><span class="n">EdmMultiplicity</span><span class="p">.</span><span class="n">MANY</span><span class="p">))</span>
+        <span class="p">.</span><span class="n">setEnd2</span><span class="p">(</span><span class="n">new</span> <span class="n">AssociationEnd</span><span class="p">().</span><span class="n">setType</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="p">).</span><span class="n">setRole</span><span class="p">(</span><span class="n">ROLE_1_2</span><span class="p">).</span><span class="n">setMultiplicity</span><span class="p">(</span><span class="n">EdmMultiplicity</span><span class="p">.</span><span class="n">ONE</span><span class="p">));</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+<span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getEntityContainerInfo(String name)</code> </li>
+</ul>
+<h6 id="sample-code_7">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">EntityContainerInfo</span> <span class="n">getEntityContainerInfo</span><span class="p">(</span><span class="n">String</span> <span class="n">name</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">name</span> <span class="o">==</span> <span class="n">null</span> <span class="o">||</span> &quot;<span class="n">ODataCarsEntityContainer</span>&quot;<span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">name</span><span class="p">))</span> <span class="p">{</span>
+  <span class="k">return</span> <span class="n">new</span> <span class="n">EntityContainerInfo</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span>&quot;<span class="n">ODataCarsEntityContainer</span>&quot;<span class="p">).</span><span class="n">setDefaultEntityContainer</span><span class="p">(</span><span class="n">true</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getEntitySet(String entityContainer, String name)</code></li>
+</ul>
+<h6 id="sample-code_8">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">EntitySet</span> <span class="n">getEntitySet</span><span class="p">(</span><span class="n">String</span> <span class="n">entityContainer</span><span class="p">,</span> <span class="n">String</span> <span class="n">name</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">entityContainer</span><span class="p">))</span> <span class="p">{</span>
+  <span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">name</span><span class="p">))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="n">new</span> <span class="n">EntitySet</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">name</span><span class="p">).</span><span class="n">setEntityType</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="p">);</span>
+  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">name</span><span class="p">))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="n">new</span> <span class="n">EntitySet</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">name</span><span class="p">).</span><span class="n">setEntityType</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="p">);</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+<span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getAssociationSet(String entityContainer, FullQualifiedName association, String sourceEntitySetName, String sourceEntitySetRole)</code></li>
+</ul>
+<h6 id="sample-code_9">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">AssociationSet</span> <span class="n">getAssociationSet</span><span class="p">(</span><span class="n">String</span> <span class="n">entityContainer</span><span class="p">,</span> <span class="n">FullQualifiedName</span> <span class="n">association</span><span class="p">,</span> <span class="n">String</span> <span class="n">sourceEntitySetName</span><span class="p">,</span> <span class="n">String</span> <span class="n">sourceEntitySetRole</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">entityContainer</span><span class="p">))</span> <span class="p">{</span>
+  <span class="k">if</span> <span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">association</span><span class="p">))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="n">new</span> <span class="n">AssociationSet</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">ASSOCIATION_SET</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setAssociation</span><span class="p">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setEnd1</span><span class="p">(</span><span class="n">new</span> <span class="n">AssociationSetEnd</span><span class="p">().</span><span class="n">setRole</span><span class="p">(</span><span class="n">ROLE_1_2</span><span class="p">).</span><span class="n">setEntitySet</span><span class="p">(</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="p">))</span>
+        <span class="p">.</span><span class="n">setEnd2</span><span class="p">(</span><span class="n">new</span> <span class="n">AssociationSetEnd</span><span class="p">().</span><span class="n">setRole</span><span class="p">(</span><span class="n">ROLE_1_1</span><span class="p">).</span><span class="n">setEntitySet</span><span class="p">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="p">));</span>
+  <span class="p">}</span>
+<span class="p">}</span>
+<span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<ul>
+<li><code>MyEdmProvider.getFunctionImport(String entityContainer, String name)</code> </li>
+</ul>
+<h6 id="sample-code_10">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">FunctionImport</span> <span class="n">getFunctionImport</span><span class="p">(</span><span class="n">String</span> <span class="n">entityContainer</span><span class="p">,</span> <span class="n">String</span> <span class="n">name</span><span class="p">)</span> <span class="n">throws</span> <span class="n">ODataException</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">entityContainer</span><span class="p">))</span> <span class="p">{</span>
+  <span class="k">if</span> <span class="p">(</span><span class="n">FUNCTION_IMPORT</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">name</span><span class="p">))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="n">new</span> <span class="n">FunctionImport</span><span class="p">().</span><span class="n">setName</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
+        <span class="p">.</span><span class="n">setReturnType</span><span class="p">(</span><span class="n">new</span> <span class="n">ReturnType</span><span class="p">().</span><span class="n">setTypeName</span><span class="p">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="p">).</span><span class="n">setMultiplicity</span><span class="p">(</span><span class="n">EdmMultiplicity</span><span class="p">.</span><span class="n">MANY</span><span class="p">))</span>
+        <span class="p">.</span><span class="n">setHttpMethod</span><span class="p">(</span>&quot;<span class="n">GET</span>&quot;<span class="p">);</span>
+  <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="n">null</span><span class="p">;</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<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. Remember? <code>mvn clean install</code> </li>
+<li>Deploy the Web Application to the server* </li>
+<li>Show the Service Document: ~/MyODataSample.svc/</li>
+<li>Show the Metadata Document: ~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>
+<h6 id="sample-code_11">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">package</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">sample</span><span class="p">.</span><span class="n">service</span><span class="p">;</span>
+
+<span class="n">import</span> <span class="n">static</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">sample</span><span class="p">.</span><span class="n">service</span><span class="p">.</span><span class="n">MyEdmProvider</span><span class="p">.</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">static</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">sample</span><span class="p">.</span><span class="n">service</span><span class="p">.</span><span class="n">MyEdmProvider</span><span class="p">.</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="p">;</span>
+
+<span class="n">import</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">api</span><span class="p">.</span><span class="n">processor</span><span class="p">.</span><span class="n">ODataSingleProcessor</span><span class="p">;</span>
+
+<span class="n">public</span> <span class="n">class</span> <span class="n">MyODataSingleProcessor</span> <span class="n">extends</span> <span class="n">ODataSingleProcessor</span> <span class="p">{</span>
+  <span class="n">private</span> <span class="n">DataStore</span> <span class="n">dataStore</span> <span class="p">=</span> <span class="n">new</span> <span class="n">DataStore</span><span class="p">();</span>
+<span class="p">}</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>
+<h6 id="sample-code_12">Sample Code</h6>
+<div class="codehilite"><pre><span class="n">package</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span><span class="p">.</span><span class="n">odata2</span><span class="p">.</span><span class="n">sample</span><span class="p">.</span><span class="n">service</span><span class="p">;</span>
+
+<span class="n">import</span> <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">ArrayList</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">Calendar</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">HashMap</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">List</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">Map</span><span class="p">;</span>
+<span class="n">import</span> <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">TimeZone</span><span class="p">;</span>
+
+<span class="n">public</span> <span class="n">class</span> <span class="n">DataStore</span> <span class="p">{</span>
+
+  <span class="o">//</span><span class="n">Data</span> <span class="n">accessors</span>
+  <span class="n">public</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">getCar</span><span class="p">(</span><span class="n">int</span> <span class="n">id</span><span class="p">)</span> <span class="p">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="p">=</span> <span class="n">null</span><span class="p">;</span>
+
+<span class="n">Calendar</span> <span class="n">updated</span> <span class="p">=</span> <span class="n">Calendar</span><span class="p">.</span><span class="n">getInstance</span><span class="p">(</span><span class="n">TimeZone</span><span class="p">.</span><span class="n">getTimeZone</span><span class="p">(</span>&quot;<span class="n">GMT</span>&quot;<span class="p">));</span>
+
+<span class="k">switch</span> <span class="p">(</span><span class="n">id</span><span class="p">)</span> <span class="p">{</span>
+<span class="k">case</span> 1<span class="p">:</span>
+  <span class="n">updated</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>2012<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createCar</span><span class="p">(</span>1<span class="p">,</span> &quot;<span class="n">F1</span> <span class="n">W03</span>&quot;<span class="p">,</span> 1<span class="p">,</span> 189189<span class="p">.</span>43<span class="p">,</span> &quot;<span class="n">EUR</span>&quot;<span class="p">,</span> &quot;2012&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">,</span> &quot;<span class="n">file</span><span class="p">:</span><span class="o">//</span><span class="n">imagePath</span><span class="o">/</span><span class="n">w03</span>&quot;<span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="k">case</span> 2<span class="p">:</span>
+  <span class="n">updated</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>2013<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createCar</span><span class="p">(</span>2<span class="p">,</span> &quot;<span class="n">F1</span> <span class="n">W04</span>&quot;<span class="p">,</span> 1<span class="p">,</span> 199999<span class="p">.</span>99<span class="p">,</span> &quot;<span class="n">EUR</span>&quot;<span class="p">,</span> &quot;2013&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">,</span> &quot;<span class="n">file</span><span class="p">:</span><span class="o">//</span><span class="n">imagePath</span><span class="o">/</span><span class="n">w04</span>&quot;<span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="k">case</span> 3<span class="p">:</span>
+  <span class="n">updated</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>2012<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createCar</span><span class="p">(</span>3<span class="p">,</span> &quot;<span class="n">F2012</span>&quot;<span class="p">,</span> 2<span class="p">,</span> 137285<span class="p">.</span>33<span class="p">,</span> &quot;<span class="n">EUR</span>&quot;<span class="p">,</span> &quot;2012&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">,</span> &quot;<span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">pathToImage</span><span class="o">/</span><span class="n">f2012</span>&quot;<span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="k">case</span> 4<span class="p">:</span>
+  <span class="n">updated</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>2013<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">,</span> 12<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createCar</span><span class="p">(</span>4<span class="p">,</span> &quot;<span class="n">F2013</span>&quot;<span class="p">,</span> 2<span class="p">,</span> 145285<span class="p">.</span>00<span class="p">,</span> &quot;<span class="n">EUR</span>&quot;<span class="p">,</span> &quot;2013&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">,</span> &quot;<span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">pathToImage</span><span class="o">/</span><span class="n">f2013</span>&quot;<span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="k">case</span> 5<span class="p">:</span>
+  <span class="n">updated</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>2011<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">,</span> 11<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createCar</span><span class="p">(</span>5<span class="p">,</span> &quot;<span class="n">F1</span> <span class="n">W02</span>&quot;<span class="p">,</span> 1<span class="p">,</span> 167189<span class="p">.</span>00<span class="p">,</span> &quot;<span class="n">EUR</span>&quot;<span class="p">,</span> &quot;2011&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">,</span> &quot;<span class="n">file</span><span class="p">:</span><span class="o">//</span><span class="n">imagePath</span><span class="o">/</span><span class="n">wXX</span>&quot;<span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="n">default</span><span class="p">:</span>
+  <span class="k">break</span><span class="p">;</span>
+<span class="p">}</span>
+
+<span class="k">return</span> <span class="n">data</span><span class="p">;</span>
+  <span class="p">}</span>
+
+
+  <span class="n">private</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">createCar</span><span class="p">(</span><span class="n">int</span> <span class="n">carId</span><span class="p">,</span> <span class="n">String</span> <span class="n">model</span><span class="p">,</span> <span class="n">int</span> <span class="n">manufacturerId</span><span class="p">,</span> <span class="n">double</span> <span class="n">price</span><span class="p">,</span> <span class="n">String</span> <span class="n">currency</span><span class="p">,</span> <span class="n">String</span> <span class="n">modelYear</span><span class="p">,</span> <span class="n">Calendar</span> <span class="n">updated</span><span class="p">,</span> <span class="n">String</span> <span class="n">imagePath</span><span class="p">)</span> <span class="p">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="p">=</span> <span class="n">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span><span class="p">();</span>
+
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Id</span>&quot;<span class="p">,</span> <span class="n">carId</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Model</span>&quot;<span class="p">,</span> <span class="n">model</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">ManufacturerId</span>&quot;<span class="p">,</span> <span class="n">manufacturerId</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Price</span>&quot;<span class="p">,</span> <span class="n">price</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Currency</span>&quot;<span class="p">,</span> <span class="n">currency</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">ModelYear</span>&quot;<span class="p">,</span> <span class="n">modelYear</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Updated</span>&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">ImagePath</span>&quot;<span class="p">,</span> <span class="n">imagePath</span><span class="p">);</span>
+
+<span class="k">return</span> <span class="n">data</span><span class="p">;</span>
+  <span class="p">}</span>
+
+  <span class="n">public</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">getManufacturer</span><span class="p">(</span><span class="n">int</span> <span class="n">id</span><span class="p">)</span> <span class="p">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="p">=</span> <span class="n">null</span><span class="p">;</span>
+<span class="n">Calendar</span> <span class="n">date</span> <span class="p">=</span> <span class="n">Calendar</span><span class="p">.</span><span class="n">getInstance</span><span class="p">(</span><span class="n">TimeZone</span><span class="p">.</span><span class="n">getTimeZone</span><span class="p">(</span>&quot;<span class="n">GMT</span>&quot;<span class="p">));</span>
+
+<span class="k">switch</span> <span class="p">(</span><span class="n">id</span><span class="p">)</span> <span class="p">{</span>
+<span class="k">case</span> 1<span class="p">:</span>
+  <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">addressStar</span> <span class="p">=</span> <span class="n">createAddress</span><span class="p">(</span>&quot;<span class="n">Star</span> <span class="n">Street</span> 137&quot;<span class="p">,</span> &quot;<span class="n">Stuttgart</span>&quot;<span class="p">,</span> &quot;70173&quot;<span class="p">,</span> &quot;<span class="n">Germany</span>&quot;<span class="p">);</span>
+  <span class="n">date</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>1954<span class="p">,</span> 7<span class="p">,</span> 4<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createManufacturer</span><span class="p">(</span>1<span class="p">,</span> &quot;<span class="n">Star</span> <span class="n">Powered</span> <span class="n">Racing</span>&quot;<span class="p">,</span> <span class="n">addressStar</span><span class="p">,</span> <span class="n">date</span><span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="k">case</span> 2<span class="p">:</span>
+  <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">addressHorse</span> <span class="p">=</span> <span class="n">createAddress</span><span class="p">(</span>&quot;<span class="n">Horse</span> <span class="n">Street</span> 1&quot;<span class="p">,</span> &quot;<span class="n">Maranello</span>&quot;<span class="p">,</span> &quot;41053&quot;<span class="p">,</span> &quot;<span class="n">Italy</span>&quot;<span class="p">);</span>
+  <span class="n">date</span><span class="p">.</span><span class="n">set</span><span class="p">(</span>1929<span class="p">,</span> 11<span class="p">,</span> 16<span class="p">);</span>
+  <span class="n">data</span> <span class="p">=</span> <span class="n">createManufacturer</span><span class="p">(</span>2<span class="p">,</span> &quot;<span class="n">Horse</span> <span class="n">Powered</span> <span class="n">Racing</span>&quot;<span class="p">,</span> <span class="n">addressHorse</span><span class="p">,</span> <span class="n">date</span><span class="p">);</span>
+  <span class="k">break</span><span class="p">;</span>
+
+<span class="n">default</span><span class="p">:</span>
+  <span class="k">break</span><span class="p">;</span>
+<span class="p">}</span>
+
+<span class="k">return</span> <span class="n">data</span><span class="p">;</span>
+  <span class="p">}</span>
+
+  <span class="n">private</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">createManufacturer</span><span class="p">(</span><span class="n">int</span> <span class="n">id</span><span class="p">,</span> <span class="n">String</span> <span class="n">name</span><span class="p">,</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">address</span><span class="p">,</span> <span class="n">Calendar</span> <span class="n">updated</span><span class="p">)</span> <span class="p">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="p">=</span> <span class="n">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Id</span>&quot;<span class="p">,</span> <span class="n">id</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Name</span>&quot;<span class="p">,</span> <span class="n">name</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Address</span>&quot;<span class="p">,</span> <span class="n">address</span><span class="p">);</span>
+<span class="n">data</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Updated</span>&quot;<span class="p">,</span> <span class="n">updated</span><span class="p">);</span>
+<span class="k">return</span> <span class="n">data</span><span class="p">;</span>
+  <span class="p">}</span>
+
+  <span class="n">private</span> <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">createAddress</span><span class="p">(</span><span class="n">String</span> <span class="n">street</span><span class="p">,</span> <span class="n">String</span> <span class="n">city</span><span class="p">,</span> <span class="n">String</span> <span class="n">zipCode</span><span class="p">,</span> <span class="n">String</span> <span class="n">country</span><span class="p">)</span> <span class="p">{</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">address</span> <span class="p">=</span> <span class="n">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">address</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Street</span>&quot;<span class="p">,</span> <span class="n">street</span><span class="p">);</span>
+<span class="n">address</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">City</span>&quot;<span class="p">,</span> <span class="n">city</span><span class="p">);</span>
+<span class="n">address</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">ZipCode</span>&quot;<span class="p">,</span> <span class="n">zipCode</span><span class="p">);</span>
+<span class="n">address</span><span class="p">.</span><span class="n">put</span><span class="p">(</span>&quot;<span class="n">Country</span>&quot;<span class="p">,</span> <span class="n">country</span><span class="p">);</span>
+<span class="k">return</span> <span class="n">address</span><span class="p">;</span>
+  <span class="p">}</span>
+
+
+  <span class="n">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="p">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">getCars</span><span class="p">()</span> <span class="p">{</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="p">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">cars</span> <span class="p">=</span> <span class="n">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="p">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span><span class="p">();</span>
+<span class="n">cars</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getCar</span><span class="p">(</span>1<span class="p">));</span>
+<span class="n">cars</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getCar</span><span class="p">(</span>2<span class="p">));</span>
+<span class="n">cars</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getCar</span><span class="p">(</span>3<span class="p">));</span>
+<span class="n">cars</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getCar</span><span class="p">(</span>4<span class="p">));</span>
+<span class="n">cars</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getCar</span><span class="p">(</span>5<span class="p">));</span>
+<span class="k">return</span> <span class="n">cars</span><span class="p">;</span>
+  <span class="p">}</span>
+
+  <span class="n">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="p">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">getManufacturers</span><span class="p">()</span> <span class="p">{</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="p">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span> <span class="n">manufacturers</span> <span class="p">=</span> <span class="n">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="p">,</span> <span class="n">Object</span><span class="o">&gt;&gt;</span><span class="p">();</span>
+<span class="n">manufacturers</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getManufacturer</span><span class="p">(</span>1<span class="p">));</span>
+<span class="n">manufacturers</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getManufacturer</span><span class="p">(</span>2<span class="p">));</span>

[... 166 lines stripped ...]


Mime
View raw message