Repository: olingo-odata4
Updated Branches:
  refs/heads/master 795af6e38 -> 101266e86


[OLINGO-365] Better handling of derived types in entity and complex type 
collections


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4ead5f41
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4ead5f41
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4ead5f41

Branch: refs/heads/master
Commit: 4ead5f41b8a8467075509ec8dae1b6bd93b943cc
Parents: 82a73c5
Author: Francesco Chicchiriccò <--global>
Authored: Thu Jul 31 11:08:13 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Thu Jul 31 11:08:13 2014 +0200

----------------------------------------------------------------------
 .../olingo/ext/proxy/AbstractService.java       |  2 +
 .../AbstractCollectionInvocationHandler.java    |  1 -
 ...stractEntityCollectionInvocationHandler.java | 14 +++++--
 .../ComplexCollectionInvocationHandler.java     | 11 +++++-
 .../PrimitiveCollectionInvocationHandler.java   |  4 +-
 .../olingo/ext/pojogen/AbstractPOJOGenMojo.java | 11 ++++--
 .../src/main/resources/service.vm               | 10 +++++
 .../fit/proxy/v3/actionoverloading/Service.java | 39 ++++++++++++++++++++
 .../olingo/fit/proxy/v3/opentype/Service.java   | 10 +++++
 .../fit/proxy/v3/primitivekeys/Service.java     | 22 +++++++++++
 .../fit/proxy/v3/staticservice/Service.java     | 39 ++++++++++++++++++++
 .../olingo/fit/proxy/v4/demo/Service.java       | 17 +++++++++
 .../olingo/fit/proxy/v4/opentype/Service.java   | 10 +++++
 .../fit/proxy/v4/staticservice/Service.java     | 29 +++++++++++++++
 14 files changed, 208 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
----------------------------------------------------------------------
diff --git 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
index a2a05fd..958494f 100644
--- 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
+++ 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
@@ -91,6 +91,8 @@ public abstract class AbstractService<C extends 
CommonEdmEnabledODataClient<?>>
     this.context = new Context();
   }
 
+  public abstract Class<?> getEntityTypeClass(String name);
+  
   public abstract Class<?> getComplexTypeClass(String name);
 
   public abstract Class<?> getEnumTypeClass(String name);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
index d276302..a24565c 100644
--- 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
+++ 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractCollectionInvocationHandler.java
@@ -93,7 +93,6 @@ public abstract class AbstractCollectionInvocationHandler<T 
extends Serializable
     });
   }
 
