You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/05/07 12:39:34 UTC

[1/5] git commit: [OLINGO-264] Adding data and domain objects for instance annotations

Repository: olingo-odata4
Updated Branches:
  refs/heads/master f02d9a07e -> 8caf3fece


[OLINGO-264] Adding data and domain objects for instance annotations


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

Branch: refs/heads/master
Commit: 70cdaef51537a868a207c796e06caf7e501bbd2b
Parents: dda7577
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue May 6 10:32:34 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue May 6 10:32:34 2014 +0200

----------------------------------------------------------------------
 .../client/core/op/AbstractODataBinder.java     |  10 +-
 .../olingo/commons/api/data/Annotatable.java    |  29 ++++++
 .../olingo/commons/api/data/Annotation.java     |  37 +++++++
 .../apache/olingo/commons/api/data/Entity.java  |   2 +-
 .../olingo/commons/api/data/EntitySet.java      |   2 +-
 .../apache/olingo/commons/api/data/Link.java    |   2 +-
 .../commons/api/data/LinkedComplexValue.java    |   5 +-
 .../olingo/commons/api/data/Property.java       |   2 +-
 .../api/domain/CommonODataObjectFactory.java    |   4 +
 .../olingo/commons/api/domain/ODataItem.java    |   9 --
 .../olingo/commons/api/domain/ODataLink.java    |  20 ++--
 .../api/domain/v4/ODataAnnotatatable.java       |  26 +++++
 .../commons/api/domain/v4/ODataAnnotation.java  | 103 +++++++++++++++++++
 .../commons/api/domain/v4/ODataEntity.java      |   2 +-
 .../commons/api/domain/v4/ODataEntitySet.java   |   2 +-
 .../olingo/commons/api/domain/v4/ODataLink.java |  74 +++++++++++++
 .../api/domain/v4/ODataLinkedComplexValue.java  |   3 +-
 .../api/domain/v4/ODataObjectFactory.java       |  12 +++
 .../commons/api/domain/v4/ODataProperty.java    |   2 +-
 .../core/data/AbstractAnnotatedObject.java      |  37 +++++++
 .../commons/core/data/AbstractODataObject.java  |   2 +-
 .../commons/core/data/AbstractProperty.java     |  21 +---
 .../olingo/commons/core/data/LinkImpl.java      |   2 +-
 .../core/data/LinkedComplexValueImpl.java       |   7 ++
 .../core/domain/AbstractODataObjectFactory.java |  14 ---
 .../core/domain/v3/ODataObjectFactoryImpl.java  |  24 +++++
 .../core/domain/v4/ODataComplexValueImpl.java   |   9 ++
 .../core/domain/v4/ODataDeletedEntityImpl.java  |   8 +-
 .../core/domain/v4/ODataDeltaLinkImpl.java      |  12 ++-
 .../commons/core/domain/v4/ODataEntityImpl.java |   8 ++
 .../core/domain/v4/ODataEntitySetImpl.java      |  12 ++-
 .../core/domain/v4/ODataObjectFactoryImpl.java  |  26 +++++
 .../core/domain/v4/ODataPropertyImpl.java       |   9 ++
 33 files changed, 454 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 125cca4..c54b9e7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -114,7 +114,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     if (next != null) {
       entitySet.setNext(next);
     }
-    
+
     for (CommonODataEntity entity : odataEntitySet.getEntities()) {
       entitySet.getEntities().add(getEntity(entity, ResourceFactory.entityClassForEntitySet(reference)));
     }
@@ -409,13 +409,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     }
 
     for (Link link : resource.getPayload().getAssociationLinks()) {
-      entity.addLink(new ODataLink.Builder().setVersion(client.getServiceVersion()).
-              setURI(URIUtils.getURI(base, link.getHref())).
-              setType(ODataLinkType.ASSOCIATION).setTitle(link.getTitle()).build());
+      entity.addLink(client.getObjectFactory().
+              newAssociationLink(link.getTitle(), URIUtils.getURI(base, link.getHref())));
     }
 
