You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/05/20 13:16:53 UTC

git commit: [OLINGO-260] missed open complex type support on the proxy

Repository: olingo-odata4
Updated Branches:
  refs/heads/master 5fb2b80e4 -> 62dad2509


[OLINGO-260] missed open complex type support on the proxy


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

Branch: refs/heads/master
Commit: 62dad250955daf382c55df83ab4e1bdee20804cb
Parents: 5fb2b80
Author: fmartelli <fa...@gmail.com>
Authored: Tue May 20 13:16:39 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Tue May 20 13:16:39 2014 +0200

----------------------------------------------------------------------
 .../AbstractStructuredInvocationHandler.java    | 20 ++---
 .../proxy/commons/ComplexInvocationHandler.java | 30 ++++---
 .../proxy/commons/EntityInvocationHandler.java  | 16 ++--
 .../olingo/ext/proxy/context/EntityContext.java |  3 +-
 .../src/main/resources/complexType.vm           |  1 +
 .../src/main/resources/v40/complexType.vm       |  2 +-
 fit/src/main/resources/V40/openTypeMetadata.xml |  4 +
 .../olingo/fit/proxy/v4/OpenTypeTestITCase.java | 11 +++
 .../opentypesservicev4/DefaultContainer.java    |  6 +-
 .../odata/services/opentypesservicev4/Row.java  |  1 -
 .../services/opentypesservicev4/RowIndex.java   |  1 -
 .../opentypesservicev4/types/AccountInfo.java   | 90 ++++++++++++++++++++
 .../types/ContactDetails.java                   | 25 +++---
 .../opentypesservicev4/types/IndexedRow.java    |  5 +-
 .../types/IndexedRowCollection.java             |  5 ++
 .../services/opentypesservicev4/types/Row.java  |  5 +-
 .../opentypesservicev4/types/RowCollection.java |  5 ++
 .../opentypesservicev4/types/RowIndex.java      | 13 +--
 .../types/RowIndexCollection.java               |  5 ++
 .../org.apache.olingo.ext.proxy.complex         |  1 +
 20 files changed, 189 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
index 3a85895..6f44c64 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractStructuredInvocationHandler.java
@@ -269,18 +269,6 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
     return navPropValue;
   }
 
-  protected abstract Object getPropertyValue(final String name, final Type type);
-
-  public void addAdditionalProperty(final String name, final Object value) {
-    addPropertyChanges(name, value);
-    attach(AttachedEntityStatus.CHANGED);
-  }
-
-  public void removeAdditionalProperty(final String name) {
-    removePropertyChanges(name);
-    attach(AttachedEntityStatus.CHANGED);
-  }
-
   public Object getAdditionalProperty(final String name) {
     return getPropertyValue(name, null);
   }
@@ -318,11 +306,13 @@ public abstract class AbstractStructuredInvocationHandler extends AbstractInvoca
 
   protected abstract void setPropertyValue(final Property property, final Object value);
 
-  protected abstract void addPropertyChanges(final String name, final Object value);
+  protected abstract void addLinkChanges(final NavigationProperty navProp, final Object value);
 
-  protected abstract void removePropertyChanges(final String name);
+  protected abstract Object getPropertyValue(final String name, final Type type);
 
-  protected abstract void addLinkChanges(final NavigationProperty navProp, final Object value);
+  public abstract void addAdditionalProperty(final String name, final Object value);
+
+  public abstract void removeAdditionalProperty(final String name);
 
   public abstract boolean isChanged();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java
index e3743fe..a207e68 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ComplexInvocationHandler.java
@@ -131,13 +131,21 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
   }
 
   @Override