-  @SuppressWarnings("unchecked")
   public Collection<T> execute() {
     if (this.uri != null) {
       final Triple<List<T>, URI, List<ODataAnnotation>> res = 
fetchPartial(this.uri.build(), itemRef);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java
 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java
index 9a15c78..b7e4360 100644
--- 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java
+++ 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractEntityCollectionInvocationHandler.java
@@ -129,23 +129,31 @@ public abstract class 
AbstractEntityCollectionInvocationHandler<
     final List<T> res = new ArrayList<T>(entities.size());
 
     for (CommonODataEntity entity : entities) {
+      Class<?> actualRef = null;
+      if (entity.getTypeName() != null) {
+        actualRef = 
service.getEntityTypeClass(entity.getTypeName().toString());
+      }
+      if (actualRef == null) {
+        actualRef = typeRef;
+      }
+      
       final EntityInvocationHandler handler =
               this instanceof EntitySetInvocationHandler
               ? EntityInvocationHandler.getInstance(
               entity,
               EntitySetInvocationHandler.class.cast(this),
-              typeRef)
+              actualRef)
               : EntityInvocationHandler.getInstance(
               entity,
               targetEntitySetURI,
-              typeRef,
+              actualRef,
               service);
 
       final EntityInvocationHandler handlerInTheContext = 
getContext().entityContext().getEntity(handler.getUUID());
 
       res.add((T) Proxy.newProxyInstance(
               Thread.currentThread().getContextClassLoader(),
-              new Class<?>[] {typeRef},
+              new Class<?>[] {actualRef},
               handlerInTheContext == null ? handler : handlerInTheContext));
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
index 1fe242b..342a2a6 100644
--- 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
+++ 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexCollectionInvocationHandler.java
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.ImmutableTriple;
 import org.apache.commons.lang3.tuple.Triple;
 import 
org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
@@ -110,7 +111,15 @@ public class ComplexCollectionInvocationHandler<T extends 
ComplexType<?>>
     final CommonODataProperty property = res.getBody();
     if (property != null && property.hasCollectionValue()) {
       for (ODataValue item : (ODataCollectionValue<ODataValue>) 
property.getValue()) {
-        resItems.add((T) getComplex(property.getName(), item, typeRef, null, 
null, true));
+        Class<?> actualRef = null;
+        if (StringUtils.isNotBlank(item.getTypeName())) {
+          actualRef = service.getComplexTypeClass(item.getTypeName());
+        }
+        if (actualRef == null) {
+          actualRef = typeRef;
+        }
+
+        resItems.add((T) getComplex(property.getName(), item, actualRef, null, 
null, true));
       }
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
----------------------------------------------------------------------
diff --git 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
index 48908c9..650e369 100644
--- 
a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
+++ 
b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/PrimitiveCollectionInvocationHandler.java
@@ -101,9 +101,9 @@ public class PrimitiveCollectionInvocationHandler<T extends 
Serializable>
 
     final 
ODataRetrieveResponse<org.apache.olingo.commons.api.domain.v4.ODataProperty> 
res = req.execute();
 
-    List<T> resItems = new ArrayList<T>();
+    final List<T> resItems = new ArrayList<T>();
 
-    org.apache.olingo.commons.api.domain.v4.ODataProperty property = 
res.getBody();
+    final org.apache.olingo.commons.api.domain.v4.ODataProperty property = 
res.getBody();
     if (property != null && !property.hasNullValue()) {
       for (ODataValue item : property.getCollectionValue()) {
         resItems.add((T) item.asPrimitive().toValue());

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
----------------------------------------------------------------------
diff --git 
a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
 
b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
index df3d0d3..aff8559 100644
--- 
a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
+++ 
b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
@@ -247,6 +247,7 @@ public abstract class AbstractPOJOGenMojo extends 
AbstractMojo {
         namespaces.add(schema.getNamespace().toLowerCase());
       }
 
+      final Map<String, String> entityTypeNames = new HashMap<String, 
String>();
       final Map<String, String> complexTypeNames = new HashMap<String, 
String>();
       final Map<String, String> enumTypeNames = new HashMap<String, String>();
       final Map<String, String> termNames = new HashMap<String, String>();
@@ -298,6 +299,9 @@ public abstract class AbstractPOJOGenMojo extends 
AbstractMojo {
         }
 
         for (EdmEntityType entity : schema.getEntityTypes()) {
+          final String className = utility.capitalize(entity.getName());
+          entityTypeNames.put(entity.getFullQualifiedName().toString(), 
typesPkg + "." + className);
+
           objs.clear();
           objs.put("entityType", entity);
 
@@ -328,10 +332,8 @@ public abstract class AbstractPOJOGenMojo extends 
AbstractMojo {
             }
           }
 
-          parseObj(typesBaseDir, typesPkg, "entityType",
-                  utility.capitalize(entity.getName()) + ".java", objs);
-          parseObj(typesBaseDir, typesPkg, "entityCollection",
-                  utility.capitalize(entity.getName()) + "Collection.java", 
objs);
+          parseObj(typesBaseDir, typesPkg, "entityType", className + ".java", 
objs);
+          parseObj(typesBaseDir, typesPkg, "entityCollection", className + 
"Collection.java", objs);
         }
 
         // write container and top entity sets into the base package
@@ -366,6 +368,7 @@ public abstract class AbstractPOJOGenMojo extends 
AbstractMojo {
       objs.clear();
       objs.put("metadata", new String(Base64.encodeBase64(baos.toByteArray()), 
"UTF-8"));
       objs.put("metadataETag", metadata.getMiddle());
+      objs.put("entityTypes", entityTypeNames);
       objs.put("complexTypes", complexTypeNames);
       objs.put("enumTypes", enumTypeNames);
       objs.put("terms", termNames);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/ext/pojogen-maven-plugin/src/main/resources/service.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/service.vm 
b/ext/pojogen-maven-plugin/src/main/resources/service.vm
index 6078c10..e172892 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/service.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/service.vm
@@ -100,6 +100,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -112,6 +114,9 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+#foreach ($entityType in $entityTypes.entrySet())
+    entityTypes.put("$entityType.key", ${entityType.value}.class);
+#end
 #foreach ($complexType in $complexTypes.entrySet())
     complexTypes.put("$complexType.key", ${complexType.value}.class);
 #end
@@ -125,6 +130,11 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
index 076f6c0..18a2807 100644
--- 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
+++ 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/actionoverloading/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,6 +112,38 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ProductDetail.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.License", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.License.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ProductReview.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Customer.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialCollectionTypes_Simple",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_Simple.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypes.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.DiscontinuedProduct",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.DiscontinuedProduct.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Driver", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Driver.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Login", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Login.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.PageView", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.PageView.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.PersonMetadata.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.LastLogin.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.SpecialEmployee.class);
+    entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Car", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Car.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductPageView",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ProductPageView.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.MappedEntityType",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.MappedEntityType.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.MessageAttachment",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.MessageAttachment.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Employee.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.BackOrderLine2",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Computer", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Computer.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Message", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Message.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductPhoto",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ProductPhoto.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.CustomerInfo.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Product", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Product.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.OrderLine.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Contractor",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Contractor.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Person", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Person.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Order", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Order.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.RSAToken", 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.RSAToken.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialCollectionTypes",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.BackOrderLine",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine.class);
     
complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexToCategory",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ComplexToCategory.class);
     
complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails.class);
     
complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Dimensions",
 
org.apache.olingo.fit.proxy.v3.actionoverloading.microsoft.test.odata.services.astoriadefaultservice.types.Dimensions.class);
@@ -121,6 +155,11 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
index 95e51b7..abc7a30 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/opentype/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,11 +112,19 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV3.Row", 
org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservicev3.types.Row.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV3.RowIndex", 
org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservicev3.types.RowIndex.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV3.IndexedRow", 
org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservicev3.types.IndexedRow.class);
     
complexTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV3.ContactDetails",
 
org.apache.olingo.fit.proxy.v3.opentype.microsoft.test.odata.services.opentypesservicev3.types.ContactDetails.class);
     //CHECKSTYLE:ON (Maven checkstyle)
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
index 581d4a9..98b1fc8 100644
--- 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
+++ 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/primitivekeys/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,10 +112,30 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmDateTime",
 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmDateTime.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmDouble", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmDouble.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmString", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmString.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.Folder", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.Folder.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmByte", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmByte.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmGuid", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmGuid.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmTime", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmTime.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmDateTimeOffset",
 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmDateTimeOffset.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmInt64", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmInt64.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmBoolean",
 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmBoolean.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmInt16", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmInt16.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmDecimal",
 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmDecimal.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmSingle", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmSingle.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmBinary", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmBinary.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.PrimitiveKeysService.EdmInt32", 