-    odataNavigationLinks(
-            edmType, resource.getPayload(), entity, resource.getMetadataETag(), base);
+    odataNavigationLinks(edmType, resource.getPayload(), entity, resource.getMetadataETag(), base);
 
     for (Link link : resource.getPayload().getMediaEditLinks()) {
       entity.addLink(new ODataLink.Builder().setVersion(client.getServiceVersion()).

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotatable.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotatable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotatable.java
new file mode 100644
index 0000000..4be0262
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotatable.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.api.data;
+
+import java.util.List;
+
+/**
+ * An element with instance annotations.
+ */
+public interface Annotatable {
+
+  List<Annotation> getAnnotations();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
new file mode 100644
index 0000000..96db646
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
@@ -0,0 +1,37 @@
+/*
+ * 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.commons.api.data;
+
+/**
+ * Represents an instance annotation.
+ */
+public interface Annotation {
+
+  String getTerm();
+
+  void setTerm(String term);
+
+  String getType();
+
+  void setType(String type);
+
+  Value getValue();
+
+  void setValue(Value value);
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
index ed0ad15..67561f9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
@@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
 import java.net.URI;
 import java.util.List;
 
-public interface Entity extends Linked {
+public interface Entity extends Linked, Annotatable {
 
   /**
    * Gets ETag.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
index ce798a9..a4ccf42 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.data;
 import java.net.URI;
 import java.util.List;
 
-public interface EntitySet {
+public interface EntitySet extends Annotatable {
 
   /**
    * Gets base URI.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
index 63c953a..808216d 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.commons.api.data;
 
-public interface Link {
+public interface Link extends Annotatable {
 
   /**
    * Gets rel info.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
index 13cb72c..057a535 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/LinkedComplexValue.java
@@ -16,9 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.olingo.commons.api.data;
 
-public interface LinkedComplexValue extends ComplexValue, Linked {
-  
+public interface LinkedComplexValue extends ComplexValue, Linked, Annotatable {
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
index feb8f71..3f1ca03 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.commons.api.data;
 
-public interface Property {
+public interface Property extends Annotatable {
 
   String getName();
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
index eead623..bb61da1 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -94,6 +94,10 @@ public interface CommonODataObjectFactory {
    */
   ODataLink newEntityNavigationLink(String name, URI link);
 
+  ODataLink newAssociationLink(String name, URI link);
+
+  ODataLink newMediaEditLink(String name, URI link);
+
   ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
 
   ODataComplexValue<? extends CommonODataProperty> newComplexValue(String typeName);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java
index 3ad5ed5..f97e4d4 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataItem.java
@@ -81,25 +81,16 @@ public abstract class ODataItem implements Serializable {
     this.link = link;
   }
 
-  /**
-   * {@inheritDoc }
-   */
   @Override
   public boolean equals(final Object obj) {
     return EqualsBuilder.reflectionEquals(this, obj);
   }
 
-  /**
-   * {@inheritDoc }
-   */
   @Override
   public int hashCode() {
     return HashCodeBuilder.reflectionHashCode(this);
   }
 
-  /**
-   * {@inheritDoc }
-   */
   @Override
   public String toString() {
     return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
index 1b74caa..2f8068e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
@@ -30,15 +30,13 @@ public class ODataLink extends ODataItem {
 
   public static class Builder {
 
-    private ODataServiceVersion version;
+    protected ODataServiceVersion version;
 
-    private URI uri;
+    protected URI uri;
 
-    private ODataLinkType type;
+    protected ODataLinkType type;
 
-    private String title;
-
-    private String mediaETag;
+    protected String title;
 
     public Builder setVersion(final ODataServiceVersion version) {
       this.version = version;
@@ -65,14 +63,8 @@ public class ODataLink extends ODataItem {
       return this;
     }
 
-    public void setMediaETag(final String mediaETag) {
-      this.mediaETag = mediaETag;
-    }
-
     public ODataLink build() {
-      final ODataLink instance = new ODataLink(version, uri, type, title);
-      instance.mediaETag = this.mediaETag;
-      return instance;
+      return new ODataLink(version, uri, type, title);
     }
   }
 
@@ -111,7 +103,7 @@ public class ODataLink extends ODataItem {
   /**
    * ETag for media edit links.
    */
-  private String mediaETag;
+  protected String mediaETag;
 
   /**
    * Constructor.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotatatable.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotatatable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotatatable.java
new file mode 100644
index 0000000..7481efc
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotatatable.java
@@ -0,0 +1,26 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.util.List;
+
+public interface ODataAnnotatatable {
+
+  List<ODataAnnotation> getAnnotations();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
new file mode 100644
index 0000000..d90ff4f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
@@ -0,0 +1,103 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+
+public interface ODataAnnotation {
+
+  /**
+   * Returns annotation name.
+   *
+   * @return annotation name.
+   */
+  String getTerm();
+
+  /**
+   * Returns annotation value.
+   *
+   * @return annotation value.
+   */
+  ODataValue getValue();
+
+  /**
+   * Checks if has null value.
+   *
+   * @return 'TRUE' if has null value; 'FALSE' otherwise.
+   */
+  boolean hasNullValue();
+
+  /**
+   * Checks if has primitive value.
+   *
+   * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+   */
+  boolean hasPrimitiveValue();
+
+  /**
+   * Gets primitive value.
+   *
+   * @return primitive value if exists; null otherwise.
+   */
+  ODataPrimitiveValue getPrimitiveValue();
+
+  /**
+   * Checks if has collection value.
+   *
+   * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+   */
+  boolean hasCollectionValue();
+
+  /**
+   * Gets collection value.
+   *
+   * @return collection value if exists; null otherwise.
+   */
+  ODataCollectionValue<ODataValue> getCollectionValue();
+
+  /**
+   * Checks if has complex value.
+   *
+   * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+   */
+  boolean hasComplexValue();
+
+  /**
+   * Gets complex value.
+   *
+   * @return complex value if exists; null otherwise.
+   */
+  ODataComplexValue<ODataProperty> getComplexValue();
+
+  /**
+   * Checks if has enum value.
+   *
+   * @return 'TRUE' if has enum value; 'FALSE' otherwise.
+   */
+  boolean hasEnumValue();
+
+  /**
+   * Gets enum value.
+   *
+   * @return enum value if exists; null otherwise.
+   */
+  ODataEnumValue getEnumValue();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
index df9e801..fb24dda 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.domain.v4;
 import java.util.List;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 
-public interface ODataEntity extends CommonODataEntity {
+public interface ODataEntity extends CommonODataEntity, ODataAnnotatatable {
 
   @Override
   ODataProperty getProperty(String name);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
index cd06f44..ca25b0b 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
@@ -22,7 +22,7 @@ import java.net.URI;
 import java.util.List;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 
-public interface ODataEntitySet extends CommonODataEntitySet {
+public interface ODataEntitySet extends CommonODataEntitySet, ODataAnnotatatable {
 
   @Override
   List<ODataEntity> getEntities();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLink.java
new file mode 100644
index 0000000..5ff76a8
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLink.java
@@ -0,0 +1,74 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataLink extends org.apache.olingo.commons.api.domain.ODataLink implements ODataAnnotatatable {
+
+  private static final long serialVersionUID = 8953805653775734101L;
+
+  public static class Builder extends org.apache.olingo.commons.api.domain.ODataLink.Builder {
+
+    @Override
+    public Builder setVersion(final ODataServiceVersion version) {
+      super.setVersion(version);
+      return this;
+    }
+
+    @Override
+    public Builder setURI(final URI uri) {
+      super.setURI(uri);
+      return this;
+    }
+
+    @Override
+    public Builder setType(final ODataLinkType type) {
+      super.setType(type);
+      return this;
+    }
+
+    @Override
+    public Builder setTitle(final String title) {
+      super.setTitle(title);
+      return this;
+    }
+
+    @Override
+    public ODataLink build() {
+      return new ODataLink(version, uri, type, title);
+    }
+  }
+
+  private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
+
+  public ODataLink(final ODataServiceVersion version, final URI uri, final ODataLinkType type, final String title) {
+    super(version, uri, type, title);
+  }
+
+  @Override
+  public List<ODataAnnotation> getAnnotations() {
+    return annotations;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
index a54be59..6717510 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataLinkedComplexValue.java
@@ -21,6 +21,7 @@ package org.apache.olingo.commons.api.domain.v4;
 import org.apache.olingo.commons.api.domain.ODataComplexValue;
 import org.apache.olingo.commons.api.domain.ODataLinked;
 
-public interface ODataLinkedComplexValue extends ODataValue, ODataLinked, ODataComplexValue<ODataProperty> {
+public interface ODataLinkedComplexValue
+        extends ODataValue, ODataLinked, ODataComplexValue<ODataProperty>, ODataAnnotatatable {
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
index 13abadc..b027027 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -40,6 +40,18 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
   @Override
   ODataEntity newEntity(FullQualifiedName typeName, URI link);
 
+  @Override
+  ODataLink newEntitySetNavigationLink(String name, URI link);
+
+  @Override
+  ODataLink newEntityNavigationLink(String name, URI link);
+
+  @Override
+  ODataLink newAssociationLink(String name, URI link);
+
+  @Override
+  ODataLink newMediaEditLink(String name, URI link);
+
   ODataEnumValue newEnumValue(String typeName, String value);
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
index 4031486..eaff66c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.domain.ODataCollectionValue;
 import org.apache.olingo.commons.api.domain.ODataComplexValue;
 
-public interface ODataProperty extends CommonODataProperty {
+public interface ODataProperty extends CommonODataProperty, ODataAnnotatatable {
 
   /**
    * Gets collection value.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAnnotatedObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAnnotatedObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAnnotatedObject.java
new file mode 100644
index 0000000..6383c80
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAnnotatedObject.java
@@ -0,0 +1,37 @@
+/*
+ * 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.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
+
+public abstract class AbstractAnnotatedObject extends AbstractPayloadObject implements Annotatable {
+
+  private static final long serialVersionUID = 4163841499530412213L;
+
+  private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+  @Override
+  public List<Annotation> getAnnotations() {
+    return annotations;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
index a86dad7..1050867 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
@@ -23,7 +23,7 @@ import java.net.URI;
 import java.text.ParseException;
 import java.util.Date;
 
-abstract class AbstractODataObject extends AbstractPayloadObject {
+abstract class AbstractODataObject extends AbstractAnnotatedObject {
 
   private static final long serialVersionUID = -4391162864875546927L;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
index 940bf89..3f8da74 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
@@ -18,14 +18,10 @@
  */
 package org.apache.olingo.commons.core.data;
 
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.Value;
 
-public abstract class AbstractProperty implements Property {
+public abstract class AbstractProperty extends AbstractAnnotatedObject implements Property {
 
   private String name;
 
@@ -62,19 +58,4 @@ public abstract class AbstractProperty implements Property {
   public void setValue(final Value value) {
     this.value = value;
   }
-
-  @Override
-  public boolean equals(final Object obj) {
-    return EqualsBuilder.reflectionEquals(this, obj);
-  }
-
-  @Override
-  public int hashCode() {
-    return HashCodeBuilder.reflectionHashCode(this);
-  }
-
-  @Override
-  public String toString() {
-    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
-  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
index bb865d1..85acc8f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkImpl.java
@@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.Link;
 
-public class LinkImpl extends AbstractPayloadObject implements Link {
+public class LinkImpl extends AbstractAnnotatedObject implements Link {
 
   private static final long serialVersionUID = -3449344217160035501L;
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
index 4394dfa..a1bc0c8 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.data;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.LinkedComplexValue;
 
@@ -29,6 +30,8 @@ public class LinkedComplexValueImpl extends ComplexValueImpl implements LinkedCo
 
   private final List<Link> navigationLinks = new ArrayList<Link>();
 
+  private final List<Annotation> annotations = new ArrayList<Annotation>();
+
   @Override
   public boolean isLinkedComplex() {
     return true;
@@ -44,4 +47,8 @@ public class LinkedComplexValueImpl extends ComplexValueImpl implements LinkedCo
     return navigationLinks;
   }
 
+  @Override
+  public List<Annotation> getAnnotations() {
+    return annotations;
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
index 0e438c5..d3f4afc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -18,13 +18,11 @@
  */
 package org.apache.olingo.commons.core.domain;
 
-import java.net.URI;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 import org.apache.olingo.commons.api.domain.ODataInlineEntity;
 import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
 
@@ -47,16 +45,4 @@ public abstract class AbstractODataObjectFactory implements CommonODataObjectFac
   public ODataInlineEntity newDeepInsertEntity(final String name, final CommonODataEntity entity) {
     return new ODataInlineEntity(version, null, ODataLinkType.ENTITY_NAVIGATION, name, entity);
   }
-
-  @Override
-  public ODataLink newEntityNavigationLink(final String name, final URI link) {
-    return new ODataLink.Builder().setVersion(version).setURI(link).
-            setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
-  }
-
-  @Override
-  public ODataLink newEntitySetNavigationLink(final String name, final URI link) {
-    return new ODataLink.Builder().setVersion(version).setURI(link).
-            setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
-  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
index f488ed9..b647bcf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
@@ -68,6 +68,30 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
   }
 
   @Override
+  public ODataLink newEntityNavigationLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+  }
+
+  @Override
+  public ODataLink newEntitySetNavigationLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+  }
+
+  @Override
+  public ODataLink newAssociationLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+  }
+
+  @Override
+  public ODataLink newMediaEditLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+  }
+
+  @Override
   public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
     return new ODataPrimitiveValueImpl.BuilderImpl(version);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
index 07ae0da..70fa1ba 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 import org.apache.olingo.commons.api.domain.ODataComplexValue;
 import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
@@ -43,6 +44,8 @@ public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProper
    */
   private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
 
+  private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
+
   public ODataComplexValueImpl(final String typeName) {
     super(typeName);
   }
@@ -151,4 +154,10 @@ public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProper
 
     return result;
   }
+
+  @Override
+  public List<ODataAnnotation> getAnnotations() {
+    return annotations;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java
index 23bfdf5..200f6df 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeletedEntityImpl.java
@@ -19,10 +19,10 @@
 package org.apache.olingo.commons.core.domain.v4;
 
 import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataItem;
 import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity;
-import org.apache.olingo.commons.core.data.AbstractPayloadObject;
 
-public class ODataDeletedEntityImpl extends AbstractPayloadObject implements ODataDeletedEntity {
+public class ODataDeletedEntityImpl extends ODataItem implements ODataDeletedEntity {
 
   private static final long serialVersionUID = -3841730551749114664L;
 
@@ -30,6 +30,10 @@ public class ODataDeletedEntityImpl extends AbstractPayloadObject implements ODa
 
   private Reason reason;
 
+  public ODataDeletedEntityImpl() {
+    super(null);
+  }
+
   @Override
   public URI getId() {
     return id;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
index 0c549ac..ed9ad15 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
@@ -19,10 +19,10 @@
 package org.apache.olingo.commons.core.domain.v4;
 
 import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataItem;
 import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
-import org.apache.olingo.commons.core.data.AbstractPayloadObject;
 
-public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDeltaLink {
+public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink {
 
   private static final long serialVersionUID = -6686550836508873044L;
 
@@ -32,6 +32,10 @@ public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDe
 
   private URI target;
 
+  public ODataDeltaLinkImpl() {
+    super(null);
+  }
+
   @Override
   public URI getSource() {
     return source;
@@ -48,7 +52,7 @@ public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDe
   }
 
   @Override
-  public void setRelationship(String relationship) {
+  public void setRelationship(final String relationship) {
     this.relationship = relationship;
   }
 
@@ -58,7 +62,7 @@ public class ODataDeltaLinkImpl extends AbstractPayloadObject implements ODataDe
   }
 
   @Override
-  public void setTarget(URI target) {
+  public void setTarget(final URI target) {
     this.target = target;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
index 0f81a4e..0dd296f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.domain.v4;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -36,6 +37,8 @@ public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity
 
   private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
 
+  private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
+
   public ODataEntityImpl(final FullQualifiedName typeName) {
     super(typeName);
   }
@@ -60,4 +63,9 @@ public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity
     return properties;
   }
 
+  @Override
+  public List<ODataAnnotation> getAnnotations() {
+    return annotations;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
index 81a795b..be3a722 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
@@ -21,6 +21,7 @@ package org.apache.olingo.commons.core.domain.v4;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
 import org.apache.olingo.commons.core.domain.AbstractODataEntitySet;
@@ -29,11 +30,14 @@ public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataE
 
   private static final long serialVersionUID = -8127933181196033586L;
 
+  private URI deltaLink;
+
   private final List<ODataEntity> entities = new ArrayList<ODataEntity>();
 
-  private URI deltaLink;
+  private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
 
   public ODataEntitySetImpl() {
+    super();
   }
 
   public ODataEntitySetImpl(final URI next) {
@@ -59,4 +63,10 @@ public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataE
   public void setDeltaLink(final URI deltaLink) {
     this.deltaLink = deltaLink;
   }
+
+  @Override
+  public List<ODataAnnotation> getAnnotations() {
+    return annotations;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
index d52624b..bc3809f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -22,12 +22,14 @@ import java.net.URI;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.domain.ODataCollectionValue;
 import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
 import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
 import org.apache.olingo.commons.api.domain.v4.ODataDelta;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
 import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataLink;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.domain.v4.ODataValue;
@@ -64,6 +66,30 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
   }
 
   @Override
+  public ODataLink newEntityNavigationLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+  }
+
+  @Override
+  public ODataLink newEntitySetNavigationLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+  }
+
+  @Override
+  public ODataLink newAssociationLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+  }
+
+  @Override
+  public ODataLink newMediaEditLink(final String name, final URI link) {
+    return new ODataLink.Builder().setVersion(version).setURI(link).
+            setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+  }
+
+  @Override
   public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
     return new ODataPrimitiveValueImpl.BuilderImpl(version);
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/70cdaef5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
index 541c360..8fa9727 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -18,8 +18,11 @@
  */
 package org.apache.olingo.commons.core.domain.v4;
 
+import java.util.ArrayList;
+import java.util.List;
 import org.apache.olingo.commons.api.domain.ODataCollectionValue;
 import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
@@ -30,6 +33,8 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
 
   private static final long serialVersionUID = 4851331227420757747L;
 
+  private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
+
   public ODataPropertyImpl(final String name, final org.apache.olingo.commons.api.domain.ODataValue value) {
     super(name, value);
   }
@@ -68,4 +73,8 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
             : null;
   }
 
+  @Override
+  public List<ODataAnnotation> getAnnotations() {
+    return annotations;
+  }
 }


[5/5] git commit: [OLINGO-264] Instance annotations managed at binding level + test provided

Posted by il...@apache.org.
[OLINGO-264] Instance annotations managed at binding level + test provided


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

Branch: refs/heads/master
Commit: 8caf3fece3a42d4cf1bbf2c94840ef5be3f288f8
Parents: ec9e8ca
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed May 7 12:39:16 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed May 7 12:39:16 2014 +0200

----------------------------------------------------------------------
 .../client/core/op/AbstractODataBinder.java     |  66 ++++---
 .../client/core/op/impl/v3/ODataBinderImpl.java |   8 +-
 .../client/core/op/impl/v4/ODataBinderImpl.java | 175 +++++++++++++++----
 .../olingo/client/core/v4/EntityTest.java       |  77 ++++++--
 .../apache/olingo/commons/api/data/Linked.java  |  16 ++
 .../commons/api/domain/v4/ODataAnnotation.java  |  75 +-------
 .../commons/api/domain/v4/ODataProperty.java    |  39 +----
 .../commons/api/domain/v4/ODataValuable.java    | 104 +++++++++++
 .../commons/core/data/AbstractEntity.java       |  22 +++
 .../core/data/LinkedComplexValueImpl.java       |  22 +++
 .../core/domain/AbstractODataProperty.java      |   9 -
 .../core/domain/v4/ODataAnnotationImpl.java     | 102 +++++++++++
 .../core/domain/v4/ODataPropertyImpl.java       |  28 +--
 .../core/domain/v4/ODataValuableImpl.java       | 120 +++++++++++++
 14 files changed, 644 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index c54b9e7..397ae95 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -36,6 +36,7 @@ import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.Linked;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
 import org.apache.olingo.commons.api.data.Value;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
@@ -441,12 +442,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     return entity;
   }
 
-  protected EdmTypeInfo buildTypeInfo(final ResWrap<Property> resource) {
+  protected EdmTypeInfo buildTypeInfo(final ContextURL contextURL, final String metadataETag,
+          final String propertyName, final String propertyType) {
+
     FullQualifiedName typeName = null;
-    final EdmType entityType = findEntityType(resource.getContextURL(), resource.getMetadataETag());
+    final EdmType entityType = findEntityType(contextURL, metadataETag);
     if (entityType instanceof EdmStructuredType) {
-      final EdmProperty edmProperty = ((EdmStructuredType) entityType).
-              getStructuralProperty(resource.getPayload().getName());
+      final EdmProperty edmProperty = ((EdmStructuredType) entityType).getStructuralProperty(propertyName);
       if (edmProperty != null) {
         typeName = edmProperty.getType().getFullQualifiedName();
       }
@@ -454,8 +456,8 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
 
     EdmTypeInfo typeInfo = null;
     if (typeName == null) {
-      if (resource.getPayload().getType() != null) {
-        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(resource.getPayload().getType()).build();
+      if (propertyType != null) {
+        typeInfo = new EdmTypeInfo.Builder().setTypeExpression(propertyType).build();
       }
     } else {
       typeInfo = new EdmTypeInfo.Builder().setTypeExpression(typeName.toString()).build();
@@ -463,43 +465,37 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
     return typeInfo;
   }
 
-  protected ODataValue getODataValue(final ResWrap<Property> resource) {
-    final EdmTypeInfo typeInfo = buildTypeInfo(resource);
+  protected ODataValue getODataValue(final FullQualifiedName type,
+          final Valuable valuable, final ContextURL contextURL, final String metadataETag) {
 
     ODataValue value = null;
-    if (resource.getPayload().getValue().isPrimitive()) {
+    if (valuable.getValue().isPrimitive()) {
       value = client.getObjectFactory().newPrimitiveValueBuilder().
-              setText(resource.getPayload().getValue().asPrimitive().get()).
-              setType(typeInfo == null
+              setText(valuable.getValue().asPrimitive().get()).
+              setType(type == null
                       ? null
-                      : EdmPrimitiveTypeKind.valueOfFQN(
-                              client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
-    } else if (resource.getPayload().getValue().isGeospatial()) {
+                      : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
+    } else if (valuable.getValue().isGeospatial()) {
       value = client.getObjectFactory().newPrimitiveValueBuilder().
-              setValue(resource.getPayload().getValue().asGeospatial().get()).
-              setType(typeInfo == null
-                      || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
-                      || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
-                      ? resource.getPayload().getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
-                      : EdmPrimitiveTypeKind.valueOfFQN(
-                              client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
-    } else if (resource.getPayload().getValue().isComplex()) {
-      value = client.getObjectFactory().newComplexValue(typeInfo == null
-              ? null : typeInfo.getFullQualifiedName().toString());
-
-      for (Property property : resource.getPayload().getValue().asComplex().get()) {
-        value.asComplex().add(getODataProperty(
-                new ResWrap<Property>(resource.getContextURL(), resource.getMetadataETag(), property)));
+              setValue(valuable.getValue().asGeospatial().get()).
+              setType(type == null
+                      || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(type)
+                      || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(type)
+                      ? valuable.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
+                      : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), type.toString())).build();
+    } else if (valuable.getValue().isComplex()) {
+      value = client.getObjectFactory().newComplexValue(type == null ? null : type.toString());
+
+      for (Property property : valuable.getValue().asComplex().get()) {
+        value.asComplex().add(getODataProperty(new ResWrap<Property>(contextURL, metadataETag, property)));
       }
-    } else if (resource.getPayload().getValue().isCollection()) {
-      value = client.getObjectFactory().newCollectionValue(typeInfo == null
-              ? null : "Collection(" + typeInfo.getFullQualifiedName().toString() + ")");
+    } else if (valuable.getValue().isCollection()) {
+      value = client.getObjectFactory().newCollectionValue(type == null ? null : "Collection(" + type.toString() + ")");
 
-      for (Value _value : resource.getPayload().getValue().asCollection().get()) {
-        final JSONPropertyImpl fake = new JSONPropertyImpl();
+      for (Value _value : valuable.getValue().asCollection().get()) {
+        final Property fake = new JSONPropertyImpl();
         fake.setValue(_value);
-        value.asCollection().add(getODataValue(
-                new ResWrap<Property>(resource.getContextURL(), resource.getMetadataETag(), fake)));
+        value.asCollection().add(getODataValue(type, fake, contextURL, metadataETag));
       }
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index c429177..246c8e1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -34,6 +34,7 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
 import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
 import org.apache.olingo.commons.api.domain.v3.ODataProperty;
 import org.apache.olingo.commons.core.domain.v3.ODataPropertyImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 import org.apache.olingo.commons.core.op.ResourceFactory;
 
 public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -83,7 +84,12 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
 
   @Override
   public ODataProperty getODataProperty(final ResWrap<Property> property) {
-    return new ODataPropertyImpl(property.getPayload().getName(), getODataValue(property));
+    final EdmTypeInfo typeInfo = buildTypeInfo(property.getContextURL(), property.getMetadataETag(),
+            property.getPayload().getName(), property.getPayload().getType());
+
+    return new ODataPropertyImpl(property.getPayload().getName(),
+            getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),
+                    property.getPayload(), property.getContextURL(), property.getMetadataETag()));
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 65b59e8..4bcec5a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -26,29 +26,49 @@ import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.op.AbstractODataBinder;
 import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.ContextURL;
 import org.apache.olingo.commons.api.data.DeletedEntity;
 import org.apache.olingo.commons.api.data.Delta;
 import org.apache.olingo.commons.api.data.DeltaLink;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Linked;
 import org.apache.olingo.commons.api.data.LinkedComplexValue;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
 import org.apache.olingo.commons.api.data.Value;
 import org.apache.olingo.commons.api.domain.CommonODataEntity;
 import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLinked;
 import org.apache.olingo.commons.api.domain.ODataServiceDocument;
 import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotatatable;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity.Reason;
 import org.apache.olingo.commons.api.domain.v4.ODataDelta;
+import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataLink;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValuable;
 import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.core.data.AnnotationImpl;
 import org.apache.olingo.commons.core.data.EnumValueImpl;
 import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
+import org.apache.olingo.commons.core.domain.v4.ODataAnnotationImpl;
 import org.apache.olingo.commons.core.domain.v4.ODataDeletedEntityImpl;
 import org.apache.olingo.commons.core.domain.v4.ODataDeltaLinkImpl;
 import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
@@ -96,17 +116,60 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
     return serviceDocument;
   }
 
+  private void updateValuable(final Valuable propertyResource, final ODataValuable odataValuable,
+          final Class<? extends Entity> reference) {
+
+    propertyResource.setValue(getValue(odataValuable.getValue(), reference));
+
+    if (odataValuable.hasPrimitiveValue()) {
+      propertyResource.setType(odataValuable.getPrimitiveValue().getTypeName());
+    } else if (odataValuable.hasEnumValue()) {
+      propertyResource.setType(odataValuable.getEnumValue().getTypeName());
+    } else if (odataValuable.hasComplexValue()) {
+      propertyResource.setType(odataValuable.getComplexValue().getTypeName());
+    } else if (odataValuable.hasCollectionValue()) {
+      propertyResource.setType(odataValuable.getCollectionValue().getTypeName());
+    }
+  }
+
+  private void annotations(final ODataAnnotatatable odataAnnotatable, final Annotatable annotatable,
+          final Class<? extends Entity> reference) {
+
+    for (ODataAnnotation odataAnnotation : odataAnnotatable.getAnnotations()) {
+      final Annotation annotation = new AnnotationImpl();
+
+      annotation.setTerm(odataAnnotation.getTerm());
+      updateValuable(annotation, odataAnnotation, reference);
+
+      annotatable.getAnnotations().add(annotation);
+    }
+  }
+
   @Override
   public EntitySet getEntitySet(final CommonODataEntitySet odataEntitySet, final Class<? extends EntitySet> reference) {
     final EntitySet entitySet = super.getEntitySet(odataEntitySet, reference);
     entitySet.setDeltaLink(((ODataEntitySet) odataEntitySet).getDeltaLink());
+    annotations((ODataEntitySet) odataEntitySet, entitySet, ResourceFactory.entityClassForEntitySet(reference));
     return entitySet;
   }
 
   @Override
+  protected void links(final ODataLinked odataLinked, final Linked linked, Class<? extends Entity> reference) {
+    super.links(odataLinked, linked, reference);
+
+    for (Link link : linked.getNavigationLinks()) {
+      final org.apache.olingo.commons.api.domain.ODataLink odataLink = odataLinked.getNavigationLink(link.getTitle());
+      if (!(odataLink instanceof ODataInlineEntity) && !(odataLink instanceof ODataInlineEntitySet)) {
+        annotations((ODataLink) odataLink, link, reference);
+      }
+    }
+  }
+
+  @Override
   public Entity getEntity(final CommonODataEntity odataEntity, final Class<? extends Entity> reference) {
     final Entity entity = super.getEntity(odataEntity, reference);
     entity.setId(((ODataEntity) odataEntity).getReference());
+    annotations((ODataEntity) odataEntity, entity, reference);
     return entity;
   }
 
@@ -116,17 +179,8 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
 
     final Property propertyResource = ResourceFactory.newProperty(reference);
     propertyResource.setName(_property.getName());
-    propertyResource.setValue(getValue(_property.getValue(), reference));
-
-    if (_property.hasPrimitiveValue()) {
-      propertyResource.setType(_property.getPrimitiveValue().getTypeName());
-    } else if (_property.hasEnumValue()) {
-      propertyResource.setType(_property.getEnumValue().getTypeName());
-    } else if (_property.hasComplexValue()) {
-      propertyResource.setType(_property.getComplexValue().getTypeName());
-    } else if (_property.hasCollectionValue()) {
-      propertyResource.setType(_property.getCollectionValue().getTypeName());
-    }
+    updateValuable(propertyResource, _property, reference);
+    annotations(_property, propertyResource, reference);
 
     return propertyResource;
   }
@@ -150,6 +204,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
 
         final ODataLinkedComplexValue linked =
                 ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asLinkedComplex();
+        annotations(linked, lcValueResource, reference);
         links(linked, lcValueResource, reference);
 
         valueResource = lcValueResource;
@@ -158,6 +213,22 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
     return valueResource;
   }
 
+  private void odataAnnotations(final Annotatable annotatable, final ODataAnnotatatable odataAnnotatable) {
+    for (Annotation annotation : annotatable.getAnnotations()) {
+      FullQualifiedName fqn = null;
+      if (client instanceof EdmEnabledODataClient) {
+        final EdmTerm term = ((EdmEnabledODataClient) client).getEdm(null).
+                getTerm(new FullQualifiedName(annotation.getTerm()));
+        if (term != null) {
+          fqn = term.getType().getFullQualifiedName();
+        }
+      }
+
+      final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
+              (org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null));
+    }
+  }
+
   @Override
   public ODataEntitySet getODataEntitySet(final ResWrap<EntitySet> resource) {
     final ODataEntitySet entitySet = (ODataEntitySet) super.getODataEntitySet(resource);
@@ -167,52 +238,82 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
               ? resource.getPayload().getBaseURI() : resource.getContextURL().getServiceRoot();
       entitySet.setDeltaLink(URIUtils.getURI(base, resource.getPayload().getDeltaLink()));
     }
+    odataAnnotations(resource.getPayload(), entitySet);
 
     return entitySet;
   }
 
   @Override
+  protected void odataNavigationLinks(final EdmStructuredType edmType,
+          final Linked linked, final ODataLinked odataLinked, final String metadataETag, final URI base) {
+
+    super.odataNavigationLinks(edmType, linked, odataLinked, metadataETag, base);
+    for (org.apache.olingo.commons.api.domain.ODataLink link : odataLinked.getNavigationLinks()) {
+      if (!(link instanceof ODataInlineEntity) && !(link instanceof ODataInlineEntitySet)) {
+        odataAnnotations(linked.getNavigationLink(link.getName()), (ODataAnnotatatable) link);
+      }
+    }
+  }
+
+  @Override
   public ODataEntity getODataEntity(final ResWrap<Entity> resource) {
     final ODataEntity entity = (ODataEntity) super.getODataEntity(resource);
+
     entity.setReference(resource.getPayload().getId());
+    odataAnnotations(resource.getPayload(), entity);
+
     return entity;
   }
 
   @Override
-  public ODataProperty getODataProperty(final ResWrap<Property> property) {
-    return new ODataPropertyImpl(property.getPayload().getName(), getODataValue(property));
+  public ODataProperty getODataProperty(final ResWrap<Property> resource) {
+    final EdmTypeInfo typeInfo = buildTypeInfo(resource.getContextURL(), resource.getMetadataETag(),
+            resource.getPayload().getName(), resource.getPayload().getType());
+
+    final ODataProperty property = new ODataPropertyImpl(resource.getPayload().getName(),
+            getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),
+                    resource.getPayload(), resource.getContextURL(), resource.getMetadataETag()));
+    odataAnnotations(resource.getPayload(), property);
+
+    return property;
   }
 
   @Override
-  protected ODataValue getODataValue(final ResWrap<Property> resource) {
-    final EdmTypeInfo typeInfo = buildTypeInfo(resource);
+  protected ODataValue getODataValue(final FullQualifiedName type,
+          final Valuable valuable, final ContextURL contextURL, final String metadataETag) {
+
+    // fixes enum values treated as primitive when no type information is available
+    if (client instanceof EdmEnabledODataClient && type != null) {
+      final EdmEnumType edmType = ((EdmEnabledODataClient) client).getEdm(metadataETag).getEnumType(type);
+      if (valuable.getValue().isPrimitive() && edmType != null) {
+        valuable.setValue(new EnumValueImpl(valuable.getValue().asPrimitive().get()));
+      }
+    }
 
     ODataValue value;
-    if (resource.getPayload().getValue().isEnum()) {
-      value = ((ODataClient) client).getObjectFactory().newEnumValue(
-              typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(),
-              resource.getPayload().getValue().asEnum().get());
-    } else if (resource.getPayload().getValue().isLinkedComplex()) {
-      final ODataLinkedComplexValue lcValue = ((ODataClient) client).getObjectFactory().
-              newLinkedComplexValue(typeInfo == null ? null : typeInfo.getFullQualifiedName().toString());
-
-      for (Property property : resource.getPayload().getValue().asComplex().get()) {
-        lcValue.add(getODataProperty(
-                new ResWrap<Property>(resource.getContextURL(), resource.getMetadataETag(), property)));
+    if (valuable.getValue().isEnum()) {
+      value = ((ODataClient) client).getObjectFactory().newEnumValue(type == null ? null : type.toString(),
+              valuable.getValue().asEnum().get());
+    } else if (valuable.getValue().isLinkedComplex()) {
+      final ODataLinkedComplexValue lcValue =
+              ((ODataClient) client).getObjectFactory().newLinkedComplexValue(type == null ? null : type.toString());
+
+      for (Property property : valuable.getValue().asComplex().get()) {
+        lcValue.add(getODataProperty(new ResWrap<Property>(contextURL, metadataETag, property)));
       }
 
       EdmComplexType edmType = null;
-      if (client instanceof EdmEnabledODataClient && typeInfo != null) {
-        edmType = ((EdmEnabledODataClient) client).getEdm(resource.getMetadataETag()).
-                getComplexType(typeInfo.getFullQualifiedName());
+      if (client instanceof EdmEnabledODataClient && type != null) {
+        edmType = ((EdmEnabledODataClient) client).getEdm(metadataETag).getComplexType(type);
       }
 
-      odataNavigationLinks(edmType, resource.getPayload().getValue().asLinkedComplex(), lcValue,
-              resource.getMetadataETag(), resource.getContextURL() == null ? null : resource.getContextURL().getURI());
+      odataNavigationLinks(edmType, valuable.getValue().asLinkedComplex(), lcValue, metadataETag,
+              contextURL == null ? null : contextURL.getURI());
+      odataAnnotations(valuable.getValue().asLinkedComplex(), lcValue);
 
       value = lcValue;
     } else {
-      value = super.getODataValue(resource);
+      value = super.getODataValue(type, valuable, contextURL, metadataETag);
     }
 
     return value;
@@ -249,20 +350,26 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
       delta.getDeletedEntities().add(impl);
     }
 
+    odataAnnotations(resource.getPayload(), delta);
+
     for (DeltaLink link : resource.getPayload().getAddedLinks()) {
-      final ODataDeltaLinkImpl impl = new ODataDeltaLinkImpl();
+      final ODataDeltaLink impl = new ODataDeltaLinkImpl();
       impl.setRelationship(link.getRelationship());
       impl.setSource(URIUtils.getURI(base, link.getSource()));
       impl.setTarget(URIUtils.getURI(base, link.getTarget()));
 
+      odataAnnotations(link, impl);
+
       delta.getAddedLinks().add(impl);
     }
     for (DeltaLink link : resource.getPayload().getDeletedLinks()) {
-      final ODataDeltaLinkImpl impl = new ODataDeltaLinkImpl();
+      final ODataDeltaLink impl = new ODataDeltaLinkImpl();
       impl.setRelationship(link.getRelationship());
       impl.setSource(URIUtils.getURI(base, link.getSource()));
       impl.setTarget(URIUtils.getURI(base, link.getTarget()));
 
+      odataAnnotations(link, impl);
+
       delta.getDeletedLinks().add(impl);
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 212c527..537dfcd 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -33,10 +33,12 @@ import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
 import org.apache.olingo.commons.api.domain.ODataLink;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.format.ODataPubFormat;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
 import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
@@ -94,8 +96,8 @@ public class EntityTest extends AbstractTest {
     // operations won't get serialized
     entity.getOperations().clear();
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().
+                    getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -130,8 +132,8 @@ public class EntityTest extends AbstractTest {
     // operations won't get serialized
     entity.getOperations().clear();
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().
+                    getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -165,8 +167,8 @@ public class EntityTest extends AbstractTest {
     // operations won't get serialized
     entity.getOperations().clear();
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().
+                    getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -192,8 +194,8 @@ public class EntityTest extends AbstractTest {
     assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
 
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().
+                    getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -219,8 +221,8 @@ public class EntityTest extends AbstractTest {
     assertNotNull(editMedia);
 
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().
+                    getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -243,8 +245,8 @@ public class EntityTest extends AbstractTest {
     assertNotNull(entity.getReference());
 
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().
+                    getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -271,8 +273,8 @@ public class EntityTest extends AbstractTest {
     // ETag is not serialized
     entity.setETag(null);
     final ODataEntity written = getClient().getBinder().getODataEntity(
-            new ResWrap<Entity>((URI) null, null, getClient().
-            getBinder().getEntity(entity, ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity,
+                            ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
     assertEquals(entity, written);
   }
 
@@ -285,4 +287,51 @@ public class EntityTest extends AbstractTest {
   public void jsonComplexNavigationProperties() {
     complexNavigationProperties(ODataPubFormat.JSON);
   }
+
+  private void annotated(final ODataPubFormat format) throws EdmPrimitiveTypeException {
+    final InputStream input = getClass().getResourceAsStream("annotated." + getSuffix(format));
+    final ODataEntity entity = getClient().getBinder().getODataEntity(
+            getClient().getDeserializer().toEntity(input, format));
+    assertNotNull(entity);
+
+    assertFalse(entity.getAnnotations().isEmpty());
+
+    ODataAnnotation annotation = entity.getAnnotations().get(0);
+    assertEquals("com.contoso.display.highlight", annotation.getTerm());
+    assertEquals(true, annotation.getPrimitiveValue().toCastValue(Boolean.class));
+
+    annotation = entity.getAnnotations().get(0);
+    assertEquals("com.contoso.PersonalInfo.PhoneNumbers", annotation.getTerm());
+    assertTrue(annotation.hasCollectionValue());
+
+    annotation = entity.getProperty("LastName").getAnnotations().get(0);
+    assertEquals("com.contoso.display.styleType", annotation.getTerm());
+    assertTrue(annotation.hasComplexValue());
+
+    final ODataLink orders = entity.getNavigationLink("Orders");
+    assertFalse(((org.apache.olingo.commons.api.domain.v4.ODataLink) orders).getAnnotations().isEmpty());
+
+    annotation = ((org.apache.olingo.commons.api.domain.v4.ODataLink) orders).getAnnotations().get(0);
+    assertEquals("com.contoso.display.style", annotation.getTerm());
+    assertEquals("com.contoso.display.styleType", annotation.getValue().getTypeName());
+    assertTrue(annotation.hasComplexValue());
+    assertEquals(2,
+            annotation.getValue().asLinkedComplex().get("order").getPrimitiveValue().toCastValue(Integer.class), 0);
+
+    final ODataEntity written = getClient().getBinder().getODataEntity(
+            new ResWrap<Entity>((URI) null, null, getClient().getBinder().getEntity(entity,
+                            ResourceFactory.entityClassForFormat(format == ODataPubFormat.ATOM))));
+    assertEquals(entity, written);
+  }
+
+  @Test
+  public void atomAnnotated() {
+    complexNavigationProperties(ODataPubFormat.ATOM);
+  }
+
+  @Test
+  public void jsonAnnotated() {
+    complexNavigationProperties(ODataPubFormat.JSON);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
index b5c7db7..a86ef8f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Linked.java
@@ -23,6 +23,14 @@ import java.util.List;
 public interface Linked {
 
   /**
+   * Gets association link with given name, if available, otherwise <tt>null</tt>.
+   *
+   * @param name candidate link name
+   * @return association link with given name, if available, otherwise <tt>null</tt>
+   */
+  Link getAssociationLink(String name);
+
+  /**
    * Gets association links.
    *
    * @return association links.
@@ -30,6 +38,14 @@ public interface Linked {
   List<Link> getAssociationLinks();
 
   /**
+   * Gets navigation link with given name, if available, otherwise <tt>null</tt>.
+   *
+   * @param name candidate link name
+   * @return navigation link with given name, if available, otherwise <tt>null</tt>
+   */
+  Link getNavigationLink(String name);
+
+  /**
    * Gets navigation links.
    *
    * @return links.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
index d90ff4f..ea70546 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataAnnotation.java
@@ -18,11 +18,7 @@
  */
 package org.apache.olingo.commons.api.domain.v4;
 
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-
-public interface ODataAnnotation {
+public interface ODataAnnotation extends ODataValuable {
 
   /**
    * Returns annotation name.
@@ -31,73 +27,4 @@ public interface ODataAnnotation {
    */
   String getTerm();
 
-  /**
-   * Returns annotation value.
-   *
-   * @return annotation value.
-   */
-  ODataValue getValue();
-
-  /**
-   * Checks if has null value.
-   *
-   * @return 'TRUE' if has null value; 'FALSE' otherwise.
-   */
-  boolean hasNullValue();
-
-  /**
-   * Checks if has primitive value.
-   *
-   * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
-   */
-  boolean hasPrimitiveValue();
-
-  /**
-   * Gets primitive value.
-   *
-   * @return primitive value if exists; null otherwise.
-   */
-  ODataPrimitiveValue getPrimitiveValue();
-
-  /**
-   * Checks if has collection value.
-   *
-   * @return 'TRUE' if has collection value; 'FALSE' otherwise.
-   */
-  boolean hasCollectionValue();
-
-  /**
-   * Gets collection value.
-   *
-   * @return collection value if exists; null otherwise.
-   */
-  ODataCollectionValue<ODataValue> getCollectionValue();
-
-  /**
-   * Checks if has complex value.
-   *
-   * @return 'TRUE' if has complex value; 'FALSE' otherwise.
-   */
-  boolean hasComplexValue();
-
-  /**
-   * Gets complex value.
-   *
-   * @return complex value if exists; null otherwise.
-   */
-  ODataComplexValue<ODataProperty> getComplexValue();
-
-  /**
-   * Checks if has enum value.
-   *
-   * @return 'TRUE' if has enum value; 'FALSE' otherwise.
-   */
-  boolean hasEnumValue();
-
-  /**
-   * Gets enum value.
-   *
-   * @return enum value if exists; null otherwise.
-   */
-  ODataEnumValue getEnumValue();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
index eaff66c..09507ba 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -19,43 +19,6 @@
 package org.apache.olingo.commons.api.domain.v4;
 
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
 
-public interface ODataProperty extends CommonODataProperty, ODataAnnotatatable {
-
-  /**
-   * Gets collection value.
-   *
-   * @return collection value if exists; null otherwise.
-   */
-  ODataCollectionValue<ODataValue> getCollectionValue();
-
-  /**
-   * Gets complex value.
-   *
-   * @return complex value if exists; null otherwise.
-   */
-  ODataComplexValue<ODataProperty> getComplexValue();
-  
-  /**
-   * Gets complex value with link information (if available).
-   *
-   * @return complex value if exists; null otherwise.
-   */
-  ODataLinkedComplexValue getLinkedComplexValue();
-
-  /**
-   * Checks if has enum value.
-   *
-   * @return 'TRUE' if has enum value; 'FALSE' otherwise.
-   */
-  boolean hasEnumValue();
-
-  /**
-   * Gets enum value.
-   *
-   * @return enum value if exists; null otherwise.
-   */
-  ODataEnumValue getEnumValue();
+public interface ODataProperty extends CommonODataProperty, ODataAnnotatatable, ODataValuable {
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValuable.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValuable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValuable.java
new file mode 100644
index 0000000..f5b4277
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValuable.java
@@ -0,0 +1,104 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+
+public interface ODataValuable {
+
+  /**
+   * Returns annotation value.
+   *
+   * @return annotation value.
+   */
+  ODataValue getValue();
+
+  /**
+   * Checks if has null value.
+   *
+   * @return 'TRUE' if has null value; 'FALSE' otherwise.
+   */
+  boolean hasNullValue();
+
+  /**
+   * Checks if has primitive value.
+   *
+   * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+   */
+  boolean hasPrimitiveValue();
+
+  /**
+   * Gets primitive value.
+   *
+   * @return primitive value if exists; null otherwise.
+   */
+  ODataPrimitiveValue getPrimitiveValue();
+
+  /**
+   * Checks if has collection value.
+   *
+   * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+   */
+  boolean hasCollectionValue();
+
+  /**
+   * Gets collection value.
+   *
+   * @return collection value if exists; null otherwise.
+   */
+  ODataCollectionValue<ODataValue> getCollectionValue();
+
+  /**
+   * Checks if has complex value.
+   *
+   * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+   */
+  boolean hasComplexValue();
+
+  /**
+   * Gets complex value.
+   *
+   * @return complex value if exists; null otherwise.
+   */
+  ODataComplexValue<ODataProperty> getComplexValue();
+
+  /**
+   * Gets complex value with link information (if available).
+   *
+   * @return complex value if exists; null otherwise.
+   */
+  ODataLinkedComplexValue getLinkedComplexValue();
+
+  /**
+   * Checks if has enum value.
+   *
+   * @return 'TRUE' if has enum value; 'FALSE' otherwise.
+   */
+  boolean hasEnumValue();
+
+  /**
+   * Gets enum value.
+   *
+   * @return enum value if exists; null otherwise.
+   */
+  ODataEnumValue getEnumValue();
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
index fc89504..21ada97 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
@@ -96,12 +96,34 @@ public abstract class AbstractEntity extends AbstractODataObject implements Enti
     this.editLink = editLink;
   }
 
+  private Link getOneByTitle(final String name, final List<Link> links) {
+    Link result = null;
+
+    for (Link link : links) {
+      if (name.equals(link.getTitle())) {
+        result = link;
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  public Link getAssociationLink(final String name) {
+    return getOneByTitle(name, associationLinks);
+  }
+
   @Override
   public List<Link> getAssociationLinks() {
     return associationLinks;
   }
 
   @Override
+  public Link getNavigationLink(final String name) {
+    return getOneByTitle(name, navigationLinks);
+  }
+
+  @Override
   public List<Link> getNavigationLinks() {
     return navigationLinks;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
index a1bc0c8..d37741a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/LinkedComplexValueImpl.java
@@ -37,12 +37,34 @@ public class LinkedComplexValueImpl extends ComplexValueImpl implements LinkedCo
     return true;
   }
 
+  private Link getOneByTitle(final String name, final List<Link> links) {
+    Link result = null;
+
+    for (Link link : links) {
+      if (name.equals(link.getTitle())) {
+        result = link;
+      }
+    }
+
+    return result;
+  }
+
+  @Override
+  public Link getAssociationLink(final String name) {
+    return getOneByTitle(name, associationLinks);
+  }
+
   @Override
   public List<Link> getAssociationLinks() {
     return associationLinks;
   }
 
   @Override
+  public Link getNavigationLink(final String name) {
+    return getOneByTitle(name, navigationLinks);
+  }
+
+  @Override
   public List<Link> getNavigationLinks() {
     return navigationLinks;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
index 532303c..e2e2036 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
@@ -121,25 +121,16 @@ public abstract class AbstractODataProperty implements CommonODataProperty {
     return !hasNullValue() && this.value.isCollection();
   }
 
-  /**
-   * {@inheritDoc }
-   */
   @Override
   public boolean equals(final Object obj) {
     return EqualsBuilder.reflectionEquals(this, obj);
   }
 
-  /**
-   * {@inheritDoc }
-   */
   @Override
   public int hashCode() {
     return HashCodeBuilder.reflectionHashCode(this);
   }
 
-  /**
-   * {@inheritDoc }
-   */
   @Override
   public String toString() {
     return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
new file mode 100644
index 0000000..0814cc0
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataAnnotationImpl.java
@@ -0,0 +1,102 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValuable;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+
+public class ODataAnnotationImpl implements ODataAnnotation {
+
+  private final String term;
+
+  private final ODataValuable valuable;
+
+  public ODataAnnotationImpl(final String term, final ODataValue value) {
+    this.term = term;
+    this.valuable = new ODataValuableImpl(value);
+  }
+
+  @Override
+  public String getTerm() {
+    return term;
+  }
+
+  @Override
+  public ODataValue getValue() {
+    return valuable.getValue();
+  }
+
+  @Override
+  public boolean hasNullValue() {
+    return valuable.hasNullValue();
+  }
+
+  @Override
+  public boolean hasPrimitiveValue() {
+    return valuable.hasPrimitiveValue();
+  }
+
+  @Override
+  public ODataPrimitiveValue getPrimitiveValue() {
+    return valuable.getPrimitiveValue();
+  }
+
+  @Override
+  public boolean hasCollectionValue() {
+    return valuable.hasCollectionValue();
+  }
+
+  @Override
+  public ODataCollectionValue<ODataValue> getCollectionValue() {
+    return valuable.getCollectionValue();
+  }
+
+  @Override
+  public boolean hasComplexValue() {
+    return valuable.hasComplexValue();
+  }
+
+  @Override
+  public ODataComplexValue<ODataProperty> getComplexValue() {
+    return valuable.getComplexValue();
+  }
+
+  @Override
+  public ODataLinkedComplexValue getLinkedComplexValue() {
+    return valuable.getLinkedComplexValue();
+  }
+
+  @Override
+  public boolean hasEnumValue() {
+    return valuable.hasEnumValue();
+  }
+
+  @Override
+  public ODataEnumValue getEnumValue() {
+    return valuable.getEnumValue();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
index 8fa9727..35962e4 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -26,6 +26,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValuable;
 import org.apache.olingo.commons.api.domain.v4.ODataValue;
 import org.apache.olingo.commons.core.domain.AbstractODataProperty;
 
@@ -33,44 +34,43 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
 
   private static final long serialVersionUID = 4851331227420757747L;
 
+  private final ODataValuable valuable;
+
   private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
 
   public ODataPropertyImpl(final String name, final org.apache.olingo.commons.api.domain.ODataValue value) {
     super(name, value);
+    this.valuable = new ODataValuableImpl((ODataValue) value);
+  }
+
+  @Override
+  public ODataValue getValue() {
+    return valuable.getValue();
   }
 
   @Override
   public boolean hasEnumValue() {
-    return !hasNullValue() && getValue() instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
-            && ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).isEnum();
+    return valuable.hasEnumValue();
   }
 
   @Override
   public ODataEnumValue getEnumValue() {
-    return hasEnumValue()
-            ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum()
-            : null;
+    return valuable.getEnumValue();
   }
 
   @Override
   public ODataComplexValue<ODataProperty> getComplexValue() {
-    return hasComplexValue()
-            ? getValue().<ODataProperty>asComplex()
-            : null;
+    return valuable.getComplexValue();
   }
 
   @Override
   public ODataLinkedComplexValue getLinkedComplexValue() {
-    return hasComplexValue() && getValue() instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
-            ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asLinkedComplex()
-            : null;
+    return valuable.getLinkedComplexValue();
   }
 
   @Override
   public ODataCollectionValue<ODataValue> getCollectionValue() {
-    return hasCollectionValue()
-            ? getValue().<ODataValue>asCollection()
-            : null;
+    return valuable.getCollectionValue();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8caf3fec/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java
new file mode 100644
index 0000000..8a08e82
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataValuableImpl.java
@@ -0,0 +1,120 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValuable;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+
+public class ODataValuableImpl implements ODataValuable {
+
+  private final ODataValue value;
+
+  public ODataValuableImpl(final ODataValue value) {
+    this.value = value;
+  }
+
+  @Override
+  public ODataValue getValue() {
+    return value;
+  }
+
+  @Override
+  public boolean hasNullValue() {
+    return this.value == null;
+  }
+
+  @Override
+  public boolean hasPrimitiveValue() {
+    return !hasNullValue() && this.value.isPrimitive();
+  }
+
+  @Override
+  public ODataPrimitiveValue getPrimitiveValue() {
+    return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+  }
+
+  @Override
+  public boolean hasCollectionValue() {
+    return !hasNullValue() && this.value.isCollection();
+  }
+
+  @Override
+  public ODataCollectionValue<ODataValue> getCollectionValue() {
+    return hasCollectionValue()
+            ? getValue().<ODataValue>asCollection()
+            : null;
+  }
+
+  @Override
+  public boolean hasComplexValue() {
+    return !hasNullValue() && this.value.isComplex();
+  }
+
+  @Override
+  public ODataComplexValue<ODataProperty> getComplexValue() {
+    return hasComplexValue()
+            ? getValue().<ODataProperty>asComplex()
+            : null;
+  }
+
+  @Override
+  public ODataLinkedComplexValue getLinkedComplexValue() {
+    return hasComplexValue()
+            ? getValue().asLinkedComplex()
+            : null;
+  }
+
+  @Override
+  public boolean hasEnumValue() {
+    return !hasNullValue() && getValue().isEnum();
+  }
+
+  @Override
+  public ODataEnumValue getEnumValue() {
+    return hasEnumValue()
+            ? getValue().asEnum()
+            : null;
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    return EqualsBuilder.reflectionEquals(this, obj);
+  }
+
+  @Override
+  public int hashCode() {
+    return HashCodeBuilder.reflectionHashCode(this);
+  }
+
+  @Override
+  public String toString() {
+    return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+  }
+
+}


[2/5] git commit: [OLINGO-264] Introducing data and domain objects to let annotate delta links

Posted by il...@apache.org.
[OLINGO-264] Introducing data and domain objects to let annotate delta links


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

Branch: refs/heads/master
Commit: 4a07d59b4d9806a9fc377b9ab6f9d6d916c15e05
Parents: 70cdaef
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue May 6 11:00:30 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue May 6 11:00:30 2014 +0200

----------------------------------------------------------------------
 .../client/core/op/impl/v4/ODataBinderImpl.java | 17 +++---
 .../olingo/commons/api/data/DeletedEntity.java  | 36 +++++++++++
 .../apache/olingo/commons/api/data/Delta.java   |  8 +--
 .../olingo/commons/api/data/DeltaLink.java      | 36 +++++++++++
 .../commons/api/domain/v4/ODataDeltaLink.java   |  2 +-
 .../commons/core/data/AtomDeserializer.java     |  8 +--
 .../commons/core/data/DeletedEntityImpl.java    | 50 +++++++++++++++
 .../olingo/commons/core/data/DeltaLinkImpl.java | 64 ++++++++++++++++++++
 .../core/data/JSONDeltaDeserializer.java        | 11 +---
 .../commons/core/data/v4/AbstractDelta.java     | 16 ++---
 .../core/domain/v4/ODataDeltaLinkImpl.java      | 10 +++
 11 files changed, 223 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 6c7c888..65b59e8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -26,9 +26,9 @@ import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
 import org.apache.olingo.client.api.v4.ODataClient;
 import org.apache.olingo.client.core.op.AbstractODataBinder;
 import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity;
+import org.apache.olingo.commons.api.data.DeletedEntity;
 import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
+import org.apache.olingo.commons.api.data.DeltaLink;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.LinkedComplexValue;
@@ -40,16 +40,17 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
 import org.apache.olingo.commons.api.domain.CommonODataProperty;
 import org.apache.olingo.commons.api.domain.ODataServiceDocument;
 import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity.Reason;
 import org.apache.olingo.commons.api.domain.v4.ODataDelta;
 import org.apache.olingo.commons.api.domain.v4.ODataEntity;
 import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
 import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
 import org.apache.olingo.commons.api.domain.v4.ODataProperty;
 import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.core.domain.v4.ODataDeletedEntityImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeltaLinkImpl;
 import org.apache.olingo.commons.core.data.EnumValueImpl;
 import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
+import org.apache.olingo.commons.core.domain.v4.ODataDeletedEntityImpl;
+import org.apache.olingo.commons.core.domain.v4.ODataDeltaLinkImpl;
 import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 import org.apache.olingo.commons.core.op.ResourceFactory;
@@ -240,15 +241,15 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
       add(delta, getODataEntity(
               new ResWrap<Entity>(resource.getContextURL(), resource.getMetadataETag(), entityResource)));
     }
-    for (ODataDeletedEntity deletedEntity : resource.getPayload().getDeletedEntities()) {
+    for (DeletedEntity deletedEntity : resource.getPayload().getDeletedEntities()) {
       final ODataDeletedEntityImpl impl = new ODataDeletedEntityImpl();
       impl.setId(URIUtils.getURI(base, deletedEntity.getId()));
-      impl.setReason(deletedEntity.getReason());
+      impl.setReason(Reason.valueOf(deletedEntity.getReason().name()));
 
       delta.getDeletedEntities().add(impl);
     }
 
-    for (ODataDeltaLink link : resource.getPayload().getAddedLinks()) {
+    for (DeltaLink link : resource.getPayload().getAddedLinks()) {
       final ODataDeltaLinkImpl impl = new ODataDeltaLinkImpl();
       impl.setRelationship(link.getRelationship());
       impl.setSource(URIUtils.getURI(base, link.getSource()));
@@ -256,7 +257,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
 
       delta.getAddedLinks().add(impl);
     }
-    for (ODataDeltaLink link : resource.getPayload().getDeletedLinks()) {
+    for (DeltaLink link : resource.getPayload().getDeletedLinks()) {
       final ODataDeltaLinkImpl impl = new ODataDeltaLinkImpl();
       impl.setRelationship(link.getRelationship());
       impl.setSource(URIUtils.getURI(base, link.getSource()));

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java
new file mode 100644
index 0000000..49ef737
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.api.data;
+
+import java.net.URI;
+
+public interface DeletedEntity {
+
+  enum Reason {
+
+    deleted,
+    changed;
+
+  }
+
+  URI getId();
+
+  Reason getReason();
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
index 2b80220..29b2fa9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
@@ -18,16 +18,14 @@
  */
 package org.apache.olingo.commons.api.data;
 
-import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity;
-import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
 import java.util.List;
 
 public interface Delta extends EntitySet {
 
-  List<ODataDeletedEntity> getDeletedEntities();
+  List<DeletedEntity> getDeletedEntities();
 
-  List<ODataDeltaLink> getAddedLinks();
+  List<DeltaLink> getAddedLinks();
 
-  List<ODataDeltaLink> getDeletedLinks();
+  List<DeltaLink> getDeletedLinks();
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java
new file mode 100644
index 0000000..77f3982
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.api.data;
+
+import java.net.URI;
+
+public interface DeltaLink extends Annotatable {
+
+  URI getSource();
+
+  void setSource(URI source);
+
+  String getRelationship();
+
+  void setRelationship(String relationship);
+
+  URI getTarget();
+
+  void setTarget(URI target);
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataDeltaLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataDeltaLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataDeltaLink.java
index d42e2d6..ff9e088 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataDeltaLink.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataDeltaLink.java
@@ -20,7 +20,7 @@ package org.apache.olingo.commons.api.domain.v4;
 
 import java.net.URI;
 
-public interface ODataDeltaLink {
+public interface ODataDeltaLink extends ODataAnnotatatable {
 
   URI getSource();
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index fb9b0df..a5171ba 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -20,8 +20,6 @@ package org.apache.olingo.commons.core.data;
 
 import com.fasterxml.aalto.stax.InputFactoryImpl;
 import org.apache.olingo.commons.core.data.v4.AtomDeltaImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeltaLinkImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeletedEntityImpl;
 import java.io.InputStream;
 import java.net.URI;
 import java.text.ParseException;
@@ -35,7 +33,7 @@ import javax.xml.stream.events.XMLEvent;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
 import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity.Reason;
+import org.apache.olingo.commons.api.data.DeletedEntity.Reason;
 import org.apache.olingo.commons.api.data.EntitySet;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Value;
@@ -421,7 +419,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
         } else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
           delta.getEntities().add(entity(reader, event.asStartElement()));
         } else if (deletedEntryQName.equals(event.asStartElement().getName())) {
-          final ODataDeletedEntityImpl deletedEntity = new ODataDeletedEntityImpl();
+          final DeletedEntityImpl deletedEntity = new DeletedEntityImpl();
 
           final Attribute ref = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_REF));
           if (ref != null) {
@@ -436,7 +434,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
         } else if (linkQName.equals(event.asStartElement().getName())
                 || deletedLinkQName.equals(event.asStartElement().getName())) {
 
-          final ODataDeltaLinkImpl link = new ODataDeltaLinkImpl();
+          final DeltaLinkImpl link = new DeltaLinkImpl();
 
           final Attribute source = event.asStartElement().getAttributeByName(QName.valueOf(Constants.ATTR_SOURCE));
           if (source != null) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeletedEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeletedEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeletedEntityImpl.java
new file mode 100644
index 0000000..67ab03b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeletedEntityImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.core.data;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.data.DeletedEntity;
+
+public class DeletedEntityImpl extends AbstractAnnotatedObject implements DeletedEntity {
+
+  private static final long serialVersionUID = 2075093398299488510L;
+
+  private URI id;
+
+  private Reason reason;
+
+  @Override
+  public URI getId() {
+    return id;
+  }
+
+  public void setId(final URI id) {
+    this.id = id;
+  }
+
+  @Override
+  public Reason getReason() {
+    return reason;
+  }
+
+  public void setReason(final Reason reason) {
+    this.reason = reason;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeltaLinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeltaLinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeltaLinkImpl.java
new file mode 100644
index 0000000..0834b55
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/DeltaLinkImpl.java
@@ -0,0 +1,64 @@
+/*
+ * 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.commons.core.data;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.data.DeltaLink;
+
+public class DeltaLinkImpl extends AbstractAnnotatedObject implements DeltaLink {
+
+  private static final long serialVersionUID = 581329273399308799L;
+
+  private URI source;
+
+  private String relationship;
+
+  private URI target;
+
+  @Override
+  public URI getSource() {
+    return source;
+  }
+
+  @Override
+  public void setSource(final URI source) {
+    this.source = source;
+  }
+
+  @Override
+  public String getRelationship() {
+    return relationship;
+  }
+
+  @Override
+  public void setRelationship(final String relationship) {
+    this.relationship = relationship;
+  }
+
+  @Override
+  public URI getTarget() {
+    return target;
+  }
+
+  @Override
+  public void setTarget(final URI target) {
+    this.target = target;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONDeltaDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONDeltaDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONDeltaDeserializer.java
index 6b7f121..f712e74 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONDeltaDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONDeltaDeserializer.java
@@ -19,8 +19,6 @@
 package org.apache.olingo.commons.core.data;
 
 import org.apache.olingo.commons.core.data.v4.JSONDeltaImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeltaLinkImpl;
-import org.apache.olingo.commons.core.domain.v4.ODataDeletedEntityImpl;
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -78,14 +76,11 @@ public class JSONDeltaDeserializer extends AbstractJsonDeserializer<JSONDeltaImp
                   });
           delta.getEntities().add(entity.getPayload());
         } else if (itemContextURL.isDeltaDeletedEntity()) {
-          delta.getDeletedEntities().
-                  add(parser.getCodec().treeToValue(item, ODataDeletedEntityImpl.class));
+          delta.getDeletedEntities().add(parser.getCodec().treeToValue(item, DeletedEntityImpl.class));
         } else if (itemContextURL.isDeltaLink()) {
-          delta.getAddedLinks().
-                  add(parser.getCodec().treeToValue(item, ODataDeltaLinkImpl.class));
+          delta.getAddedLinks().add(parser.getCodec().treeToValue(item, DeltaLinkImpl.class));
         } else if (itemContextURL.isDeltaDeletedLink()) {
-          delta.getDeletedLinks().
-                  add(parser.getCodec().treeToValue(item, ODataDeltaLinkImpl.class));
+          delta.getDeletedLinks().add(parser.getCodec().treeToValue(item, DeltaLinkImpl.class));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v4/AbstractDelta.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v4/AbstractDelta.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v4/AbstractDelta.java
index c2df46c..d4a50ed 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v4/AbstractDelta.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/v4/AbstractDelta.java
@@ -20,33 +20,33 @@ package org.apache.olingo.commons.core.data.v4;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.olingo.commons.api.domain.v4.ODataDeletedEntity;
+import org.apache.olingo.commons.api.data.DeletedEntity;
 import org.apache.olingo.commons.api.data.Delta;
-import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
+import org.apache.olingo.commons.api.data.DeltaLink;
 import org.apache.olingo.commons.core.data.AbstractEntitySet;
 
 public abstract class AbstractDelta extends AbstractEntitySet implements Delta {
 
   private static final long serialVersionUID = 4576771708961553195L;
 
-  private final List<ODataDeletedEntity> deletedEntities = new ArrayList<ODataDeletedEntity>();
+  private final List<DeletedEntity> deletedEntities = new ArrayList<DeletedEntity>();
 
-  private final List<ODataDeltaLink> addedLinks = new ArrayList<ODataDeltaLink>();
+  private final List<DeltaLink> addedLinks = new ArrayList<DeltaLink>();
 
-  private final List<ODataDeltaLink> deletedLinks = new ArrayList<ODataDeltaLink>();
+  private final List<DeltaLink> deletedLinks = new ArrayList<DeltaLink>();
 
   @Override
-  public List<ODataDeletedEntity> getDeletedEntities() {
+  public List<DeletedEntity> getDeletedEntities() {
     return deletedEntities;
   }
 
   @Override
-  public List<ODataDeltaLink> getAddedLinks() {
+  public List<DeltaLink> getAddedLinks() {
     return addedLinks;
   }
 
   @Override
-  public List<ODataDeltaLink> getDeletedLinks() {
+  public List<DeltaLink> getDeletedLinks() {
     return deletedLinks;
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a07d59b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
index ed9ad15..9e2cadc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataDeltaLinkImpl.java
@@ -19,7 +19,10 @@
 package org.apache.olingo.commons.core.domain.v4;
 
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
 import org.apache.olingo.commons.api.domain.ODataItem;
+import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
 import org.apache.olingo.commons.api.domain.v4.ODataDeltaLink;
 
 public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink {
@@ -32,6 +35,8 @@ public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink {
 
   private URI target;
 
+  private final List<ODataAnnotation> annotations = new ArrayList<ODataAnnotation>();
+
   public ODataDeltaLinkImpl() {
     super(null);
   }
@@ -66,4 +71,9 @@ public class ODataDeltaLinkImpl extends ODataItem implements ODataDeltaLink {
     this.target = target;
   }
 
+  @Override
+  public List<ODataAnnotation> getAnnotations() {
+    return annotations;
+  }
+
 }


[3/5] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4

Posted by il...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4


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

Branch: refs/heads/master
Commit: 936e19ca49dd68457e3f79a9ae44c62175e6d750
Parents: 4a07d59 f02d9a0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue May 6 11:00:38 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue May 6 11:00:38 2014 +0200

----------------------------------------------------------------------
 ext/client-proxy/pom.xml                        |  76 ++++
 .../olingo/ext/proxy/api/AbstractContainer.java |  32 ++
 .../ext/proxy/api/AbstractEntityCollection.java |  25 ++
 .../olingo/ext/proxy/api/AbstractEntityKey.java |  54 +++
 .../olingo/ext/proxy/api/AbstractEntitySet.java | 108 +++++
 .../olingo/ext/proxy/api/AbstractOpenType.java  |  31 ++
 .../olingo/ext/proxy/api/NoResultException.java |  35 ++
 .../ext/proxy/api/NonUniqueResultException.java |  35 ++
 .../olingo/ext/proxy/api/OperationType.java     |  40 ++
 .../org/apache/olingo/ext/proxy/api/Query.java  | 128 ++++++
 .../org/apache/olingo/ext/proxy/api/Sort.java   |  65 +++
 .../ext/proxy/api/annotations/ComplexType.java  |  42 ++
 .../ext/proxy/api/annotations/CompoundKey.java  |  32 ++
 .../api/annotations/CompoundKeyElement.java     |  38 ++
 .../proxy/api/annotations/EntityContainer.java  |  36 ++
 .../ext/proxy/api/annotations/EntitySet.java    |  38 ++
 .../ext/proxy/api/annotations/EntityType.java   |  44 ++
 .../ext/proxy/api/annotations/EnumType.java     |  39 ++
 .../olingo/ext/proxy/api/annotations/Key.java   |  34 ++
 .../ext/proxy/api/annotations/KeyClass.java     |  39 ++
 .../ext/proxy/api/annotations/KeyRef.java       |  34 ++
 .../ext/proxy/api/annotations/Namespace.java    |  36 ++
 .../api/annotations/NavigationProperty.java     |  42 ++
 .../ext/proxy/api/annotations/Operation.java    |  62 +++
 .../ext/proxy/api/annotations/Parameter.java    |  50 +++
 .../ext/proxy/api/annotations/Property.java     |  76 ++++
 .../api/annotations/ReferentialConstraint.java  |  42 ++
 .../ext/proxy/api/annotations/RowType.java      |  32 ++
 .../ext/proxy/api/annotations/Singleton.java    |  35 ++
 ext/pojogen-maven-plugin/pom.xml                | 129 ++++++
 .../src/it/actionOverloadingService/pom.xml     |  92 +++++
 .../it/actionOverloadingService/verify.groovy   |  20 +
 .../src/it/defaultService/pom.xml               |  92 +++++
 .../src/it/defaultService/verify.groovy         |  20 +
 .../src/it/keyAsSegmentService/pom.xml          |  92 +++++
 .../src/it/keyAsSegmentService/verify.groovy    |  20 +
 .../src/it/northwind/pom.xml                    |  92 +++++
 .../src/it/northwind/verify.groovy              |  20 +
 .../src/it/odataWriterDefaultService/pom.xml    |  92 +++++
 .../it/odataWriterDefaultService/verify.groovy  |  20 +
 .../src/it/openTypeService/pom.xml              |  92 +++++
 .../src/it/openTypeService/verify.groovy        |  20 +
 .../src/it/primitiveKeysService/pom.xml         |  92 +++++
 .../src/it/primitiveKeysService/verify.groovy   |  20 +
 .../src/it/staticServiceV3/pom.xml              |  92 +++++
 .../src/it/staticServiceV3/verify.groovy        |  20 +
 .../src/it/staticServiceV4/pom.xml              |  92 +++++
 .../src/it/staticServiceV4/verify.groovy        |  20 +
 .../ext/pojogen/AbstractMetadataMojo.java       | 161 ++++++++
 .../olingo/ext/pojogen/AbstractUtility.java     | 411 +++++++++++++++++++
 .../ext/pojogen/NavPropertyBindingDetails.java  | 141 +++++++
 .../ext/pojogen/NavPropertyContainsTarget.java  |  34 ++
 .../olingo/ext/pojogen/V3MetadataMojo.java      | 184 +++++++++
 .../apache/olingo/ext/pojogen/V3Utility.java    |  29 ++
 .../olingo/ext/pojogen/V4MetadataMojo.java      | 192 +++++++++
 .../apache/olingo/ext/pojogen/V4Utility.java    |  29 ++
 .../src/main/resources/complexType.vm           |  48 +++
 .../src/main/resources/container.vm             | 107 +++++
 .../src/main/resources/entityCollection.vm      |  96 +++++
 .../src/main/resources/entitySet.vm             |  65 +++
 .../src/main/resources/entityType.vm            | 169 ++++++++
 .../src/main/resources/entityTypeKey.vm         |  69 ++++
 .../src/main/resources/enumType.vm              |  56 +++
 .../src/main/resources/package-info.vm          |  20 +
 .../src/main/resources/services.vm              |  21 +
 .../src/main/resources/singleton.vm             |  48 +++
 .../src/main/resources/v30/complexType.vm       |  30 ++
 .../src/main/resources/v30/container.vm         |  19 +
 .../src/main/resources/v30/entitySet.vm         |  19 +
 .../src/main/resources/v40/complexType.vm       |  60 +++
 .../src/main/resources/v40/container.vm         |  22 +
 .../src/main/resources/v40/entitySet.vm         |  19 +
 .../src/main/resources/v40/singleton.vm         |  36 ++
 ext/pom.xml                                     |   2 +
 fit/pom.xml                                     |  29 ++
 fit/src/it/staticServiceV3/pom.xml              |  93 +++++
 fit/src/it/staticServiceV3/verify.groovy        |  20 +
 fit/src/it/staticServiceV4/pom.xml              |  93 +++++
 fit/src/it/staticServiceV4/verify.groovy        |  20 +
 fit/src/main/resources/V40/metadata.xml         |   1 +
 .../fit/v3/ActionOverloadingTestITCase.java     | 104 +++--
 .../client/core/edm/EdmBindingTargetImpl.java   |  40 --
 .../client/core/edm/EdmEntityContainerImpl.java |  28 +-
 .../client/core/edm/EdmOperationImpl.java       |   8 +-
 .../olingo/client/core/edm/EdmSchemaImpl.java   |   3 +-
 .../olingo/client/core/v3/MetadataTest.java     |   4 +
 .../olingo/client/core/v4/MetadataTest.java     |   8 +-
 .../commons/api/edm/EdmEntityContainer.java     |   1 -
 .../olingo/commons/core/edm/AbstractEdm.java    |  41 +-
 .../core/edm/AbstractEdmBindingTarget.java      |  39 ++
 .../core/edm/AbstractEdmEntityContainer.java    |  17 +-
 .../core/edm/AbstractEdmNavigationProperty.java |   1 +
 .../olingo/commons/core/edm/EdmTypeInfo.java    |   3 -
 .../commons/core/edm/EdmImplCachingTest.java    |  13 +-
 .../core/edm/provider/EdmBindingTargetImpl.java |  39 --
 pom.xml                                         |  30 +-
 96 files changed, 5058 insertions(+), 181 deletions(-)
----------------------------------------------------------------------



[4/5] git commit: [OLINGO-264] Atom and JSON (de)serializers now dealing with instance annotations

Posted by il...@apache.org.
[OLINGO-264] Atom and JSON (de)serializers now dealing with instance annotations


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

Branch: refs/heads/master
Commit: ec9e8cabf1e9a91134cbf791c797e8545f1bce7b
Parents: 936e19c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue May 6 16:44:14 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue May 6 16:44:14 2014 +0200

----------------------------------------------------------------------
 .../apache/olingo/client/core/v4/JSONTest.java  |  1 +
 .../client/core/v3/PersonDetails_0_Person.json  |  2 +-
 .../apache/olingo/client/core/v4/annotated.json | 62 +++++++++++++
 .../apache/olingo/client/core/v4/annotated.xml  | 76 ++++++++++++++++
 .../apache/olingo/commons/api/Constants.java    |  2 +
 .../olingo/commons/api/data/Annotation.java     | 10 +--
 .../olingo/commons/api/data/Property.java       | 10 +--
 .../olingo/commons/api/data/Valuable.java       | 30 +++++++
 .../commons/core/data/AbstractAtomDealer.java   |  4 +
 .../core/data/AbstractJsonDeserializer.java     | 92 +++++++++++++------
 .../core/data/AbstractJsonSerializer.java       | 25 ++++--
 .../commons/core/data/AbstractProperty.java     |  2 +
 .../commons/core/data/AnnotationImpl.java       | 63 +++++++++++++
 .../commons/core/data/AtomDeserializer.java     | 94 +++++++++++++++-----
 .../commons/core/data/AtomSerializer.java       | 43 +++++++++
 .../core/data/JSONEntityDeserializer.java       | 55 ++++++++----
 .../commons/core/data/JSONEntitySerializer.java |  7 +-
 .../core/data/JSONEntitySetDeserializer.java    | 18 ++++
 .../core/data/JSONEntitySetSerializer.java      |  5 ++
 .../core/data/JSONPropertyDeserializer.java     | 19 ++++
 .../core/data/JSONPropertySerializer.java       | 11 ++-
 21 files changed, 531 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index 65d85e2..39e7a1e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -166,6 +166,7 @@ public class JSONTest extends AbstractTest {
     entity("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
     entity("entityReference", getODataPubFormat());
     entity("entity.withcomplexnavigation", getODataPubFormat());
+    entity("annotated", getODataPubFormat());
   }
 
   protected void property(final String filename, final ODataFormat format) throws Exception {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json
index 61f0208..2d66e23 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/PersonDetails_0_Person.json
@@ -1 +1 @@
-{"odata.metadata":"http://services.odata.org/V3/OData/OData.svc/$metadata#PersonDetails/@Element","odata.type":"ODataDemo.PersonDetail","odata.id":"http://services.odata.org/V3/OData/OData.svc/PersonDetails(0)","odata.editLink":"PersonDetails(0)","Person@odata.navigationLinkUrl":"PersonDetails(0)/Person","Person@odata.associationLinkUrl":"PersonDetails(0)/$links/Person","Person":{"odata.type":"ODataDemo.Person","odata.id":"http://services.odata.org/V3/OData/OData.svc/Persons(0)","odata.editLink":"Persons(0)","PersonDetail@odata.navigationLinkUrl":"Persons(0)/PersonDetail","PersonDetail@odata.associationLinkUrl":"Persons(0)/$links/PersonDetail","ID":0,"Name":"Paula Wilson"},"PersonID":0,"Age@odata.type":"Edm.Byte","Age":21,"Gender":false,"Phone":"(505) 555-5939","Address":{"odata.type":"ODataDemo.Address","Street":"2817 Milton Dr.","City":"Albuquerque","State":"NM","ZipCode":"87110","Country":"USA"},"Photo@odata.mediaEditLink":"PersonDetails(0)/Photo","Photo@odata.mediaETag":"\"nCP1T
 f4Uax96eYIWjvoC/6ZflG8=\""}
+{"odata.metadata":"http://services.odata.org/V3/OData/OData.svc/$metadata#PersonDetails/@Element","odata.type":"ODataDemo.PersonDetail","odata.id":"http://services.odata.org/V3/OData/OData.svc/PersonDetails(0)","odata.editLink":"PersonDetails(0)","Person@odata.navigationLinkUrl":"PersonDetails(0)/Person","Person@odata.associationLinkUrl":"PersonDetails(0)/$links/Person","Person":{"odata.type":"ODataDemo.Person","odata.id":"http://services.odata.org/V3/OData/OData.svc/Persons(0)","odata.editLink":"Persons(0)","PersonDetail@odata.navigationLinkUrl":"Persons(0)/PersonDetail","PersonDetail@odata.associationLinkUrl":"Persons(0)/$links/PersonDetail","ID":0,"Name":"Paula Wilson"},"PersonID":0,"Age@odata.type":"Edm.Byte","Age":21,"Gender":false,"Phone":"(505) 555-5939","Address":{"odata.type":"ODataDemo.Address","Street":"2817 Milton Dr.","City":"Albuquerque","State":"NM","ZipCode":"87110","Country":"USA"},"Photo@odata.mediaEditLink":"PersonDetails(0)/Photo","Photo@odata.mediaEtag":"\"nCP1T
 f4Uax96eYIWjvoC/6ZflG8=\""}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.json
new file mode 100644
index 0000000..a69884b
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.json
@@ -0,0 +1,62 @@
+{
+  "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers/$entity",
+  "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+  "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+  "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+  "@com.contoso.display.highlight": true,
+  "@com.contoso.PersonalInfo.PhoneNumbers": ["(203)555-1718", "(203)555-1719"],
+  "PersonID": 1,
+  "FirstName": "Bob",
+  "LastName@com.contoso.display.style": {
+    "@odata.type": "#com.contoso.display.styleType",
+    "title": true,
+    "order": 1
+  },
+  "LastName": "Cat",
+  "MiddleName": null,
+  "HomeAddress": {
+    "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
+    "Street": "1 Microsoft Way",
+    "City": "London",
+    "PostalCode": "98052",
+    "FamilyName": "Cats"
+  },
+  "Home@odata.type": "#GeographyPoint",
+  "Home": {
+    "type": "Point",
+    "coordinates": [23.1, 32.1],
+    "crs": {
+      "type": "name",
+      "properties": {
+        "name": "EPSG:4326"
+      }
+    }
+  },
+  "Numbers@odata.type": "#Collection(String)",
+  "Numbers": ["111-111-1111", "0-12", "3-10", "bca", "ayz"],
+  "Emails@odata.type": "#Collection(String)",
+  "Emails": ["abc@abc.com"],
+  "City": "London",
+  "Birthday@odata.type": "#DateTimeOffset",
+  "Birthday": "1957-04-03T00:00:00Z",
+  "TimeBetweenLastTwoOrders@odata.type": "#Duration",
+  "TimeBetweenLastTwoOrders": "PT0.0000001S",
+  "Parent@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent/$ref",
+  "Parent@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent",
+  "Orders@com.contoso.display.style": {
+    "@odata.type": "#com.contoso.display.styleType",
+    "order": 2
+  },
+  "Orders@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders/$ref",
+  "Orders@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders",
+  "Company@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company/$ref",
+  "Company@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company",
+  "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+  },
+  "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": {
+    "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+    "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.xml
new file mode 100644
index 0000000..851f960
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/annotated.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    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.
+
+-->
+<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity">
+  <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)</id>
+  <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+  <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent"/>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders">
+    <m:annotation term="com.contoso.display.style" m:type="#com.contoso.display.styleType">
+      <d:order m:type="Int32">2</d:order>
+    </m:annotation>
+  </link>
+  <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company"/>
+  <title/>
+  <updated>2014-03-31T09:35:14Z</updated>
+  <author>
+    <name/>
+  </author>
+  <content type="application/xml">
+    <m:properties>
+      <d:PersonID m:type="Int32">1</d:PersonID>
+      <d:FirstName>Bob</d:FirstName>
+      <d:LastName>Cat</d:LastName>
+      <m:annotation term="com.contoso.display.style" target="LastName" m:type="#com.contoso.display.styleType">
+        <d:title m:type="Boolean">true</d:title>
+        <d:order m:type="Int32">1</d:order>
+      </m:annotation>      
+      <d:MiddleName m:null="true"/>
+      <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
+        <d:Street>1 Microsoft Way</d:Street>
+        <d:City>London</d:City>
+        <d:PostalCode>98052</d:PostalCode>
+        <d:FamilyName>Cats</d:FamilyName>
+      </d:HomeAddress>
+      <d:Home m:type="GeographyPoint">
+        <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+          <gml:pos>32.1 23.1</gml:pos>
+        </gml:Point>
+      </d:Home>
+      <d:Numbers m:type="#Collection(String)">
+        <m:element>111-111-1111</m:element>
+      </d:Numbers>
+      <d:Emails m:type="#Collection(String)">
+        <m:element>abc@abc.com</m:element>
+      </d:Emails>
+      <d:City>London</d:City>
+      <d:Birthday m:type="DateTimeOffset">1957-04-03T00:00:00Z</d:Birthday>
+      <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000001S</d:TimeBetweenLastTwoOrders>
+    </m:properties>
+  </content>
+  <m:annotation term="com.contoso.display.highlight" m:type="Boolean">true</m:annotation>
+  <m:annotation term="com.contoso.PersonalInfo.PhoneNumbers" m:type="#Collection(String)">
+    <m:element>(203)555-1718</m:element>
+    <m:element>(203)555-1719</m:element>
+  </m:annotation>  
+</entry>
+

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 17a65eb..c0612af 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -152,6 +152,8 @@ public interface Constants {
 
   public static final String ATTR_RELATIONSHIP = "relationship";
 
+  public static final String ANNOTATION = "annotation";
+
   // JSON stuff
   public final static String JSON_METADATA = "odata.metadata";
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
index 96db646..33f393f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Annotation.java
@@ -21,17 +21,9 @@ package org.apache.olingo.commons.api.data;
 /**
  * Represents an instance annotation.
  */
-public interface Annotation {
+public interface Annotation extends Valuable {
 
   String getTerm();
 
   void setTerm(String term);
-
-  String getType();
-
-  void setType(String type);
-
-  Value getValue();
-
-  void setValue(Value value);
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
index 3f1ca03..36c6b74 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
@@ -18,17 +18,9 @@
  */
 package org.apache.olingo.commons.api.data;
 
-public interface Property extends Annotatable {
+public interface Property extends Valuable, Annotatable {
 
   String getName();
 
   void setName(String name);
-
-  String getType();
-
-  void setType(String type);
-
-  Value getValue();
-
-  void setValue(Value value);
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java
new file mode 100644
index 0000000..11a4bf0
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Valuable.java
@@ -0,0 +1,30 @@
+/*
+ * 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.commons.api.data;
+
+public interface Valuable {
+
+  String getType();
+
+  void setType(String type);
+
+  Value getValue();
+
+  void setValue(Value value);
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index 2f3ebb3..9c3fec2 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -54,6 +54,8 @@ abstract class AbstractAtomDealer {
 
   protected final QName nextQName;
 
+  protected final QName annotationQName;
+
   protected final QName contextQName;
 
   protected final QName entryRefQName;
@@ -98,6 +100,8 @@ abstract class AbstractAtomDealer {
             new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_URI);
     this.nextQName =
             new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.NEXT_LINK_REL);
+    this.annotationQName =
+            new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ANNOTATION);
     this.contextQName =
             new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.CONTEXT);
     this.entryRefQName =

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 82f8ae0..f94ff68 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -27,14 +27,21 @@ import java.io.IOException;
 import java.util.AbstractMap.SimpleEntry;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.CollectionValue;
 import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Linked;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
 import org.apache.olingo.commons.api.data.Value;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
 import org.apache.olingo.commons.api.domain.ODataPropertyType;
@@ -44,6 +51,8 @@ import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
 abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<ResWrap<T>> {
 
+  protected final Pattern CUSTOM_ANNOTATION = Pattern.compile("(.+)@(.+)\\.(.+)");
+
   private JSONGeoValueDeserializer geoDeserializer;
 
   private JSONGeoValueDeserializer getGeoDeserializer() {
@@ -203,6 +212,48 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<ResW
     return new SimpleEntry<ODataPropertyType, EdmTypeInfo>(type, typeInfo);
   }
 
+  protected void populate(final Annotatable annotatable, final List<Property> properties,
+          final ObjectNode tree, final ObjectCodec codec) throws IOException {
+
+    String type = null;
+    Annotation annotation = null;
+    for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+      final Map.Entry<String, JsonNode> field = itor.next();
+      final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
+
+      if (field.getKey().charAt(0) == '@') {
+        final Annotation entityAnnot = new AnnotationImpl();
+        entityAnnot.setTerm(field.getKey().substring(1));
+
+        value(entityAnnot, field.getValue(), codec);
+        if (annotatable != null) {
+          annotatable.getAnnotations().add(entityAnnot);
+        }
+      } else if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) {
+        type = field.getValue().asText();
+      } else if (annotation == null && customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
+        annotation = new AnnotationImpl();
+        annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
+        value(annotation, field.getValue(), codec);
+      } else {
+        final JSONPropertyImpl property = new JSONPropertyImpl();
+        property.setName(field.getKey());
+        property.setType(type == null
+                ? null
+                : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
+        type = null;
+
+        value(property, field.getValue(), codec);
+        properties.add(property);
+
+        if (annotation != null) {
+          property.getAnnotations().add(annotation);
+          annotation = null;
+        }
+      }
+    }
+  }
+
   private Value fromPrimitive(final JsonNode node, final EdmTypeInfo typeInfo) {
     final Value value;
 
@@ -234,22 +285,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<ResW
       node.remove(toRemove);
     }
 
-    String type = null;
-    for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
-      final Map.Entry<String, JsonNode> field = itor.next();
-
-      if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) {
-        type = field.getValue().asText();
-      } else {
-        final JSONPropertyImpl property = new JSONPropertyImpl();
-        property.setName(field.getKey());
-        property.setType(type);
-        type = null;
-
-        value(property, field.getValue(), codec);
-        value.get().add(property);
-      }
-    }
+    populate(value.asLinkedComplex(), value.get(), node, codec);
 
     return value;
   }
@@ -283,12 +319,12 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<ResW
     return value;
   }
 
-  protected void value(final JSONPropertyImpl property, final JsonNode node, final ObjectCodec codec)
+  protected void value(final Valuable valuable, final JsonNode node, final ObjectCodec codec)
           throws IOException {
 
-    EdmTypeInfo typeInfo = StringUtils.isBlank(property.getType())
+    EdmTypeInfo typeInfo = StringUtils.isBlank(valuable.getType())
             ? null
-            : new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+            : new EdmTypeInfo.Builder().setTypeExpression(valuable.getType()).build();
 
     final Map.Entry<ODataPropertyType, EdmTypeInfo> guessed = guessPropertyType(node);
     if (typeInfo == null) {
@@ -307,31 +343,31 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<ResW
 
     switch (propType) {
       case COLLECTION:
-        property.setValue(fromCollection(node.elements(), typeInfo, codec));
+        valuable.setValue(fromCollection(node.elements(), typeInfo, codec));
         break;
 
       case COMPLEX:
         if (node.has(jsonType)) {
-          property.setType(node.get(jsonType).asText());
+          valuable.setType(node.get(jsonType).asText());
           ((ObjectNode) node).remove(jsonType);
         }
-        property.setValue(fromComplex((ObjectNode) node, codec));
+        valuable.setValue(fromComplex((ObjectNode) node, codec));
         break;
 
       case ENUM:
-        property.setValue(new EnumValueImpl(node.asText()));
+        valuable.setValue(new EnumValueImpl(node.asText()));
         break;
 
       case PRIMITIVE:
-        if (property.getType() == null && typeInfo != null) {
-          property.setType(typeInfo.getFullQualifiedName().toString());
+        if (valuable.getType() == null && typeInfo != null) {
+          valuable.setType(typeInfo.getFullQualifiedName().toString());
         }
-        property.setValue(fromPrimitive(node, typeInfo));
+        valuable.setValue(fromPrimitive(node, typeInfo));
         break;
 
       case EMPTY:
       default:
-        property.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
+        valuable.setValue(new PrimitiveValueImpl(StringUtils.EMPTY));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
index 9efc67c..942516c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
@@ -29,12 +29,15 @@ import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotatable;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.CollectionValue;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.data.Linked;
 import org.apache.olingo.commons.api.data.PrimitiveValue;
 import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Valuable;
 import org.apache.olingo.commons.api.data.Value;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -62,6 +65,10 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
   protected void clientLinks(final Linked linked, final JsonGenerator jgen) throws IOException {
     final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
     for (Link link : linked.getNavigationLinks()) {
+      for (Annotation annotation : link.getAnnotations()) {
+        valuable(jgen, annotation, link.getTitle() + "@" + annotation.getTerm());
+      }
+
       ODataLinkType type = null;
       try {
         type = ODataLinkType.fromString(version, link.getRel(), link.getType());
@@ -185,7 +192,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
     } else if (value.isComplex()) {
       jgen.writeStartObject();
       for (Property property : value.asComplex().get()) {
-        property(jgen, property, property.getName());
+        valuable(jgen, property, property.getName());
       }
       if (value.isLinkedComplex()) {
         links(value.asLinkedComplex(), jgen);
@@ -194,12 +201,10 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
     }
   }
 
-  protected void property(final JsonGenerator jgen, final Property property, final String name) throws IOException {
+  protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
     if (serverMode && !Constants.VALUE.equals(name)) {
-      String type = property.getType();
-      if (StringUtils.isBlank(type)
-              && property.getValue().isPrimitive() || property.getValue().isNull()) {
-
+      String type = valuable.getType();
+      if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
         type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();
       }
       if (StringUtils.isNotBlank(type)) {
@@ -209,7 +214,13 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
       }
     }
 
+    if (valuable instanceof Annotatable) {
+      for (Annotation annotation : ((Annotatable) valuable).getAnnotations()) {
+        valuable(jgen, annotation, name + "@" + annotation.getTerm());
+      }
+    }
+
     jgen.writeFieldName(name);
-    value(jgen, property.getType(), property.getValue());
+    value(jgen, valuable.getType(), valuable.getValue());
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
index 3f8da74..2363c0b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
@@ -23,6 +23,8 @@ import org.apache.olingo.commons.api.data.Value;
 
 public abstract class AbstractProperty extends AbstractAnnotatedObject implements Property {
 
+  private static final long serialVersionUID = -7175704800169997060L;
+
   private String name;
 
   private String type;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AnnotationImpl.java
new file mode 100644
index 0000000..e6a277e
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AnnotationImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.commons.core.data;
+
+import org.apache.olingo.commons.api.data.Annotation;
+import org.apache.olingo.commons.api.data.Value;
+
+public class AnnotationImpl extends AbstractAnnotatedObject implements Annotation {
+
+  private static final long serialVersionUID = -2532246000091187020L;
+
+  private String term;
+
+  private String type;
+
+  private Value value;
+
+  @Override
+  public String getTerm() {
+    return term;
+  }
+
+  @Override
+  public void setTerm(final String term) {
+    this.term = term;
+  }
+
+  @Override
+  public String getType() {
+    return type;
+  }
+
+  @Override
+  public void setType(final String type) {
+    this.type = type;
+  }
+
+  @Override
+  public Value getValue() {
+    return value;
+  }
+
+  @Override
+  public void setValue(final Value value) {
+    this.value = value;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index a5171ba..27379da 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -23,6 +23,10 @@ import org.apache.olingo.commons.core.data.v4.AtomDeltaImpl;
 import java.io.InputStream;
 import java.net.URI;
 import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLInputFactory;
@@ -32,10 +36,13 @@ import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.CollectionValue;
 import org.apache.olingo.commons.api.data.DeletedEntity.Reason;
 import org.apache.olingo.commons.api.data.EntitySet;
+import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.data.ResWrap;
+import org.apache.olingo.commons.api.data.Valuable;
 import org.apache.olingo.commons.api.data.Value;
 import org.apache.olingo.commons.api.domain.ODataOperation;
 import org.apache.olingo.commons.api.domain.ODataPropertyType;
@@ -242,6 +249,14 @@ public class AtomDeserializer extends AbstractAtomDealer {
       property.setName(start.getName().getLocalPart());
     }
 
+    valuable(property, reader, start);
+
+    return property;
+  }
+
+  private void valuable(final Valuable valuable, final XMLEventReader reader, final StartElement start)
+          throws XMLStreamException {
+
     final Attribute nullAttr = start.getAttributeByName(this.nullQName);
 
     Value value;
@@ -254,7 +269,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
               : new EdmTypeInfo.Builder().setTypeExpression(typeAttrValue).build();
 
       if (typeInfo != null) {
-        property.setType(typeInfo.internal());
+        valuable.setType(typeInfo.internal());
       }
 
       final ODataPropertyType propType = typeInfo == null
@@ -277,7 +292,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
         case PRIMITIVE:
           // No type specified? Defaults to Edm.String          
           if (typeInfo == null) {
-            property.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString());
+            valuable.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName().toString());
           }
           value = fromPrimitive(reader, start, typeInfo);
           break;
@@ -290,9 +305,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
       value = new NullValueImpl();
     }
 
-    property.setValue(value);
-
-    return property;
+    valuable.setValue(value);
   }
 
   private ResWrap<AtomPropertyImpl> property(final InputStream input) throws XMLStreamException {
@@ -344,23 +357,27 @@ public class AtomDeserializer extends AbstractAtomDealer {
     while (reader.hasNext() && !foundEndElement) {
       final XMLEvent event = reader.nextEvent();
 
-      if (event.isStartElement() && inlineQName.equals(event.asStartElement().getName())) {
-        StartElement inline = null;
-        while (reader.hasNext() && inline == null) {
-          final XMLEvent innerEvent = reader.peek();
-          if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
-            reader.nextEvent();
-          } else if (innerEvent.isStartElement()) {
-            inline = innerEvent.asStartElement();
-          }
-        }
-        if (inline != null) {
-          if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
-            link.setInlineEntity(entity(reader, inline));
+      if (event.isStartElement()) {
+        if (inlineQName.equals(event.asStartElement().getName())) {
+          StartElement inline = null;
+          while (reader.hasNext() && inline == null) {
+            final XMLEvent innerEvent = reader.peek();
+            if (innerEvent.isCharacters() && innerEvent.asCharacters().isWhiteSpace()) {
+              reader.nextEvent();
+            } else if (innerEvent.isStartElement()) {
+              inline = innerEvent.asStartElement();
+            }
           }
-          if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
-            link.setInlineEntitySet(entitySet(reader, inline));
+          if (inline != null) {
+            if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(inline.getName())) {
+              link.setInlineEntity(entity(reader, inline));
+            }
+            if (Constants.QNAME_ATOM_ELEM_FEED.equals(inline.getName())) {
+              link.setInlineEntitySet(entitySet(reader, inline));
+            }
           }
+        } else if (annotationQName.equals(event.asStartElement().getName())) {
+          link.getAnnotations().add(annotation(reader, event.asStartElement()));
         }
       }
 
@@ -502,18 +519,47 @@ public class AtomDeserializer extends AbstractAtomDealer {
 
   private void properties(final XMLEventReader reader, final StartElement start, final AtomEntityImpl entity)
           throws XMLStreamException {
+
+    final Map<String, List<Annotation>> annotations = new HashMap<String, List<Annotation>>();
+
     boolean foundEndProperties = false;
     while (reader.hasNext() && !foundEndProperties) {
       final XMLEvent event = reader.nextEvent();
 
       if (event.isStartElement()) {
-        entity.getProperties().add(property(reader, event.asStartElement()));
+        if (annotationQName.equals(event.asStartElement().getName())) {
+          final String target = event.asStartElement().
+                  getAttributeByName(QName.valueOf(Constants.ATTR_TARGET)).getValue();
+          if (!annotations.containsKey(target)) {
+            annotations.put(target, new ArrayList<Annotation>());
+          }
+          annotations.get(target).add(annotation(reader, event.asStartElement()));
+        } else {
+          entity.getProperties().add(property(reader, event.asStartElement()));
+        }
       }
 
       if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
         foundEndProperties = true;
       }
     }
+
+    for (Property property : entity.getProperties()) {
+      if (annotations.containsKey(property.getName())) {
+        property.getAnnotations().addAll(annotations.get(property.getName()));
+      }
+    }
+  }
+
+  private Annotation annotation(final XMLEventReader reader, final StartElement start)
+          throws XMLStreamException {
+
+    final Annotation annotation = new AnnotationImpl();
+
+    annotation.setTerm(start.getAttributeByName(QName.valueOf(Constants.ATOM_ATTR_TERM)).getValue());
+    valuable(annotation, reader, start);
+
+    return annotation;
   }
 
   private AtomEntityImpl entityRef(final StartElement start) throws XMLStreamException {
@@ -636,6 +682,8 @@ public class AtomDeserializer extends AbstractAtomDealer {
             }
           } else if (propertiesQName.equals(event.asStartElement().getName())) {
             properties(reader, event.asStartElement(), entity);
+          } else if (annotationQName.equals(event.asStartElement().getName())) {
+            entity.getAnnotations().add(annotation(reader, event.asStartElement()));
           }
         }
 
@@ -643,8 +691,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
           foundEndEntry = true;
         }
       }
-
-      return entity;
     } else {
       entity = null;
     }
@@ -719,6 +765,8 @@ public class AtomDeserializer extends AbstractAtomDealer {
           entitySet.getEntities().add(entity(reader, event.asStartElement()));
         } else if (entryRefQName.equals(event.asStartElement().getName())) {
           entitySet.getEntities().add(entityRef(event.asStartElement()));
+        } else if (annotationQName.equals(event.asStartElement().getName())) {
+          entitySet.getAnnotations().add(annotation(reader, event.asStartElement()));
         }
       }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index 0fdab42..0f9750a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -28,6 +28,7 @@ import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.CollectionValue;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entity;
@@ -124,6 +125,10 @@ public class AtomSerializer extends AbstractAtomDealer {
     }
 
     writer.writeEndElement();
+
+    for (Annotation annotation : property.getAnnotations()) {
+      annotation(writer, annotation, property.getName());
+    }
   }
 
   private void property(final XMLStreamWriter writer, final Property property) throws XMLStreamException {
@@ -185,6 +190,10 @@ public class AtomSerializer extends AbstractAtomDealer {
         writer.writeEndElement();
       }
 
+      for (Annotation annotation : link.getAnnotations()) {
+        annotation(writer, annotation, null);
+      }
+
       writer.writeEndElement();
     }
   }
@@ -211,6 +220,36 @@ public class AtomSerializer extends AbstractAtomDealer {
     }
   }
 
+  private void annotation(final XMLStreamWriter writer, final Annotation annotation, final String target)
+          throws XMLStreamException {
+
+    writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ANNOTATION,
+            version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+
+    writer.writeAttribute(Constants.ATOM_ATTR_TERM, annotation.getTerm());
+
+    if (target != null) {
+      writer.writeAttribute(Constants.ATTR_TARGET, target);
+    }
+
+    if (StringUtils.isNotBlank(annotation.getType())) {
+      final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
+      if (!EdmPrimitiveTypeKind.String.getFullQualifiedName().toString().equals(typeInfo.internal())) {
+        writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
+                Constants.ATTR_TYPE, typeInfo.external(version));
+      }
+    }
+
+    if (annotation.getValue().isNull()) {
+      writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
+              Constants.ATTR_NULL, Boolean.TRUE.toString());
+    } else {
+      value(writer, annotation.getValue());
+    }
+
+    writer.writeEndElement();
+  }
+
   private void entity(final XMLStreamWriter writer, final Entity entity) throws XMLStreamException {
     if (entity.getBaseURI() != null) {
       writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entity.getBaseURI().toASCIIString());
@@ -284,6 +323,10 @@ public class AtomSerializer extends AbstractAtomDealer {
       writer.writeEndElement();
     }
     writer.writeEndElement();
+
+    for (Annotation annotation : entity.getAnnotations()) {
+      annotation(writer, annotation, null);
+    }
   }
 
   private void entityRef(final XMLStreamWriter writer, final Entity entity) throws XMLStreamException {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java
index 4fd7ace..567fadb 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java
@@ -26,12 +26,17 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.io.IOException;
 import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.regex.Matcher;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Link;
 import org.apache.olingo.commons.api.domain.ODataLinkType;
@@ -106,7 +111,6 @@ public class JSONEntityDeserializer extends AbstractJsonDeserializer<JSONEntityI
 
     if (tree.hasNonNull(jsonEditLink)) {
       final LinkImpl link = new LinkImpl();
-      // Server mode
       if (serverMode) {
         link.setRel(Constants.EDIT_LINK_REL);
       }
@@ -134,8 +138,11 @@ public class JSONEntityDeserializer extends AbstractJsonDeserializer<JSONEntityI
     }
 
     final Set<String> toRemove = new HashSet<String>();
+
+    final Map<String, List<Annotation>> annotations = new HashMap<String, List<Annotation>>();
     for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
       final Map.Entry<String, JsonNode> field = itor.next();
+      final Matcher customAnnotation = CUSTOM_ANNOTATION.matcher(field.getKey());
 
       links(field, entity, toRemove, tree, parser.getCodec());
       if (field.getKey().endsWith(getJSONAnnotation(jsonMediaEditLink))) {
@@ -172,29 +179,39 @@ public class JSONEntityDeserializer extends AbstractJsonDeserializer<JSONEntityI
         entity.getOperations().add(operation);
 
         toRemove.add(field.getKey());
+      } else if (customAnnotation.matches() && !"odata".equals(customAnnotation.group(2))) {
+        final Annotation annotation = new AnnotationImpl();
+        annotation.setTerm(customAnnotation.group(2) + "." + customAnnotation.group(3));
+        value(annotation, field.getValue(), parser.getCodec());
+
+        if (!annotations.containsKey(customAnnotation.group(1))) {
+          annotations.put(customAnnotation.group(1), new ArrayList<Annotation>());
+        }
+        annotations.get(customAnnotation.group(1)).add(annotation);
       }
     }
-    tree.remove(toRemove);
 
-    String type = null;
-    for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
-      final Map.Entry<String, JsonNode> field = itor.next();
-
-      if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) {
-        type = field.getValue().asText();
-      } else {
-        final JSONPropertyImpl property = new JSONPropertyImpl();
-        property.setName(field.getKey());
-        property.setType(type == null
-                ? null
-                : new EdmTypeInfo.Builder().setTypeExpression(type).build().internal());
-        type = null;
-
-        value(property, field.getValue(), parser.getCodec());
-        entity.getProperties().add(property);
+    for (Link link : entity.getNavigationLinks()) {
+      if (annotations.containsKey(link.getTitle())) {
+        link.getAnnotations().addAll(annotations.get(link.getTitle()));
+        for (Annotation annotation : annotations.get(link.getTitle())) {
+          toRemove.add(link.getTitle() + "@" + annotation.getTerm());
+        }
       }
     }
-    
+    for (Link link : entity.getMediaEditLinks()) {
+      if (annotations.containsKey(link.getTitle())) {
+        link.getAnnotations().addAll(annotations.get(link.getTitle()));
+        for (Annotation annotation : annotations.get(link.getTitle())) {
+          toRemove.add(link.getTitle() + "@" + annotation.getTerm());
+        }
+      }
+    }
+
+    tree.remove(toRemove);
+
+    populate(entity, entity.getProperties(), tree, parser.getCodec());
+
     return new ResWrap<JSONEntityImpl>(contextURL, metadataETag, entity);
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySerializer.java
index 0439783..cb0280d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySerializer.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.Link;
@@ -78,8 +79,12 @@ public class JSONEntitySerializer extends AbstractJsonSerializer<JSONEntityImpl>
       jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entity.getId());
     }
 
+    for (Annotation annotation : entity.getAnnotations()) {
+      valuable(jgen, annotation, "@" + annotation.getTerm());
+    }
+
     for (Property property : entity.getProperties()) {
-      property(jgen, property, property.getName());
+      valuable(jgen, property, property.getName());
     }
 
     if (serverMode && entity.getEditLink() != null && StringUtils.isNotBlank(entity.getEditLink().getHref())) {

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetDeserializer.java
index df5d40a..241dcbc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetDeserializer.java
@@ -27,8 +27,10 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Iterator;
+import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.ResWrap;
 
 /**
@@ -74,12 +76,15 @@ public class JSONEntitySetDeserializer extends AbstractJsonDeserializer<JSONEnti
 
     if (tree.hasNonNull(jsonCount)) {
       entitySet.setCount(tree.get(jsonCount).asInt());
+      tree.remove(jsonCount);
     }
     if (tree.hasNonNull(jsonNextLink)) {
       entitySet.setNext(URI.create(tree.get(jsonNextLink).textValue()));
+      tree.remove(jsonNextLink);
     }
     if (tree.hasNonNull(jsonDeltaLink)) {
       entitySet.setDeltaLink(URI.create(tree.get(jsonDeltaLink).textValue()));
+      tree.remove(jsonDeltaLink);
     }
 
     if (tree.hasNonNull(Constants.VALUE)) {
@@ -89,6 +94,19 @@ public class JSONEntitySetDeserializer extends AbstractJsonDeserializer<JSONEnti
                         new TypeReference<JSONEntityImpl>() {
                         }).getPayload());
       }
+      tree.remove(Constants.VALUE);
+    }
+
+    // any remaining entry is supposed to be an annotation or is ignored
+    for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+      final Map.Entry<String, JsonNode> field = itor.next();
+      if (field.getKey().charAt(0) == '@') {
+        final Annotation annotation = new AnnotationImpl();
+        annotation.setTerm(field.getKey().substring(1));
+
+        value(annotation, field.getValue(), parser.getCodec());
+        entitySet.getAnnotations().add(annotation);
+      }
     }
 
     return new ResWrap<JSONEntitySetImpl>(contextURL, metadataETag, entitySet);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java
index f3195ab..206e385 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -78,6 +79,10 @@ public class JSONEntitySetSerializer extends AbstractJsonSerializer<JSONEntitySe
       }
     }
 
+    for (Annotation annotation : entitySet.getAnnotations()) {
+      valuable(jgen, annotation, "@" + annotation.getTerm());
+    }
+
     jgen.writeArrayFieldStart(Constants.VALUE);
     for (Entity entity : entitySet.getEntities()) {
       jgen.writeObject(entity);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 74ae1d4..ea2a9df 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -21,11 +21,15 @@ package org.apache.olingo.commons.core.data;
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import java.io.IOException;
 import java.net.URI;
+import java.util.Iterator;
+import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
@@ -68,14 +72,29 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
 
     if (tree.has(jsonType)) {
       property.setType(new EdmTypeInfo.Builder().setTypeExpression(tree.get(jsonType).textValue()).build().internal());
+      tree.remove(jsonType);
     }
 
     if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
       property.setValue(new NullValueImpl());
+      tree.remove(Constants.JSON_NULL);
     }
 
     if (property.getValue() == null) {
       value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree, parser.getCodec());
+      tree.remove(Constants.VALUE);
+    }
+
+    // any remaining entry is supposed to be an annotation or is ignored
+    for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
+      final Map.Entry<String, JsonNode> field = itor.next();
+      if (field.getKey().charAt(0) == '@') {
+        final Annotation annotation = new AnnotationImpl();
+        annotation.setTerm(field.getKey().substring(1));
+
+        value(annotation, field.getValue(), parser.getCodec());
+        property.getAnnotations().add(annotation);
+      }
     }
 
     return new ResWrap<JSONPropertyImpl>(contextURL, metadataETag, property);

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ec9e8cab/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
index 74e8cf0..1a7b908 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.net.URI;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Annotation;
 import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.data.Property;
 import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -40,7 +41,7 @@ public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyI
   @Override
   protected void doSerialize(final JSONPropertyImpl property, final JsonGenerator jgen,
           final SerializerProvider provider) throws IOException, JsonProcessingException {
-    
+
     doContainerSerialize(new ResWrap<JSONPropertyImpl>((URI) null, null, property), jgen, provider);
   }
 
@@ -64,6 +65,10 @@ public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyI
               new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build().external(version));
     }
 
+    for (Annotation annotation : property.getAnnotations()) {
+      valuable(jgen, annotation, "@" + annotation.getTerm());
+    }
+
     if (property.getValue().isNull()) {
       jgen.writeBooleanField(Constants.JSON_NULL, true);
     } else if (property.getValue().isPrimitive()) {
@@ -76,10 +81,10 @@ public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyI
     } else if (property.getValue().isEnum()) {
       jgen.writeStringField(Constants.VALUE, property.getValue().asEnum().get());
     } else if (property.getValue().isGeospatial() || property.getValue().isCollection()) {
-      property(jgen, property, Constants.VALUE);
+      valuable(jgen, property, Constants.VALUE);
     } else if (property.getValue().isComplex()) {
       for (Property cproperty : property.getValue().asComplex().get()) {
-        property(jgen, cproperty, cproperty.getName());
+        valuable(jgen, cproperty, cproperty.getName());
       }
     }