-  @SuppressWarnings("unchecked")
   protected void setPropertyValue(final Property property, final Object value) {
     final FullQualifiedName fqn =
             new FullQualifiedName(ClassUtils.getNamespace(typeRef), typeRef.getAnnotation(ComplexType.class).name());
 
     final EdmElement edmProperty = client.getCachedEdm().getComplexType(fqn).getProperty(property.name());
 
+    final EdmTypeInfo type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
+            edmProperty.isCollection() ? "Collection(" + property.type() + ")" : property.type()).build();
+
+    setPropertyValue(property.name(), type, value);
+  }
+
+  @SuppressWarnings("unchecked")
+  private void setPropertyValue(final String name, final EdmTypeInfo type, final Object value) {
+
     final Object toBeAdded;
 
     if (value == null) {
@@ -145,7 +153,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
     } else if (Collection.class.isAssignableFrom(value.getClass())) {
       toBeAdded = new ArrayList<Object>();
       for (Object obj : (Collection) value) {
-        ((Collection) toBeAdded).add(obj instanceof Proxy ? Proxy.getInvocationHandler(obj) : obj);
+        Collection.class.cast(toBeAdded).add(obj instanceof Proxy ? Proxy.getInvocationHandler(obj) : obj);
       }
     } else if (value instanceof Proxy) {
       toBeAdded = Proxy.getInvocationHandler(value);
@@ -153,10 +161,7 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
       toBeAdded = value;
     }
 
-    final EdmTypeInfo type = new EdmTypeInfo.Builder().setEdm(client.getCachedEdm()).setTypeExpression(
-            edmProperty.isCollection() ? "Collection(" + property.type() + ")" : property.type()).build();
-
-    client.getBinder().add(getComplex(), CoreUtils.getODataProperty(client, property.name(), type, toBeAdded));
+    client.getBinder().add(getComplex(), CoreUtils.getODataProperty(client, name, type, toBeAdded));
 
     if (getEntityHandler() != null && !entityContext.isAttached(getEntityHandler())) {
       entityContext.attach(getEntityHandler(), AttachedEntityStatus.CHANGED);
@@ -173,13 +178,18 @@ public class ComplexInvocationHandler extends AbstractStructuredInvocationHandle
   }
 
   @Override
-  protected void addPropertyChanges(final String name, final Object value) {
-    // do nothing ....
+  public void addAdditionalProperty(final String name, final Object value) {
+    setPropertyValue(name, null, value);
+    attach(AttachedEntityStatus.CHANGED);
   }
 
   @Override
-  protected void removePropertyChanges(final String name) {
-    // do nothing ....
+  public void removeAdditionalProperty(final String name) {
+    final CommonODataProperty property = getComplex().get(name);
+    if(property !=null && !property.hasNullValue()){
+      setPropertyValue(name, null, null);
+      attach(AttachedEntityStatus.CHANGED);
+    }
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
index 529c5eb..924d155 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java
@@ -180,6 +180,12 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
     return propertyChanges;
   }
 
+  @Override
+  public void addAdditionalProperty(final String name, final Object value) {
+    propertyChanges.put(name, value);
+    attach(AttachedEntityStatus.CHANGED);
+  }
+
   public Map<NavigationProperty, Object> getLinkChanges() {
     return linkChanges;
   }
@@ -257,7 +263,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
     if (EdmPrimitiveTypeKind.Stream.getFullQualifiedName().toString().equalsIgnoreCase(property.type())) {
       setStreamedProperty(property, (InputStream) value);
     } else {
-      addPropertyChanges(property.name(), value);
+      propertyChanges.put(property.name(), value);
 
       if (value != null) {
         Collection<?> coll;
@@ -374,13 +380,9 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler
   }
 
   @Override
-  protected void addPropertyChanges(final String name, final Object value) {
-    propertyChanges.put(name, value);
-  }
-
-  @Override
-  protected void removePropertyChanges(final String name) {
+  public void removeAdditionalProperty(final String name) {
     propertyChanges.remove(name);
+    attach(AttachedEntityStatus.CHANGED);
   }
 
   protected void cacheProperty(final String name, final Object value) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityContext.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityContext.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityContext.java
index 2b42cd1..560b185 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityContext.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/context/EntityContext.java
@@ -178,7 +178,8 @@ public class EntityContext implements Iterable<AttachedEntity> {
    * @return <tt>true</tt> if is attached; <tt>false</tt> otherwise.
    */
   public boolean isAttached(final EntityInvocationHandler entity) {
-    return allAttachedEntities.containsKey(entity)
+    return entity == null // avoid attach for null entities (coming from complexes created from container ...)
+            || allAttachedEntities.containsKey(entity)
             || (entity.getUUID().getKey() != null && searchableEntities.containsKey(entity.getUUID()));
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/complexType.vm b/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
index ba03282..f5881f6 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
@@ -22,6 +22,7 @@ import org.apache.olingo.ext.proxy.api.annotations.Namespace;
 import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
 import org.apache.olingo.ext.proxy.api.annotations.Property;
 import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
 #foreach($ns in $namespaces)
 import ${basePackage}.${ns}.*;
 import ${basePackage}.${ns}.types.*;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm b/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
index b76717f..5ee61e7 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
@@ -22,7 +22,7 @@
         isAbstract = $complexType.Abstract#if($complexType.getBaseType()),
         baseType = "$complexType.getBaseType().getFullQualifiedName().toString()"#end)
 public interface $utility.capitalize($complexType.Name) 
-    extends #if($complexType.getBaseType())$utility.getJavaType($complexType.getBaseType().getFullQualifiedName().toString())#{else}Serializable#end {
+    extends #if($complexType.getBaseType())$utility.getJavaType($complexType.getBaseType().getFullQualifiedName().toString()),#{end}#if( $complexType.isOpenType() )AbstractOpenType,#{end}Serializable {
 
 #set( $complexProps = [] )
 #foreach($propertyName in $complexType.PropertyNames)

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/main/resources/V40/openTypeMetadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/openTypeMetadata.xml b/fit/src/main/resources/V40/openTypeMetadata.xml
index 3cca590..62b2f77 100644
--- a/fit/src/main/resources/V40/openTypeMetadata.xml
+++ b/fit/src/main/resources/V40/openTypeMetadata.xml
@@ -41,6 +41,10 @@
         <Property Name="Int" Type="Edm.Int32" Nullable="false"/>
         <Property Name="Long" Type="Edm.Int64" Nullable="false"/>
       </ComplexType>
+      <ComplexType Name="AccountInfo" OpenType="true">
+        <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+        <Property Name="LastName" Type="Edm.String" Nullable="false"/>
+      </ComplexType>
       <EntityType Name="Row" OpenType="true">
         <Key>
           <PropertyRef Name="Id"/>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
index 11f7d07..e337521 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/OpenTypeTestITCase.java
@@ -33,6 +33,7 @@ import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.ext.proxy.EntityContainerFactory;
 import org.apache.olingo.ext.proxy.api.annotations.EntityType;
 import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.DefaultContainer;
+import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo;
 import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Color;
 import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails;
 import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row;
@@ -115,6 +116,12 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
     rowIndex.addAdditionalProperty("aContact", contact);
     rowIndex.addAdditionalProperty("aColor", Color.Green);
 
+    final AccountInfo ai = otcontainer.complexFactory().newAccountInfo();
+    ai.setFirstName("Fabio");
+    ai.setLastName("Martelli");
+    ai.addAdditionalProperty("email", "fabio.martelli@tirasa.net");
+    rowIndex.addAdditionalProperty("info", ai);
+
     otcontainer.flush();
 
     rowIndex = otcontainer.getRowIndex().get(id);
@@ -127,6 +134,10 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
     assertEquals(ContactDetails.class, rowIndex.getAdditionalProperty("aContact").getClass().getInterfaces()[0]);
     assertEquals(Color.class, rowIndex.getAdditionalProperty("aColor").getClass());
     assertEquals(Color.Green, rowIndex.getAdditionalProperty("aColor"));
+    assertEquals("Fabio", AccountInfo.class.cast(rowIndex.getAdditionalProperty("info")).getFirstName());
+    assertEquals("Martelli", AccountInfo.class.cast(rowIndex.getAdditionalProperty("info")).getLastName());
+    assertEquals("fabio.martelli@tirasa.net", AccountInfo.class.cast(rowIndex.getAdditionalProperty("info")).
+            getAdditionalProperty("email"));
 
     entityContext.detachAll();
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java
index 18df189..f146c6b 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/DefaultContainer.java
@@ -53,12 +53,10 @@ import javax.xml.datatype.Duration;
 public interface DefaultContainer extends Container {
 
     Row getRow();
-
     RowIndex getRowIndex();
 
 
 
-
   Operations operations();
 
   public interface Operations {
@@ -72,5 +70,9 @@ public interface DefaultContainer extends Container {
                 type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.ContactDetails")
       org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails newContactDetails();
 
+          @Property(name = "AccountInfo",
+                type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.AccountInfo")
+      org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo newAccountInfo();
+
         }
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java
index 5c970ac..80a73a9 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/Row.java
@@ -43,7 +43,6 @@ import java.util.Calendar;
 import javax.xml.datatype.Duration;
 
 
-
 @EntitySet(name = "Row")
 public interface Row 
   extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row, UUID, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowCollection> {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java
index 22dee42..97ee5f9 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/RowIndex.java
@@ -43,7 +43,6 @@ import java.util.Calendar;
 import javax.xml.datatype.Duration;
 
 
-
 @EntitySet(name = "RowIndex")
 public interface RowIndex 
   extends AbstractEntitySet<org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndex, Integer, org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.RowIndexCollection> {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java
new file mode 100644
index 0000000..651a65a
--- /dev/null
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/AccountInfo.java
@@ -0,0 +1,90 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types;
+
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
+import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.*;
+import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.*;
+
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Calendar;
+import javax.xml.datatype.Duration;
+
+
+@Namespace("Microsoft.Test.OData.Services.OpenTypesServiceV4")
+@ComplexType(name = "AccountInfo",
+        isOpenType = true,
+        isAbstract = false)
+public interface AccountInfo 
+    extends AbstractOpenType,Serializable {
+
+
+    @Property(name = "FirstName", 
+                type = "Edm.String", 
+                nullable = false,
+                defaultValue = "",
+                maxLenght = Integer.MAX_VALUE,
+                fixedLenght = false,
+                precision = 0,
+                scale = 0,
+                unicode = true,
+                collation = "",
+                srid = "")
+    String getFirstName();
+
+    void setFirstName(String _firstName);
+
+    
+
+    @Property(name = "LastName", 
+                type = "Edm.String", 
+                nullable = false,
+                defaultValue = "",
+                maxLenght = Integer.MAX_VALUE,
+                fixedLenght = false,
+                precision = 0,
+                scale = 0,
+                unicode = true,
+                collation = "",
+                srid = "")
+    String getLastName();
+
+    void setLastName(String _lastName);
+
+    
+
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java
index d96c838..4eae254 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/ContactDetails.java
@@ -23,6 +23,7 @@ import org.apache.olingo.ext.proxy.api.annotations.Namespace;
 import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
 import org.apache.olingo.ext.proxy.api.annotations.Property;
 import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
 import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.*;
 import org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.*;
 
@@ -64,7 +65,7 @@ public interface ContactDetails
                 srid = "")
     byte[] getFirstContacted();
 
-    void setFirstContacted(final byte[] _firstContacted);
+    void setFirstContacted(byte[] _firstContacted);
 
     
 
@@ -81,7 +82,7 @@ public interface ContactDetails
                 srid = "")
     Calendar getLastContacted();
 
-    void setLastContacted(final Calendar _lastContacted);
+    void setLastContacted(Calendar _lastContacted);
 
     
 
@@ -98,7 +99,7 @@ public interface ContactDetails
                 srid = "")
     Calendar getContacted();
 
-    void setContacted(final Calendar _contacted);
+    void setContacted(Calendar _contacted);
 
     
 
@@ -115,7 +116,7 @@ public interface ContactDetails
                 srid = "")
     UUID getGUID();
 
-    void setGUID(final UUID _gUID);
+    void setGUID(UUID _gUID);
 
     
 
@@ -132,7 +133,7 @@ public interface ContactDetails
                 srid = "")
     Calendar getPreferedContactTime();
 
-    void setPreferedContactTime(final Calendar _preferedContactTime);
+    void setPreferedContactTime(Calendar _preferedContactTime);
 
     
 
@@ -149,7 +150,7 @@ public interface ContactDetails
                 srid = "")
     Short getByte();
 
-    void setByte(final Short _byte);
+    void setByte(Short _byte);
 
     
 
@@ -166,7 +167,7 @@ public interface ContactDetails
                 srid = "")
     Byte getSignedByte();
 
-    void setSignedByte(final Byte _signedByte);
+    void setSignedByte(Byte _signedByte);
 
     
 
@@ -183,7 +184,7 @@ public interface ContactDetails
                 srid = "")
     Double getDouble();
 
-    void setDouble(final Double _double);
+    void setDouble(Double _double);
 
     
 
@@ -200,7 +201,7 @@ public interface ContactDetails
                 srid = "")
     Float getSingle();
 
-    void setSingle(final Float _single);
+    void setSingle(Float _single);
 
     
 
@@ -217,7 +218,7 @@ public interface ContactDetails
                 srid = "")
     Short getShort();
 
-    void setShort(final Short _short);
+    void setShort(Short _short);
 
     
 
@@ -234,7 +235,7 @@ public interface ContactDetails
                 srid = "")
     Integer getInt();
 
-    void setInt(final Integer _int);
+    void setInt(Integer _int);
 
     
 
@@ -251,7 +252,7 @@ public interface ContactDetails
                 srid = "")
     Long getLong();
 
-    void setLong(final Long _long);
+    void setLong(Long _long);
 
     
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java
index 0ce9626..18ed704 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRow.java
@@ -28,6 +28,7 @@ import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
 import org.apache.olingo.ext.proxy.api.annotations.Property;
 import org.apache.olingo.ext.proxy.api.annotations.Operation;
 import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.AbstractAnnotatable;
 import org.apache.olingo.ext.proxy.api.AbstractOpenType;
 import org.apache.olingo.ext.proxy.api.OperationType;
 import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
@@ -59,7 +60,7 @@ import javax.xml.datatype.Duration;
         isAbstract = false,
         baseType = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row")
 public interface IndexedRow 
-  extends org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row {
+  extends AbstractAnnotatable,org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row {
 
     
     @Key
@@ -83,7 +84,7 @@ public interface IndexedRow
                 fcKeepInContent = false)
     UUID getId();
 
-    void setId(final UUID _id);    
+    void setId(UUID _id);    
     
     
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java
index 40e8638..a4496e5 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/IndexedRowCollection.java
@@ -21,6 +21,7 @@ package org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.op
 
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
 import org.apache.olingo.ext.proxy.api.OperationType;
 import org.apache.olingo.ext.proxy.api.annotations.Operation;
 import org.apache.olingo.ext.proxy.api.annotations.Parameter;
@@ -44,4 +45,8 @@ import java.util.Calendar;
 import javax.xml.datatype.Duration;
 
 public interface IndexedRowCollection extends AbstractEntityCollection<IndexedRow> {
+
+  Object getAnnotation(Class<? extends AbstractTerm> term);
+
+  Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java
index 45e33a9..b9b1ff8 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/Row.java
@@ -28,6 +28,7 @@ import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
 import org.apache.olingo.ext.proxy.api.annotations.Property;
 import org.apache.olingo.ext.proxy.api.annotations.Operation;
 import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.AbstractAnnotatable;
 import org.apache.olingo.ext.proxy.api.AbstractOpenType;
 import org.apache.olingo.ext.proxy.api.OperationType;
 import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
@@ -58,7 +59,7 @@ import javax.xml.datatype.Duration;
         hasStream = false,
         isAbstract = false)
 public interface Row 
-  extends AbstractOpenType {
+  extends AbstractAnnotatable,AbstractOpenType {
 
     
     @Key
@@ -82,7 +83,7 @@ public interface Row
                 fcKeepInContent = false)
     UUID getId();
 
-    void setId(final UUID _id);    
+    void setId(UUID _id);    
     
     
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java
index 25099bd..0872073 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowCollection.java
@@ -21,6 +21,7 @@ package org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.op
 
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
 import org.apache.olingo.ext.proxy.api.OperationType;
 import org.apache.olingo.ext.proxy.api.annotations.Operation;
 import org.apache.olingo.ext.proxy.api.annotations.Parameter;
@@ -44,4 +45,8 @@ import java.util.Calendar;
 import javax.xml.datatype.Duration;
 
 public interface RowCollection extends AbstractEntityCollection<Row> {
+
+  Object getAnnotation(Class<? extends AbstractTerm> term);
+
+  Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java
index 9758eab..0397a65 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndex.java
@@ -28,6 +28,7 @@ import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
 import org.apache.olingo.ext.proxy.api.annotations.Property;
 import org.apache.olingo.ext.proxy.api.annotations.Operation;
 import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.AbstractAnnotatable;
 import org.apache.olingo.ext.proxy.api.AbstractOpenType;
 import org.apache.olingo.ext.proxy.api.OperationType;
 import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
@@ -58,7 +59,7 @@ import javax.xml.datatype.Duration;
         hasStream = false,
         isAbstract = false)
 public interface RowIndex 
-  extends AbstractOpenType {
+  extends AbstractAnnotatable,AbstractOpenType {
 
     
     @Key
@@ -82,7 +83,7 @@ public interface RowIndex
                 fcKeepInContent = false)
     Integer getId();
 
-    void setId(final Integer _id);    
+    void setId(Integer _id);    
     
     
 
@@ -90,12 +91,12 @@ public interface RowIndex
                 type = "Microsoft.Test.OData.Services.OpenTypesServiceV4.Row", 
                 targetSchema = "Microsoft.Test.OData.Services.OpenTypesServiceV4", 
                 targetContainer = "DefaultContainer", 
-                targetEntitySet = "Row")
+                targetEntitySet = "Row",
+                containsTarget = false)
     org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row getRows();
 
-    void setRows(final org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row _rows);
-
-
+    void setRows(org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.Row _rows);
+    
 
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java
index 3b20d0e..eeeb329 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/opentype/microsoft/test/odata/services/opentypesservicev4/types/RowIndexCollection.java
@@ -21,6 +21,7 @@ package org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.op
 
 import org.apache.olingo.client.api.http.HttpMethod;
 import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
+import org.apache.olingo.ext.proxy.api.AbstractTerm;
 import org.apache.olingo.ext.proxy.api.OperationType;
 import org.apache.olingo.ext.proxy.api.annotations.Operation;
 import org.apache.olingo.ext.proxy.api.annotations.Parameter;
@@ -44,4 +45,8 @@ import java.util.Calendar;
 import javax.xml.datatype.Duration;
 
 public interface RowIndexCollection extends AbstractEntityCollection<RowIndex> {
+
+  Object getAnnotation(Class<? extends AbstractTerm> term);
+
+  Collection<Class<? extends AbstractTerm>> getAnnotationTerms();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/62dad250/fit/src/test/resources/META-INF/org.apache.olingo.ext.proxy.complex
----------------------------------------------------------------------
diff --git a/fit/src/test/resources/META-INF/org.apache.olingo.ext.proxy.complex b/fit/src/test/resources/META-INF/org.apache.olingo.ext.proxy.complex
index 3c43cdf..066bbc1 100644
--- a/fit/src/test/resources/META-INF/org.apache.olingo.ext.proxy.complex
+++ b/fit/src/test/resources/META-INF/org.apache.olingo.ext.proxy.complex
@@ -19,3 +19,4 @@ org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odata
 org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyAddress
 org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.AccountInfo
 org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.ContactDetails
+org.apache.olingo.fit.proxy.v4.opentype.microsoft.test.odata.services.opentypesservicev4.types.AccountInfo