org.apache.olingo.fit.proxy.v3.primitivekeys.microsoft.test.odata.services.primitivekeysservice.types.EdmInt32.class);
     //CHECKSTYLE:ON (Maven checkstyle)
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
index c224e15..e423739 100644
--- 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
+++ 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/staticservice/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,6 +112,38 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductDetail",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ProductDetail.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.License", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.License.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductReview",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ProductReview.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialCollectionTypes_Simple",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes_Simple.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Customer.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialTypes",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialTypes.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.DiscontinuedProduct",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.DiscontinuedProduct.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Driver", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Driver.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Login", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Login.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.PageView", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PageView.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.LastLogin",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.LastLogin.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.PersonMetadata",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PersonMetadata.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.SpecialEmployee.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductPageView",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ProductPageView.class);
+    entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Car", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Car.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.MappedEntityType",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.MappedEntityType.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.MessageAttachment",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.MessageAttachment.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Employee.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.BackOrderLine2",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine2.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Computer", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Computer.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Message", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Message.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ProductPhoto",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ProductPhoto.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComputerDetail",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComputerDetail.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.CustomerInfo.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Product", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Product.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.OrderLine",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.OrderLine.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Contractor",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Contractor.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Person", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Person.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.Order", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Order.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.RSAToken", 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.RSAToken.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.AllSpatialCollectionTypes",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.AllSpatialCollectionTypes.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.BackOrderLine",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.BackOrderLine.class);
     
complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexToCategory",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComplexToCategory.class);
     
complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetails.class);
     
complexTypes.put("Microsoft.Test.OData.Services.AstoriaDefaultService.ComplexWithAllPrimitiveTypes",
 
org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ComplexWithAllPrimitiveTypes.class);
@@ -122,6 +156,11 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
index 2f79095..02375ca 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/demo/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,11 +112,26 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    entityTypes.put("ODataDemo.Customer", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Customer.class);
+    entityTypes.put("ODataDemo.PersonDetail", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.PersonDetail.class);
+    entityTypes.put("ODataDemo.ProductDetail", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.ProductDetail.class);
+    entityTypes.put("ODataDemo.Employee", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Employee.class);
+    entityTypes.put("ODataDemo.Product", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Product.class);
+    entityTypes.put("ODataDemo.Advertisement", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Advertisement.class);
+    entityTypes.put("ODataDemo.Category", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Category.class);
+    entityTypes.put("ODataDemo.Person", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Person.class);
+    entityTypes.put("ODataDemo.Supplier", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Supplier.class);
+    entityTypes.put("ODataDemo.FeaturedProduct", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.FeaturedProduct.class);
     complexTypes.put("ODataDemo.Address", 
org.apache.olingo.fit.proxy.v4.demo.odatademo.types.Address.class);
     //CHECKSTYLE:ON (Maven checkstyle)
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
index 6823b5e..f2ab7ea 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,6 +112,9 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.Row", 
org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.IndexedRow", 
org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.IndexedRow.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex", 
org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex.class);
     
complexTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.AccountInfo",
 
org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo.class);
     
complexTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails",
 
org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails.class);
     enumTypes.put("Microsoft.Test.OData.Services.OpenTypesServiceV4.Color", 
org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Color.class);
@@ -117,6 +122,11 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4ead5f41/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
----------------------------------------------------------------------
diff --git 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
index 6b1965c..445de01 100644
--- 
a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
+++ 
b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/staticservice/Service.java
@@ -98,6 +98,8 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     return getInstance(ODataServiceVersion.V40, serviceRoot, transactional);
   }
 
+  private final Map<String, Class<?>> entityTypes = new HashMap<String, 
Class<?>>();
+
   private final Map<String, Class<?>> complexTypes = new HashMap<String, 
Class<?>>();
 
   private final Map<String, Class<?>> enumTypes = new HashMap<String, 
Class<?>>();
@@ -110,6 +112,28 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
     super(compressedMetadata, metadataETag,version, serviceRoot, 
transactional);
 
     //CHECKSTYLE:OFF (Maven checkstyle)
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditCardPI.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Account", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Account.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductDetail.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Order", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Statement", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Statement.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Subscription", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Subscription.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Person", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Person.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.GiftCard", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.GiftCard.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.OrderDetail", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.OrderDetail.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Product", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Product.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PaymentInstrument.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Customer", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Club", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Club.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.ProductReview", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.ProductReview.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Department", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Asset", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Asset.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Employee", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Employee.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.StoredPI", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI.class);
+    entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Company", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Company.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.CreditRecord", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CreditRecord.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.LabourUnion", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.LabourUnion.class);
+    
entityTypes.put("Microsoft.Test.OData.Services.ODataWCFService.PublicCompany", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.PublicCompany.class);
     complexTypes.put("Microsoft.Test.OData.Services.ODataWCFService.Address", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address.class);
     
complexTypes.put("Microsoft.Test.OData.Services.ODataWCFService.CompanyAddress",
 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress.class);
     
complexTypes.put("Microsoft.Test.OData.Services.ODataWCFService.AccountInfo", 
org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo.class);
@@ -122,6 +146,11 @@ public class Service<C extends 
CommonEdmEnabledODataClient<?>> extends AbstractS
   }
 
   @Override
+  public Class<?> getEntityTypeClass(final String name) {
+    return entityTypes.get(name);
+  }
+
+  @Override
   public Class<?> getComplexTypeClass(final String name) {
     return complexTypes.get(name);
   }

Reply via email to