You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/10/19 15:12:34 UTC

[1/4] olingo-odata4 git commit: [OLINGO786] FIx edm annotation classes

Repository: olingo-odata4
Updated Branches:
  refs/heads/olingo786 67ccbf9dd -> 41210245d


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
index 623f324..87cb4b4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -53,8 +53,8 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmConstantExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
 import org.apache.olingo.server.api.ServiceMetadata;
 import org.apache.olingo.server.api.edmx.EdmxReference;
@@ -504,13 +504,13 @@ public class MetadataDocumentXmlSerializer {
       String term = getAliasedFullQualifiedName(annotation.getTerm().getFullQualifiedName(), false);
       writer.writeAttribute(XML_TERM_ATT, term);
       String qualifier = annotation.getQualifier();
-      if(qualifier != null) {
+      if (qualifier != null) {
         writer.writeAttribute(XML_QUALIFIER_ATT, qualifier);
       }
-      EdmAnnotationExpression expression = annotation.getExpression();
-      if(expression != null) {
-        if(expression.isConstant()) {
-          EdmConstantAnnotationExpression constExpression = expression.asConstant();
+      EdmExpression expression = annotation.getExpression();
+      if (expression != null) {
+        if (expression.isConstant()) {
+          EdmConstantExpression constExpression = expression.asConstant();
           Valuable value = constExpression.getValue();
           writer.writeAttribute(value.getType(), constExpression.getValueAsString());
         } else {
@@ -521,7 +521,6 @@ public class MetadataDocumentXmlSerializer {
     }
   }
 
-
   private void appendNavigationProperties(final XMLStreamWriter writer, final EdmStructuredType type)
       throws XMLStreamException {
     List<String> navigationPropertyNames = new ArrayList<String>(type.getNavigationPropertyNames());


[3/4] olingo-odata4 git commit: [OLINGO786] FIx edm annotation classes

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicAnnotationExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicAnnotationExpression.java
deleted file mode 100644
index 3115491..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * 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.edm.annotation;
-
-import org.apache.olingo.commons.api.edm.annotation.EdmAnd;
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationPath;
-import org.apache.olingo.commons.api.edm.annotation.EdmApply;
-import org.apache.olingo.commons.api.edm.annotation.EdmCast;
-import org.apache.olingo.commons.api.edm.annotation.EdmCollection;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmEq;
-import org.apache.olingo.commons.api.edm.annotation.EdmGe;
-import org.apache.olingo.commons.api.edm.annotation.EdmGt;
-import org.apache.olingo.commons.api.edm.annotation.EdmIf;
-import org.apache.olingo.commons.api.edm.annotation.EdmIsOf;
-import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElement;
-import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElementReference;
-import org.apache.olingo.commons.api.edm.annotation.EdmLe;
-import org.apache.olingo.commons.api.edm.annotation.EdmLt;
-import org.apache.olingo.commons.api.edm.annotation.EdmNavigationPropertyPath;
-import org.apache.olingo.commons.api.edm.annotation.EdmNe;
-import org.apache.olingo.commons.api.edm.annotation.EdmNot;
-import org.apache.olingo.commons.api.edm.annotation.EdmNull;
-import org.apache.olingo.commons.api.edm.annotation.EdmOr;
-import org.apache.olingo.commons.api.edm.annotation.EdmPath;
-import org.apache.olingo.commons.api.edm.annotation.EdmPropertyPath;
-import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
-import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
-import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
-
-public abstract class AbstractEdmDynamicAnnotationExpression
-extends AbstractEdmAnnotationExpression implements EdmDynamicAnnotationExpression {
-
-  @Override
-  public boolean isNot() {
-    return this instanceof EdmNot;
-  }
-
-  @Override
-  public EdmNot asNot() {
-    return isNot() ? (EdmNot) this : null;
-
-  }
-
-  @Override
-  public boolean isAnd() {
-    return this instanceof EdmAnd;
-  }
-
-  @Override
-  public EdmAnd asAnd() {
-    return isAnd() ? (EdmAnd) this : null;
-  }
-
-  @Override
-  public boolean isOr() {
-    return this instanceof EdmOr;
-  }
-
-  @Override
-  public EdmOr asOr() {
-    return isOr() ? (EdmOr) this : null;
-  }
-
-  @Override
-  public boolean isEq() {
-    return this instanceof EdmEq;
-  }
-
-  @Override
-  public EdmEq asEq() {
-    return isEq() ? (EdmEq) this : null;
-  }
-
-  @Override
-  public boolean isNe() {
-    return this instanceof EdmNe;
-  }
-
-  @Override
-  public EdmNe asNe() {
-    return isNe() ? (EdmNe) this : null;
-  }
-
-  @Override
-  public boolean isGt() {
-    return this instanceof EdmGt;
-  }
-
-  @Override
-  public EdmGt asGt() {
-    return isGt() ? (EdmGt) this : null;
-  }
-
-  @Override
-  public boolean isGe() {
-    return this instanceof EdmGe;
-  }
-
-  @Override
-  public EdmGe asGe() {
-    return isGe() ? (EdmGe) this : null;
-  }
-
-  @Override
-  public boolean isLt() {
-    return this instanceof EdmLt;
-  }
-
-  @Override
-  public EdmLt asLt() {
-    return isLt() ? (EdmLt) this : null;
-  }
-
-  @Override
-  public boolean isLe() {
-    return this instanceof EdmLe;
-  }
-
-  @Override
-  public EdmLe asLe() {
-    return isLe() ? (EdmLe) this : null;
-  }
-
-  @Override
-  public boolean isAnnotationPath() {
-    return this instanceof EdmAnnotationPath;
-  }
-
-  @Override
-  public EdmAnnotationPath asAnnotationPath() {
-    return isAnnotationPath() ? (EdmAnnotationPath) this : null;
-  }
-
-  @Override
-  public boolean isApply() {
-    return this instanceof EdmApply;
-  }
-
-  @Override
-  public EdmApply asApply() {
-    return isApply() ? (EdmApply) this : null;
-  }
-
-  @Override
-  public boolean isCast() {
-    return this instanceof EdmCast;
-  }
-
-  @Override
-  public EdmCast asCast() {
-    return isCast() ? (EdmCast) this : null;
-  }
-
-  @Override
-  public boolean isCollection() {
-    return this instanceof EdmCollection;
-  }
-
-  @Override
-  public EdmCollection asCollection() {
-    return isCollection() ? (EdmCollection) this : null;
-  }
-
-  @Override
-  public boolean isIf() {
-    return this instanceof EdmIf;
-  }
-
-  @Override
-  public EdmIf asIf() {
-    return isIf() ? (EdmIf) this : null;
-  }
-
-  @Override
-  public boolean isIsOf() {
-    return this instanceof EdmIsOf;
-  }
-
-  @Override
-  public EdmIsOf asIsOf() {
-    return isIsOf() ? (EdmIsOf) this : null;
-  }
-
-  @Override
-  public boolean isLabeledElement() {
-    return this instanceof EdmLabeledElement;
-  }
-
-  @Override
-  public EdmLabeledElement asLabeledElement() {
-    return isLabeledElement() ? (EdmLabeledElement) this : null;
-  }
-
-  @Override
-  public boolean isLabeledElementReference() {
-    return this instanceof EdmLabeledElementReference;
-  }
-
-  @Override
-  public EdmLabeledElementReference asLabeledElementReference() {
-    return isLabeledElementReference() ? (EdmLabeledElementReference) this : null;
-  }
-
-  @Override
-  public boolean isNull() {
-    return this instanceof EdmNull;
-  }
-
-  @Override
-  public EdmNull asNull() {
-    return isNull() ? (EdmNull) this : null;
-  }
-
-  @Override
-  public boolean isNavigationPropertyPath() {
-    return this instanceof EdmNavigationPropertyPath;
-  }
-
-  @Override
-  public EdmNavigationPropertyPath asNavigationPropertyPath() {
-    return isNavigationPropertyPath() ? (EdmNavigationPropertyPath) this : null;
-  }
-
-  @Override
-  public boolean isPath() {
-    return this instanceof EdmPath;
-  }
-
-  @Override
-  public EdmPath asPath() {
-    return isPath() ? (EdmPath) this : null;
-  }
-
-  @Override
-  public boolean isPropertyPath() {
-    return this instanceof EdmPropertyPath;
-  }
-
-  @Override
-  public EdmPropertyPath asPropertyPath() {
-    return isPropertyPath() ? (EdmPropertyPath) this : null;
-  }
-
-  @Override
-  public boolean isPropertyValue() {
-    return this instanceof EdmPropertyValue;
-  }
-
-  @Override
-  public EdmPropertyValue asPropertyValue() {
-    return isPropertyValue() ? (EdmPropertyValue) this : null;
-  }
-
-  @Override
-  public boolean isRecord() {
-    return this instanceof EdmRecord;
-  }
-
-  @Override
-  public EdmRecord asRecord() {
-    return isRecord() ? (EdmRecord) this : null;
-  }
-
-  @Override
-  public boolean isUrlRef() {
-    return this instanceof EdmUrlRef;
-  }
-
-  @Override
-  public EdmUrlRef asUrlRef() {
-    return isUrlRef() ? (EdmUrlRef) this : null;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicExpression.java
new file mode 100644
index 0000000..72f79b5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmDynamicExpression.java
@@ -0,0 +1,295 @@
+/*
+ * 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.edm.annotation;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmAnd;
+import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationPath;
+import org.apache.olingo.commons.api.edm.annotation.EdmApply;
+import org.apache.olingo.commons.api.edm.annotation.EdmCast;
+import org.apache.olingo.commons.api.edm.annotation.EdmCollection;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmEq;
+import org.apache.olingo.commons.api.edm.annotation.EdmGe;
+import org.apache.olingo.commons.api.edm.annotation.EdmGt;
+import org.apache.olingo.commons.api.edm.annotation.EdmIf;
+import org.apache.olingo.commons.api.edm.annotation.EdmIsOf;
+import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElement;
+import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElementReference;
+import org.apache.olingo.commons.api.edm.annotation.EdmLe;
+import org.apache.olingo.commons.api.edm.annotation.EdmLt;
+import org.apache.olingo.commons.api.edm.annotation.EdmNavigationPropertyPath;
+import org.apache.olingo.commons.api.edm.annotation.EdmNe;
+import org.apache.olingo.commons.api.edm.annotation.EdmNot;
+import org.apache.olingo.commons.api.edm.annotation.EdmNull;
+import org.apache.olingo.commons.api.edm.annotation.EdmOr;
+import org.apache.olingo.commons.api.edm.annotation.EdmPath;
+import org.apache.olingo.commons.api.edm.annotation.EdmPropertyPath;
+import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
+import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
+import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
+
+public abstract class AbstractEdmDynamicExpression extends AbstractEdmExpression implements EdmDynamicExpression {
+
+  public AbstractEdmDynamicExpression(Edm edm, String name) {
+    super(edm, name);
+  }
+
+  @Override
+  public boolean isNot() {
+    return this instanceof EdmNot;
+  }
+
+  @Override
+  public EdmNot asNot() {
+    return isNot() ? (EdmNot) this : null;
+
+  }
+
+  @Override
+  public boolean isAnd() {
+    return this instanceof EdmAnd;
+  }
+
+  @Override
+  public EdmAnd asAnd() {
+    return isAnd() ? (EdmAnd) this : null;
+  }
+
+  @Override
+  public boolean isOr() {
+    return this instanceof EdmOr;
+  }
+
+  @Override
+  public EdmOr asOr() {
+    return isOr() ? (EdmOr) this : null;
+  }
+
+  @Override
+  public boolean isEq() {
+    return this instanceof EdmEq;
+  }
+
+  @Override
+  public EdmEq asEq() {
+    return isEq() ? (EdmEq) this : null;
+  }
+
+  @Override
+  public boolean isNe() {
+    return this instanceof EdmNe;
+  }
+
+  @Override
+  public EdmNe asNe() {
+    return isNe() ? (EdmNe) this : null;
+  }
+
+  @Override
+  public boolean isGt() {
+    return this instanceof EdmGt;
+  }
+
+  @Override
+  public EdmGt asGt() {
+    return isGt() ? (EdmGt) this : null;
+  }
+
+  @Override
+  public boolean isGe() {
+    return this instanceof EdmGe;
+  }
+
+  @Override
+  public EdmGe asGe() {
+    return isGe() ? (EdmGe) this : null;
+  }
+
+  @Override
+  public boolean isLt() {
+    return this instanceof EdmLt;
+  }
+
+  @Override
+  public EdmLt asLt() {
+    return isLt() ? (EdmLt) this : null;
+  }
+
+  @Override
+  public boolean isLe() {
+    return this instanceof EdmLe;
+  }
+
+  @Override
+  public EdmLe asLe() {
+    return isLe() ? (EdmLe) this : null;
+  }
+
+  @Override
+  public boolean isAnnotationPath() {
+    return this instanceof EdmAnnotationPath;
+  }
+
+  @Override
+  public EdmAnnotationPath asAnnotationPath() {
+    return isAnnotationPath() ? (EdmAnnotationPath) this : null;
+  }
+
+  @Override
+  public boolean isApply() {
+    return this instanceof EdmApply;
+  }
+
+  @Override
+  public EdmApply asApply() {
+    return isApply() ? (EdmApply) this : null;
+  }
+
+  @Override
+  public boolean isCast() {
+    return this instanceof EdmCast;
+  }
+
+  @Override
+  public EdmCast asCast() {
+    return isCast() ? (EdmCast) this : null;
+  }
+
+  @Override
+  public boolean isCollection() {
+    return this instanceof EdmCollection;
+  }
+
+  @Override
+  public EdmCollection asCollection() {
+    return isCollection() ? (EdmCollection) this : null;
+  }
+
+  @Override
+  public boolean isIf() {
+    return this instanceof EdmIf;
+  }
+
+  @Override
+  public EdmIf asIf() {
+    return isIf() ? (EdmIf) this : null;
+  }
+
+  @Override
+  public boolean isIsOf() {
+    return this instanceof EdmIsOf;
+  }
+
+  @Override
+  public EdmIsOf asIsOf() {
+    return isIsOf() ? (EdmIsOf) this : null;
+  }
+
+  @Override
+  public boolean isLabeledElement() {
+    return this instanceof EdmLabeledElement;
+  }
+
+  @Override
+  public EdmLabeledElement asLabeledElement() {
+    return isLabeledElement() ? (EdmLabeledElement) this : null;
+  }
+
+  @Override
+  public boolean isLabeledElementReference() {
+    return this instanceof EdmLabeledElementReference;
+  }
+
+  @Override
+  public EdmLabeledElementReference asLabeledElementReference() {
+    return isLabeledElementReference() ? (EdmLabeledElementReference) this : null;
+  }
+
+  @Override
+  public boolean isNull() {
+    return this instanceof EdmNull;
+  }
+
+  @Override
+  public EdmNull asNull() {
+    return isNull() ? (EdmNull) this : null;
+  }
+
+  @Override
+  public boolean isNavigationPropertyPath() {
+    return this instanceof EdmNavigationPropertyPath;
+  }
+
+  @Override
+  public EdmNavigationPropertyPath asNavigationPropertyPath() {
+    return isNavigationPropertyPath() ? (EdmNavigationPropertyPath) this : null;
+  }
+
+  @Override
+  public boolean isPath() {
+    return this instanceof EdmPath;
+  }
+
+  @Override
+  public EdmPath asPath() {
+    return isPath() ? (EdmPath) this : null;
+  }
+
+  @Override
+  public boolean isPropertyPath() {
+    return this instanceof EdmPropertyPath;
+  }
+
+  @Override
+  public EdmPropertyPath asPropertyPath() {
+    return isPropertyPath() ? (EdmPropertyPath) this : null;
+  }
+
+  @Override
+  public boolean isPropertyValue() {
+    return this instanceof EdmPropertyValue;
+  }
+
+  @Override
+  public EdmPropertyValue asPropertyValue() {
+    return isPropertyValue() ? (EdmPropertyValue) this : null;
+  }
+
+  @Override
+  public boolean isRecord() {
+    return this instanceof EdmRecord;
+  }
+
+  @Override
+  public EdmRecord asRecord() {
+    return isRecord() ? (EdmRecord) this : null;
+  }
+
+  @Override
+  public boolean isUrlRef() {
+    return this instanceof EdmUrlRef;
+  }
+
+  @Override
+  public EdmUrlRef asUrlRef() {
+    return isUrlRef() ? (EdmUrlRef) this : null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmElementOrAttributeNotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmElementOrAttributeNotation.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmElementOrAttributeNotation.java
deleted file mode 100644
index aafe681..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmElementOrAttributeNotation.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.edm.annotation;
-
-/**
- * Groups dynamic expressions that may be provided using element notation or attribute notation.
- */
-public abstract class AbstractEdmElementOrAttributeNotation extends AbstractEdmDynamicAnnotationExpression {
-
-  private final String value;
-
-  public AbstractEdmElementOrAttributeNotation(final String value) {
-    this.value = value;
-  }
-
-  public String getValue() {
-    return value;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmExpression.java
new file mode 100644
index 0000000..89469df
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmExpression.java
@@ -0,0 +1,154 @@
+/*
+ * 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.edm.annotation;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmConstantExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlDynamicExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
+
+public abstract class AbstractEdmExpression implements EdmExpression {
+
+  private final String name;
+  protected final Edm edm;
+
+  public AbstractEdmExpression(Edm edm, String name) {
+    this.edm = edm;
+    this.name = name;
+  }
+
+  @Override
+  public String getExpressionName() {
+    return name;
+  };
+
+  @Override
+  public boolean isConstant() {
+    return this instanceof EdmConstantExpression;
+  }
+
+  @Override
+  public EdmConstantExpression asConstant() {
+    return isConstant() ? (EdmConstantExpression) this : null;
+  }
+
+  @Override
+  public boolean isDynamic() {
+    return this instanceof EdmDynamicExpression;
+  }
+
+  @Override
+  public EdmDynamicExpression asDynamic() {
+    return isDynamic() ? (EdmDynamicExpression) this : null;
+  }
+  
+  public static EdmExpression getExpression(Edm edm, final CsdlExpression exp) {
+    EdmExpression _expression = null;
+
+    if (exp.isConstant()) {
+      _expression = new EdmConstantExpressionImpl(edm, exp.asConstant());
+    } else if (exp.isDynamic()) {
+      _expression = getDynamicExpression(edm, exp.asDynamic());
+    }
+
+    return _expression;
+  }
+
+  private static EdmDynamicExpression getDynamicExpression(Edm edm, final CsdlDynamicExpression exp) {
+
+    EdmDynamicExpression _expression = null;
+
+    if (exp.isLogicalOrComparison()) {
+      CsdlLogicalOrComparisonExpression expLocal = exp.asLogicalOrComparison();
+      switch (exp.asLogicalOrComparison().getType()) {
+      case Not:
+        _expression = new EdmNotImpl(edm, expLocal);
+        break;
+      case And:
+        _expression = new EdmAndImpl(edm, expLocal);
+        break;
+
+      case Or:
+        _expression = new EdmOrImpl(edm, expLocal);
+        break;
+
+      case Eq:
+        _expression = new EdmEqImpl(edm, expLocal);
+        break;
+
+      case Ne:
+        _expression = new EdmNeImpl(edm, expLocal);
+        break;
+
+      case Ge:
+        _expression = new EdmGeImpl(edm, expLocal);
+        break;
+
+      case Gt:
+        _expression = new EdmGtImpl(edm, expLocal);
+        break;
+
+      case Le:
+        _expression = new EdmLeImpl(edm, expLocal);
+        break;
+
+      case Lt:
+        _expression = new EdmLtImpl(edm, expLocal);
+        break;
+
+      default:
+      }
+    } else if (exp.isAnnotationPath()) {
+      _expression = new EdmAnnotationPathImpl(edm, exp.asAnnotationPath());
+    } else if (exp.isApply()) {
+      _expression = new EdmApplyImpl(edm, exp.asApply());
+    } else if (exp.isCast()) {
+      _expression = new EdmCastImpl(edm, exp.asCast());
+    } else if (exp.isCollection()) {
+      _expression = new EdmCollectionImpl(edm, exp.asCollection());
+    } else if (exp.isIf()) {
+      _expression = new EdmIfImpl(edm, exp.asIf());
+    } else if (exp.isIsOf()) {
+      _expression = new EdmIsOfImpl(edm, exp.asIsOf());
+    } else if (exp.isLabeledElement()) {
+      _expression = new EdmLabeledElementImpl(edm, exp.asLabeledElement());
+    } else if (exp.isLabeledElementReference()) {
+      _expression = new EdmLabeledElementReferenceImpl(edm, exp.asLabeledElementReference());
+    } else if (exp.isNull()) {
+      _expression = new EdmNullImpl(edm, exp.asNull());
+    } else if (exp.isNavigationPropertyPath()) {
+      _expression = new EdmNavigationPropertyPathImpl(edm, exp.asNavigationPropertyPath());
+    } else if (exp.isPath()) {
+      _expression = new EdmPathImpl(edm, exp.asPath());
+    } else if (exp.isPropertyPath()) {
+      _expression = new EdmPropertyPathImpl(edm, exp.asPropertyPath());
+    } else if (exp.isPropertyValue()) {
+      _expression = new EdmPropertyValueImpl(edm, exp.asPropertyValue());
+    } else if (exp.isRecord()) {
+      _expression = new EdmRecordImpl(edm, exp.asRecord());
+    } else if (exp.isUrlRef()) {
+      _expression = new EdmUrlRefImpl(edm, exp.asUrlRef());
+    }
+
+    return _expression;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmLogicalOrComparisonExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmLogicalOrComparisonExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmLogicalOrComparisonExpression.java
new file mode 100644
index 0000000..9aa8b00
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmLogicalOrComparisonExpression.java
@@ -0,0 +1,70 @@
+/*
+ * 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.edm.annotation;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmLogicalOrComparisonExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
+//CHECKSTYLE:OFF
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression.LogicalOrComparisonExpressionType;
+
+//CHECKSTYLE:ON
+
+public abstract class AbstractEdmLogicalOrComparisonExpression
+    extends AbstractEdmAnnotatableDynamicExpression implements EdmLogicalOrComparisonExpression {
+
+  private EdmExpression left;
+  private EdmExpression right;
+  private CsdlLogicalOrComparisonExpression csdlExp;
+
+  public AbstractEdmLogicalOrComparisonExpression(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp.getType().toString(), csdlExp);
+    this.csdlExp = csdlExp;
+  }
+
+  @Override
+  public EdmExpression getLeftExpression() {
+    if (left == null) {
+      if (csdlExp.getLeft() == null) {
+        throw new EdmException("Comparison Or Logical expression MUST have a left and right expression.");
+      }
+      left = AbstractEdmExpression.getExpression(edm, csdlExp.getLeft());
+      if (csdlExp.getType() == LogicalOrComparisonExpressionType.Not) {
+        right = left;
+      }
+    }
+    return left;
+  }
+
+  @Override
+  public EdmExpression getRightExpression() {
+    if (right == null) {
+      if (csdlExp.getRight() == null) {
+        throw new EdmException("Comparison Or Logical expression MUST have a left and right expression.");
+      }
+      right = AbstractEdmExpression.getExpression(edm, csdlExp.getRight());
+      if (csdlExp.getType() == LogicalOrComparisonExpressionType.Not) {
+        left = right;
+      }
+    }
+    return right;
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmTwoParamsOpDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmTwoParamsOpDynamicAnnotationExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmTwoParamsOpDynamicAnnotationExpression.java
deleted file mode 100644
index 2c5a289..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmTwoParamsOpDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.edm.annotation;
-
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmTwoParamsOpDynamicAnnotationExpression;
-
-public abstract class AbstractEdmTwoParamsOpDynamicAnnotationExpression
-extends AbstractEdmDynamicAnnotationExpression implements EdmTwoParamsOpDynamicAnnotationExpression {
-
-  private final EdmAnnotationExpression left;
-
-  private final EdmAnnotationExpression right;
-
-  public AbstractEdmTwoParamsOpDynamicAnnotationExpression(
-      final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-
-    this.left = left;
-    this.right = right;
-  }
-
-  @Override
-  public EdmAnnotationExpression getLeftExpression() {
-    return left;
-  }
-
-  @Override
-  public EdmAnnotationExpression getRightExpression() {
-    return right;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAndImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAndImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAndImpl.java
index 0b75297..181172b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAndImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAndImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,14 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmAnd;
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmAndImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmAnd {
+public class EdmAndImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmAnd {
 
-  public EdmAndImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmAndImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAnnotationPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAnnotationPathImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAnnotationPathImpl.java
index 38d70fa..2c6cf50 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAnnotationPathImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmAnnotationPathImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,12 +18,21 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlAnnotationPath;
 
-public class EdmAnnotationPathImpl extends AbstractEdmElementOrAttributeNotation implements EdmAnnotationPath {
+public class EdmAnnotationPathImpl extends AbstractEdmDynamicExpression implements EdmAnnotationPath {
 
-  public EdmAnnotationPathImpl(final String value) {
-    super(value);
+  private final CsdlAnnotationPath csdlExp;
+
+  public EdmAnnotationPathImpl(Edm edm, CsdlAnnotationPath csdlExp) {
+    super(edm, "AnnotationPath");
+    this.csdlExp = csdlExp;
   }
 
+  @Override
+  public String getValue() {
+    return csdlExp.getValue();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmApplyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmApplyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmApplyImpl.java
index bc0a7af..a185a55 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmApplyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmApplyImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,30 +18,51 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.annotation.EdmApply;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlApply;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
 
-public class EdmApplyImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmApply {
+public class EdmApplyImpl extends AbstractEdmAnnotatableDynamicExpression implements EdmApply {
 
-  private final String function;
+  private CsdlApply csdlExp;
 
-  private final List<EdmAnnotationExpression> parameters;
+  private String function;
+  private List<EdmExpression> parameters;
 
-  public EdmApplyImpl(final String function, final List<EdmAnnotationExpression> parameters) {
-    this.function = function;
-    this.parameters = parameters;
+  public EdmApplyImpl(Edm edm, CsdlApply csdlExp) {
+    super(edm, "Apply", csdlExp);
+    this.csdlExp = csdlExp;
   }
 
   @Override
   public String getFunction() {
+    if (function == null) {
+      if (csdlExp.getFunction() == null) {
+        throw new EdmException("An Apply expression must specify a function.");
+      }
+      function = csdlExp.getFunction();
+    }
     return function;
   }
 
   @Override
-  public List<EdmAnnotationExpression> getParameters() {
+  public List<EdmExpression> getParameters() {
+    if (parameters == null) {
+      List<EdmExpression> localParameters = new ArrayList<EdmExpression>();
+      if (csdlExp.getParameters() != null) {
+        for (CsdlExpression param : csdlExp.getParameters()) {
+          localParameters.add(getExpression(edm, param));
+        }
+      }
+      parameters = Collections.unmodifiableList(localParameters);
+    }
     return parameters;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCastImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCastImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCastImpl.java
index 8989200..ce793cf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCastImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCastImpl.java
@@ -19,27 +19,23 @@
 package org.apache.olingo.commons.core.edm.annotation;
 
 import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmType;
 import org.apache.olingo.commons.api.edm.annotation.EdmCast;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.geo.SRID;
 import org.apache.olingo.commons.api.edm.provider.annotation.CsdlCast;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
-public class EdmCastImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmCast {
-
-  private final Edm edm;
+public class EdmCastImpl extends AbstractEdmAnnotatableDynamicExpression implements EdmCast {
 
   private final CsdlCast cast;
-
-  private final EdmDynamicAnnotationExpression value;
-
+  private EdmExpression value;
   private EdmType type;
 
-  public EdmCastImpl(final Edm edm, final CsdlCast cast, final EdmDynamicAnnotationExpression value) {
-    this.edm = edm;
-    this.cast = cast;
-    this.value = value;
+  public EdmCastImpl(final Edm edm, final CsdlCast csdlExp) {
+    super(edm, "Cast", csdlExp);
+    this.cast = csdlExp;
   }
 
   @Override
@@ -65,6 +61,9 @@ public class EdmCastImpl extends AbstractEdmAnnotatableDynamicAnnotationExpressi
   @Override
   public EdmType getType() {
     if (type == null) {
+      if (cast.getType() == null) {
+        throw new EdmException("Must specify a type for a Cast expression.");
+      }
       final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(cast.getType()).build();
       type = typeInfo.getType();
     }
@@ -72,7 +71,13 @@ public class EdmCastImpl extends AbstractEdmAnnotatableDynamicAnnotationExpressi
   }
 
   @Override
-  public EdmDynamicAnnotationExpression getValue() {
+  public EdmExpression getValue() {
+    if (value == null) {
+      if (cast.getValue() == null) {
+        throw new EdmException("Cast expressions require an expression value.");
+      }
+      value = getExpression(edm, cast.getValue());
+    }
     return value;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCollectionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCollectionImpl.java
index 41472d0..e8d5fca 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCollectionImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmCollectionImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,22 +18,37 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmCollection;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlCollection;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
 
-public class EdmCollectionImpl extends AbstractEdmDynamicAnnotationExpression implements EdmCollection {
+public class EdmCollectionImpl extends AbstractEdmDynamicExpression implements EdmCollection {
 
-  private final List<EdmAnnotationExpression> items;
+  private List<EdmExpression> items;
+  private CsdlCollection csdlCollection;
 
-  public EdmCollectionImpl(final List<EdmAnnotationExpression> items) {
-    this.items = items;
+  public EdmCollectionImpl(Edm edm, CsdlCollection csdlExp) {
+    super(edm, "Collection");
+    this.csdlCollection = csdlExp;
   }
 
   @Override
-  public List<EdmAnnotationExpression> getItems() {
+  public List<EdmExpression> getItems() {
+    if (items == null) {
+      List<EdmExpression> localItems = new ArrayList<EdmExpression>();
+      if (csdlCollection.getItems() != null) {
+        for (CsdlExpression item : csdlCollection.getItems()) {
+          localItems.add(getExpression(edm, item));
+        }
+      }
+      items = Collections.unmodifiableList(localItems);
+    }
     return items;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java
deleted file mode 100644
index bbe0dbc..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantAnnotationExpressionImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.edm.annotation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.Valuable;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class EdmConstantAnnotationExpressionImpl implements EdmConstantAnnotationExpression {
-
-  private final Valuable value;
-  private final EdmPrimitiveType type;
-
-  public EdmConstantAnnotationExpressionImpl(final CsdlConstantExpression constExprConstruct) {
-    if (constExprConstruct.getType() == CsdlConstantExpression.ConstantExpressionType.EnumMember) {
-      final List<Property> enumValues = new ArrayList<Property>();
-      String enumTypeName = null;
-      for (String split : StringUtils.split(constExprConstruct.getValue(), ' ')) {
-        final String[] enumSplit = StringUtils.split(split, '/');
-        enumTypeName = enumSplit[0];
-        enumValues.add(new Property(enumSplit[0], enumSplit[1]));
-      }
-      if (enumValues.size() == 1) {
-        value = enumValues.get(0);
-      } else {
-        final List<Property> collValue = new ArrayList<Property>();
-        for (Property enumValue : enumValues) {
-          collValue.add(enumValue);
-        }
-        value = new Property(enumTypeName, null, ValueType.COLLECTION_ENUM, collValue);
-      }
-      type = null;
-    } else {
-      EdmPrimitiveTypeKind kind;
-      switch (constExprConstruct.getType()) {
-      case Binary:
-        kind = EdmPrimitiveTypeKind.Binary;
-        break;
-      case Bool:
-        kind = EdmPrimitiveTypeKind.Boolean;
-        break;
-      case Date:
-        kind = EdmPrimitiveTypeKind.Date;
-        break;
-      case DateTimeOffset:
-        kind = EdmPrimitiveTypeKind.DateTimeOffset;
-        break;
-      case Decimal:
-        kind = EdmPrimitiveTypeKind.Decimal;
-        break;
-      case Duration:
-        kind = EdmPrimitiveTypeKind.Duration;
-        break;
-      case Float:
-        kind = EdmPrimitiveTypeKind.Single;
-        break;
-      case Guid:
-        kind = EdmPrimitiveTypeKind.Guid;
-        break;
-      case Int:
-        kind = EdmPrimitiveTypeKind.Int32;
-        break;
-      case TimeOfDay:
-        kind = EdmPrimitiveTypeKind.TimeOfDay;
-        break;
-      case String:
-      default:
-        kind = EdmPrimitiveTypeKind.String;
-      }
-      type = EdmPrimitiveTypeFactory.getInstance(kind);
-      try {
-        final Object valueOfString = type.valueOfString(constExprConstruct.getValue(),
-            null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
-            type.getDefaultType());
-        value = new Property(kind.getFullQualifiedName().getName(), null, ValueType.PRIMITIVE, valueOfString);
-      } catch (EdmPrimitiveTypeException e) {
-        throw new IllegalArgumentException(e);
-      }
-    }
-  }
-
-  @Override
-  public boolean isConstant() {
-    return true;
-  }
-
-  @Override
-  public EdmConstantAnnotationExpression asConstant() {
-    return this;
-  }
-
-  @Override
-  public boolean isDynamic() {
-    return false;
-  }
-
-  @Override
-  public EdmDynamicAnnotationExpression asDynamic() {
-    return null;
-  }
-
-  @Override
-  public Valuable getValue() {
-    return value;
-  }
-
-  @Override
-  public String getValueAsString() {
-    if (value == null) {
-      return "";
-    } else if (value.isEnum()) {
-      return value.toString();
-    } else if (value.isGeospatial()) {
-      return value.toString();
-    } else {
-      // TODO: check after copied from ClientPrimitiveValueImpl
-      try {
-        return type.valueToString(value.getValue(), null, null,
-            Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
-      } catch (EdmPrimitiveTypeException e) {
-        throw new IllegalArgumentException(e);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantExpressionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantExpressionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantExpressionImpl.java
new file mode 100644
index 0000000..8e199ec
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmConstantExpressionImpl.java
@@ -0,0 +1,148 @@
+/*
+ * 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.edm.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Valuable;
+import org.apache.olingo.commons.api.data.ValueType;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.annotation.EdmConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class EdmConstantExpressionImpl extends AbstractEdmExpression implements EdmConstantExpression {
+
+  private Valuable value;
+  private EdmPrimitiveType type;
+  private final CsdlConstantExpression constExprConstruct;
+
+  public EdmConstantExpressionImpl(Edm edm, final CsdlConstantExpression constExprConstruct) {
+    super(edm, constExprConstruct.getType().toString());
+    this.constExprConstruct = constExprConstruct;
+  }
+
+  @Override
+  public Valuable getValue() {
+    if(value == null){
+      build();
+    }
+    return value;
+  }
+
+  @Override
+  public String getValueAsString() {
+    return constExprConstruct.getValue();
+    
+//    if (value == null) {
+//      build();
+//    }
+//    if (value == null) {
+//      return "";
+//    } else if (value.isEnum()) {
+//      return value.getValue().toString();
+//    } else if (value.isGeospatial()) {
+//      return value.toString();
+//    } else {
+//      // TODO: check after copied from ClientPrimitiveValueImpl
+//      try {
+//        return type.valueToString(value.getValue(), null, null,
+//            Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
+//      } catch (EdmPrimitiveTypeException e) {
+//        throw new IllegalArgumentException(e);
+//      }
+//    }
+  }
+
+  private void build() {
+    if (constExprConstruct.getType() == CsdlConstantExpression.ConstantExpressionType.EnumMember) {
+      // TODO: Delete ProeprtyValue here
+      final List<Property> enumValues = new ArrayList<Property>();
+      String enumTypeName = null;
+      for (String split : StringUtils.split(constExprConstruct.getValue(), ' ')) {
+        final String[] enumSplit = StringUtils.split(split, '/');
+        enumTypeName = enumSplit[0];
+        enumValues.add(new Property(enumSplit[0], null, ValueType.ENUM, enumSplit[1]));
+      }
+      if (enumValues.size() == 1) {
+        value = enumValues.get(0);
+      } else {
+        final List<Property> collValue = new ArrayList<Property>();
+        for (Property enumValue : enumValues) {
+          collValue.add(enumValue);
+        }
+        value = new Property(enumTypeName, null, ValueType.COLLECTION_ENUM, collValue);
+      }
+      type = null;
+    } else {
+      EdmPrimitiveTypeKind kind;
+      switch (constExprConstruct.getType()) {
+      case Binary:
+        kind = EdmPrimitiveTypeKind.Binary;
+        break;
+      case Bool:
+        kind = EdmPrimitiveTypeKind.Boolean;
+        break;
+      case Date:
+        kind = EdmPrimitiveTypeKind.Date;
+        break;
+      case DateTimeOffset:
+        kind = EdmPrimitiveTypeKind.DateTimeOffset;
+        break;
+      case Decimal:
+        kind = EdmPrimitiveTypeKind.Decimal;
+        break;
+      case Duration:
+        kind = EdmPrimitiveTypeKind.Duration;
+        break;
+      case Float:
+        kind = EdmPrimitiveTypeKind.Single;
+        break;
+      case Guid:
+        kind = EdmPrimitiveTypeKind.Guid;
+        break;
+      case Int:
+        kind = EdmPrimitiveTypeKind.Int32;
+        break;
+      case TimeOfDay:
+        kind = EdmPrimitiveTypeKind.TimeOfDay;
+        break;
+      case String:
+      default:
+        kind = EdmPrimitiveTypeKind.String;
+      }
+      type = EdmPrimitiveTypeFactory.getInstance(kind);
+      try {
+        final Object valueOfString = type.valueOfString(constExprConstruct.getValue(),
+            null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
+            type.getDefaultType());
+        value = new Property(kind.getFullQualifiedName().getName(), null, ValueType.PRIMITIVE, valueOfString);
+      } catch (EdmPrimitiveTypeException e) {
+        throw new IllegalArgumentException(e);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmEqImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmEqImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmEqImpl.java
index bd88887..bf530c1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmEqImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmEqImpl.java
@@ -18,13 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmEq;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmEqImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmEq {
+public class EdmEqImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmEq {
 
-  public EdmEqImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmEqImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGeImpl.java
index ace7a33..3119631 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGeImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,13 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmGe;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmGeImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmGe {
+public class EdmGeImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmGe {
 
-  public EdmGeImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmGeImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGtImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGtImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGtImpl.java
index feed77c..08434e6 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGtImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmGtImpl.java
@@ -18,13 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmGt;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmGtImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmGt {
+public class EdmGtImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmGt {
 
-  public EdmGtImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmGtImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIfImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIfImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIfImpl.java
index e868e34..e33bd11 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIfImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIfImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,37 +18,52 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmIf;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlIf;
 
-public class EdmIfImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmIf {
+public class EdmIfImpl extends AbstractEdmAnnotatableDynamicExpression implements EdmIf {
 
-  private final EdmAnnotationExpression guard;
+  private EdmExpression guard;
+  private EdmExpression _then;
+  private EdmExpression _else;
+  private CsdlIf csdlExp;
 
-  private final EdmAnnotationExpression _then;
-
-  private final EdmAnnotationExpression _else;
-
-  public EdmIfImpl(final EdmAnnotationExpression guard,
-      final EdmAnnotationExpression _then, final EdmAnnotationExpression _else) {
-
-    this.guard = guard;
-    this._then = _then;
-    this._else = _else;
+  public EdmIfImpl(Edm edm, CsdlIf csdlExp) {
+    super(edm, "If", csdlExp);
+    this.csdlExp = csdlExp;
   }
 
   @Override
-  public EdmAnnotationExpression getGuard() {
+  public EdmExpression getGuard() {
+    if (guard == null) {
+      if (csdlExp.getGuard() == null) {
+        throw new EdmException("Guard clause of an if expression must not be null");
+      }
+      guard = getExpression(edm, csdlExp.getGuard());
+    }
     return guard;
   }
 
   @Override
-  public EdmAnnotationExpression getThen() {
+  public EdmExpression getThen() {
+    if (_then == null) {
+      if (csdlExp.getThen() == null) {
+        throw new EdmException("Then clause of an if expression must not be null");
+      }
+      _then = getExpression(edm, csdlExp.getThen());
+    }
     return _then;
   }
 
   @Override
-  public EdmAnnotationExpression getElse() {
+  public EdmExpression getElse() {
+    // The else clause might be null in certain conditions so we can`t evaluate this here.
+    if (_else == null && csdlExp.getElse() != null) {
+      _else = getExpression(edm, csdlExp.getElse());
+    }
     return _else;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIsOfImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIsOfImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIsOfImpl.java
index 9732a0a..aa4ed16 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIsOfImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmIsOfImpl.java
@@ -19,27 +19,25 @@
 package org.apache.olingo.commons.core.edm.annotation;
 
 import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmIsOf;
 import org.apache.olingo.commons.api.edm.geo.SRID;
 import org.apache.olingo.commons.api.edm.provider.annotation.CsdlIsOf;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
-public class EdmIsOfImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmIsOf {
+public class EdmIsOfImpl extends AbstractEdmAnnotatableDynamicExpression implements EdmIsOf {
 
   private final Edm edm;
-
   private final CsdlIsOf isOf;
-
-  private final EdmDynamicAnnotationExpression value;
-
+  private EdmExpression value;
   private EdmType type;
 
-  public EdmIsOfImpl(final Edm edm, final CsdlIsOf isOf, final EdmDynamicAnnotationExpression value) {
+  public EdmIsOfImpl(final Edm edm, final CsdlIsOf isOf) {
+    super(edm, "IsOf", isOf);
     this.edm = edm;
     this.isOf = isOf;
-    this.value = value;
   }
 
   @Override
@@ -65,6 +63,9 @@ public class EdmIsOfImpl extends AbstractEdmAnnotatableDynamicAnnotationExpressi
   @Override
   public EdmType getType() {
     if (type == null) {
+      if(isOf.getType() == null){
+        throw new EdmException("Must specify a type for an IsOf expression.");
+      }
       final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(isOf.getType()).build();
       type = typeInfo.getType();
     }
@@ -72,7 +73,13 @@ public class EdmIsOfImpl extends AbstractEdmAnnotatableDynamicAnnotationExpressi
   }
 
   @Override
-  public EdmDynamicAnnotationExpression getValue() {
+  public EdmExpression getValue() {
+    if(value == null){
+      if(isOf.getValue() == null){
+        throw new EdmException("IsOf expressions require an expression value.");
+      }
+      value = getExpression(edm, isOf.getValue());
+    }
     return value;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementImpl.java
index d921017..babe388 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,28 +18,39 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElement;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLabeledElement;
 
 public class EdmLabeledElementImpl
-extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmLabeledElement {
+    extends AbstractEdmAnnotatableDynamicExpression implements EdmLabeledElement {
 
-  private final String name;
+  private EdmExpression value;
+  private CsdlLabeledElement csdlLableledElement;
 
-  private final EdmDynamicAnnotationExpression value;
-
-  public EdmLabeledElementImpl(final String name, final EdmDynamicAnnotationExpression value) {
-    this.name = name;
-    this.value = value;
+  public EdmLabeledElementImpl(Edm edm, CsdlLabeledElement csdlExp) {
+    super(edm, "LabeledElement", csdlExp);
+    this.csdlLableledElement = csdlExp;
   }
 
   @Override
   public String getName() {
-    return name;
+    if (csdlLableledElement.getName() == null) {
+      throw new EdmException("The LabeledElement expression must have a name attribute.");
+    }
+    return csdlLableledElement.getName();
   }
 
   @Override
-  public EdmDynamicAnnotationExpression getValue() {
+  public EdmExpression getValue() {
+    if (value == null) {
+      if (csdlLableledElement.getValue() == null) {
+        throw new EdmException("The LabeledElement expression must have a child expression");
+      }
+      value = getExpression(edm, csdlLableledElement.getValue());
+    }
     return value;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementReferenceImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementReferenceImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementReferenceImpl.java
index 4eab4cb..5c1887c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementReferenceImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLabeledElementReferenceImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,13 +18,21 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElementReference;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLabeledElementReference;
 
-public class EdmLabeledElementReferenceImpl
-extends AbstractEdmElementOrAttributeNotation implements EdmLabeledElementReference {
+public class EdmLabeledElementReferenceImpl extends AbstractEdmDynamicExpression implements EdmLabeledElementReference {
 
-  public EdmLabeledElementReferenceImpl(final String value) {
-    super(value);
+  private final CsdlLabeledElementReference csdlExp;
+
+  public EdmLabeledElementReferenceImpl(Edm edm, CsdlLabeledElementReference csdlExp) {
+    super(edm, "LabeledElementReference");
+    this.csdlExp = csdlExp;
   }
 
+  @Override
+  public String getValue() {
+    return csdlExp.getValue();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLeImpl.java
index 9a1f51d..84be8f3 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLeImpl.java
@@ -18,14 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmLe;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmLeImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmLe {
+public class EdmLeImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmLe {
 
-  public EdmLeImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmLeImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLtImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLtImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLtImpl.java
index c59b877..0adea0a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLtImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmLtImpl.java
@@ -18,13 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmLt;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmLtImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmLt {
+public class EdmLtImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmLt {
 
-  public EdmLtImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmLtImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNavigationPropertyPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNavigationPropertyPathImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNavigationPropertyPathImpl.java
index a1a7785..7d09276 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNavigationPropertyPathImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNavigationPropertyPathImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,13 +18,21 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmNavigationPropertyPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlNavigationPropertyPath;
 
-public class EdmNavigationPropertyPathImpl
-extends AbstractEdmElementOrAttributeNotation implements EdmNavigationPropertyPath {
+public class EdmNavigationPropertyPathImpl extends AbstractEdmDynamicExpression implements EdmNavigationPropertyPath {
 
-  public EdmNavigationPropertyPathImpl(final String value) {
-    super(value);
+  private final CsdlNavigationPropertyPath csdlExp;
+
+  public EdmNavigationPropertyPathImpl(Edm edm, CsdlNavigationPropertyPath csdlExp) {
+    super(edm, "NavigationPropertyPath");
+    this.csdlExp = csdlExp;
   }
 
+  @Override
+  public String getValue() {
+    return csdlExp.getValue();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNeImpl.java
index aebadf2..c55e01a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNeImpl.java
@@ -18,13 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmNe;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmNeImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmNe {
+public class EdmNeImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmNe {
 
-  public EdmNeImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmNeImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNotImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNotImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNotImpl.java
index b34c255..ca1235d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNotImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNotImpl.java
@@ -18,21 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmNot;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmNotImpl extends AbstractEdmDynamicAnnotationExpression implements EdmNot {
+public class EdmNotImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmNot {
 
-  private final EdmAnnotationExpression expression;
-
-  public EdmNotImpl(final EdmAnnotationExpression expression) {
-    this.expression = expression;
-  }
-
-  @Override
-  public EdmAnnotationExpression getExpression() {
-    return expression;
+    public EdmNotImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNullImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNullImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNullImpl.java
index f8b127e..b1151fc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNullImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmNullImpl.java
@@ -18,8 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmNull;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlNull;
 
-public class EdmNullImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmNull {
-  // No additional methods needed for now.
+public class EdmNullImpl extends AbstractEdmAnnotatableDynamicExpression implements EdmNull {
+
+  public EdmNullImpl(Edm edm, CsdlNull csdlExp) {
+    super(edm, "Null", csdlExp);
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmOrImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmOrImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmOrImpl.java
index 30cc51d..a06da92 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmOrImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmOrImpl.java
@@ -18,13 +18,13 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmOr;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
 
-public class EdmOrImpl extends AbstractEdmTwoParamsOpDynamicAnnotationExpression implements EdmOr {
+public class EdmOrImpl extends AbstractEdmLogicalOrComparisonExpression implements EdmOr {
 
-  public EdmOrImpl(final EdmAnnotationExpression left, final EdmAnnotationExpression right) {
-    super(left, right);
+  public EdmOrImpl(Edm edm, CsdlLogicalOrComparisonExpression csdlExp) {
+    super(edm, csdlExp);
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPathImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPathImpl.java
index 669609c..35c7d30 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPathImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPathImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,12 +18,21 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPath;
 
-public class EdmPathImpl extends AbstractEdmElementOrAttributeNotation implements EdmPath {
+public class EdmPathImpl extends AbstractEdmDynamicExpression implements EdmPath {
 
-  public EdmPathImpl(final String value) {
-    super(value);
+  private final CsdlPath csdlExp;
+
+  public EdmPathImpl(Edm edm, CsdlPath csdlExp) {
+    super(edm, "Path");
+    this.csdlExp = csdlExp;
   }
 
+  @Override
+  public String getValue() {
+    return csdlExp.getValue();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyPathImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyPathImpl.java
index 7809b34..1f18616 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyPathImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyPathImpl.java
@@ -18,12 +18,21 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.annotation.EdmPropertyPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyPath;
 
-public class EdmPropertyPathImpl extends AbstractEdmElementOrAttributeNotation implements EdmPropertyPath {
+public class EdmPropertyPathImpl extends AbstractEdmDynamicExpression implements EdmPropertyPath {
 
-  public EdmPropertyPathImpl(final String value) {
-    super(value);
+  private final CsdlPropertyPath csdlExp;
+
+  public EdmPropertyPathImpl(Edm edm, CsdlPropertyPath  csdlExp) {
+    super(edm, "PropertyPath");
+    this.csdlExp = csdlExp;
   }
 
+  @Override
+  public String getValue() {
+    return csdlExp.getValue();
+  }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyValueImpl.java
index 08307ea..97406d4 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmPropertyValueImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,28 +18,39 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyValue;
 
 public class EdmPropertyValueImpl
-extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmPropertyValue {
+    extends AbstractEdmAnnotatableDynamicExpression implements EdmPropertyValue {
 
-  private final String property;
+  private EdmExpression value;
+  private CsdlPropertyValue csdlExp;
 
-  private final EdmAnnotationExpression value;
-
-  public EdmPropertyValueImpl(final String property, final EdmAnnotationExpression value) {
-    this.property = property;
-    this.value = value;
+  public EdmPropertyValueImpl(Edm edm, CsdlPropertyValue csdlExp) {
+    super(edm, "PropertyValue", csdlExp);
+    this.csdlExp = csdlExp;
   }
 
   @Override
   public String getProperty() {
-    return property;
+    if (csdlExp.getProperty() == null) {
+      throw new EdmException("PropertyValue expressions require a referenced property value.");
+    }
+    return csdlExp.getProperty();
   }
 
   @Override
-  public EdmAnnotationExpression getValue() {
+  public EdmExpression getValue() {
+    if (value == null) {
+      if (csdlExp.getValue() == null) {
+        throw new EdmException("PropertyValue expressions require an expression value.");
+      }
+      value = getExpression(edm, csdlExp.getValue());
+    }
     return value;
   }
 


[2/4] olingo-odata4 git commit: [OLINGO786] FIx edm annotation classes

Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmRecordImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmRecordImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmRecordImpl.java
index 9464e34..d4af2ee 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmRecordImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmRecordImpl.java
@@ -18,36 +18,57 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmStructuredType;
 import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
 import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyValue;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlRecord;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 
-public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmRecord {
-
-  private final List<EdmPropertyValue> propertyValues;
+public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicExpression implements EdmRecord {
 
+  private List<EdmPropertyValue> propertyValues;
   private EdmStructuredType type;
+  private CsdlRecord record;
 
-  public EdmRecordImpl(final Edm edm, final String type, final List<EdmPropertyValue> propertyValues) {
-    this.propertyValues = propertyValues;
-
-    if (type != null) {
-      final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
-      this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
-    }
+  public EdmRecordImpl(final Edm edm, CsdlRecord csdlExp) {
+    super(edm, "Record", csdlExp);
+    this.record = csdlExp;
   }
 
   @Override
   public List<EdmPropertyValue> getPropertyValues() {
+    if (propertyValues == null) {
+      List<EdmPropertyValue> localValues = new ArrayList<EdmPropertyValue>();
+      if (record.getPropertyValues() != null) {
+        for (CsdlPropertyValue value : record.getPropertyValues()) {
+          localValues.add(new EdmPropertyValueImpl(edm, value));
+        }
+      }
+      propertyValues = Collections.unmodifiableList(localValues);
+    }
     return propertyValues;
   }
 
   @Override
   public EdmStructuredType getType() {
+    if (type == null) {
+      if (record.getType() == null) {
+        throw new EdmException("Must specify a type for a Record expression.");
+      }
+      final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(record.getType()).build();
+      if (typeInfo.isEntityType() || typeInfo.isComplexType()) {
+        type = typeInfo.isEntityType() ? typeInfo.getEntityType() : typeInfo.getComplexType();
+      } else {
+        throw new EdmException("Record expressions must specify a complex or entity type.");
+      }
+    }
     return type;
   }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmUrlRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmUrlRefImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmUrlRefImpl.java
index 3c2db50..1210dbc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmUrlRefImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/EdmUrlRefImpl.java
@@ -6,9 +6,9 @@
  * 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
@@ -18,20 +18,30 @@
  */
 package org.apache.olingo.commons.core.edm.annotation;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlUrlRef;
 
-public class EdmUrlRefImpl extends AbstractEdmDynamicAnnotationExpression implements EdmUrlRef {
+public class EdmUrlRefImpl extends AbstractEdmDynamicExpression implements EdmUrlRef {
 
-  private final EdmAnnotationExpression value;
+  private final CsdlUrlRef csdlExp;
+  private EdmExpression value;
 
-  public EdmUrlRefImpl(final EdmAnnotationExpression value) {
-    this.value = value;
+  public EdmUrlRefImpl(Edm edm, CsdlUrlRef csdlExp) {
+    super(edm, "UrlRef");
+    this.csdlExp = csdlExp;
   }
 
   @Override
-  public EdmAnnotationExpression getValue() {
+  public EdmExpression getValue() {
+    if (value == null) {
+      if (csdlExp.getValue() == null) {
+        throw new EdmException("URLRef expressions require an expression value.");
+      }
+      value = getExpression(edm, csdlExp.getValue());
+    }
     return value;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/AbstractAnnotationTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/AbstractAnnotationTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/AbstractAnnotationTest.java
new file mode 100644
index 0000000..2f6bbab
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/AbstractAnnotationTest.java
@@ -0,0 +1,127 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.annotation.EdmConstantExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+
+public class AbstractAnnotationTest {
+
+  protected EdmDynamicExpression assertDynamic(EdmExpression exp) {
+    assertNotNull(exp);
+    assertTrue(exp.isDynamic());
+    assertFalse(exp.isConstant());
+    assertNull(exp.asConstant());
+    return exp.asDynamic();
+  }
+
+  protected EdmConstantExpression assertConstant(EdmExpression exp) {
+    assertNotNull(exp);
+    assertTrue(exp.isConstant());
+    assertFalse(exp.isDynamic());
+    assertNull(exp.asDynamic());
+    return exp.asConstant();
+  }
+  
+  protected void assertSingleKindDynamicExpression(EdmDynamicExpression dynExpr){
+    List<Boolean> allIsMethodValues = new ArrayList<Boolean>();
+    //Logical Operators
+    allIsMethodValues.add(dynExpr.isAnd());
+    allIsMethodValues.add(dynExpr.isOr());
+    allIsMethodValues.add(dynExpr.isNot());
+    //Comparison Operators
+    allIsMethodValues.add(dynExpr.isEq());
+    allIsMethodValues.add(dynExpr.isNe());
+    allIsMethodValues.add(dynExpr.isGt());
+    allIsMethodValues.add(dynExpr.isGe());
+    allIsMethodValues.add(dynExpr.isLt());
+    allIsMethodValues.add(dynExpr.isLe());
+    //Other Dynamic Kinds
+    allIsMethodValues.add(dynExpr.isAnnotationPath());
+    allIsMethodValues.add(dynExpr.isApply());
+    allIsMethodValues.add(dynExpr.isCast());
+    allIsMethodValues.add(dynExpr.isCollection());
+    allIsMethodValues.add(dynExpr.isIf());
+    allIsMethodValues.add(dynExpr.isIsOf());
+    allIsMethodValues.add(dynExpr.isLabeledElement());
+    allIsMethodValues.add(dynExpr.isLabeledElementReference());
+    allIsMethodValues.add(dynExpr.isNull());
+    allIsMethodValues.add(dynExpr.isNavigationPropertyPath());
+    allIsMethodValues.add(dynExpr.isPath());
+    allIsMethodValues.add(dynExpr.isPropertyPath());
+    allIsMethodValues.add(dynExpr.isPropertyValue());
+    allIsMethodValues.add(dynExpr.isRecord());
+    allIsMethodValues.add(dynExpr.isUrlRef());
+    
+    
+    //Remove all false values so that only one "true" value remains
+    allIsMethodValues.removeAll(Collections.singletonList(new Boolean(false)));
+    assertFalse(allIsMethodValues.contains(null));
+    assertTrue(allIsMethodValues.contains(new Boolean(true)));
+    assertEquals(1, allIsMethodValues.size());
+    
+    
+    
+    List<Object> allAsMethodValues = new ArrayList<Object>();
+    //Logical Operators
+    allAsMethodValues.add(dynExpr.asAnd());
+    allAsMethodValues.add(dynExpr.asOr());
+    allAsMethodValues.add(dynExpr.asNot());
+    //Comparison Operators
+    allAsMethodValues.add(dynExpr.asEq());
+    allAsMethodValues.add(dynExpr.asNe());
+    allAsMethodValues.add(dynExpr.asGt());
+    allAsMethodValues.add(dynExpr.asGe());
+    allAsMethodValues.add(dynExpr.asLt());
+    allAsMethodValues.add(dynExpr.asLe());
+    //Other Dynamic Kinds
+    allAsMethodValues.add(dynExpr.asAnnotationPath());
+    allAsMethodValues.add(dynExpr.asApply());
+    allAsMethodValues.add(dynExpr.asCast());
+    allAsMethodValues.add(dynExpr.asCollection());
+    allAsMethodValues.add(dynExpr.asIf());
+    allAsMethodValues.add(dynExpr.asIsOf());
+    allAsMethodValues.add(dynExpr.asLabeledElement());
+    allAsMethodValues.add(dynExpr.asLabeledElementReference());
+    allAsMethodValues.add(dynExpr.asNull());
+    allAsMethodValues.add(dynExpr.asNavigationPropertyPath());
+    allAsMethodValues.add(dynExpr.asPath());
+    allAsMethodValues.add(dynExpr.asPropertyPath());
+    allAsMethodValues.add(dynExpr.asPropertyValue());
+    allAsMethodValues.add(dynExpr.asRecord());
+    allAsMethodValues.add(dynExpr.asUrlRef());
+    
+    //Remove all false values so that only one "true" value remains
+    allAsMethodValues.removeAll(Collections.singletonList(null));
+    assertFalse(allAsMethodValues.contains(null));
+    assertEquals(1, allAsMethodValues.size());
+    assertTrue(allAsMethodValues.get(0) instanceof EdmDynamicExpression);
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmAnnotationPathTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmAnnotationPathTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmAnnotationPathTest.java
new file mode 100644
index 0000000..122abd7
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmAnnotationPathTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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 as 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlAnnotationPath;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmAnnotationPathTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialAnnotationPath() {
+    EdmExpression path = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlAnnotationPath());
+
+    EdmDynamicExpression dynExp = assertDynamic(path);
+    assertTrue(dynExp.isAnnotationPath());
+    assertNotNull(dynExp.asAnnotationPath());
+
+    assertEquals("AnnotationPath", dynExp.getExpressionName());
+    assertNull(dynExp.asAnnotationPath().getValue());
+
+    assertSingleKindDynamicExpression(dynExp);
+  }
+
+  @Test
+  public void annotationPathWithValue() {
+    EdmExpression exp =
+        AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlAnnotationPath().setValue("value"));
+    assertEquals("value", exp.asDynamic().asAnnotationPath().getValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmApplyImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmApplyImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmApplyImplTest.java
new file mode 100644
index 0000000..459536a
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmApplyImplTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmApply;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlApply;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
+//CHECKSTYLE:OFF
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression.LogicalOrComparisonExpressionType;
+//CHECKSTYLE:ON
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmApplyImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialApply() {
+    EdmExpression apply = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlApply());
+
+    EdmDynamicExpression dynExp = assertDynamic(apply);
+    assertTrue(dynExp.isApply());
+    assertNotNull(dynExp.asApply());
+
+    assertEquals("Apply", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmApply asApply = dynExp.asApply();
+
+    try {
+      asApply.getFunction();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("An Apply expression must specify a function.", e.getMessage());
+    }
+    assertNotNull(asApply.getParameters());
+    assertTrue(asApply.getParameters().isEmpty());
+
+    assertNotNull(asApply.getAnnotations());
+    assertTrue(asApply.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void functionAndNoParameters() {
+    EdmExpression apply = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlApply().setFunction("Function"));
+
+    EdmDynamicExpression dynExp = assertDynamic(apply);
+    EdmApply asApply = dynExp.asApply();
+
+    assertEquals("Function", asApply.getFunction());
+    assertNotNull(asApply.getParameters());
+    assertTrue(asApply.getParameters().isEmpty());
+  }
+
+  @Test
+  public void functionWithParameters() {
+    CsdlApply csdlApply = new CsdlApply();
+    csdlApply.setFunction("Function");
+
+    List<CsdlExpression> parameters = new ArrayList<CsdlExpression>();
+    parameters.add(new CsdlConstantExpression(ConstantExpressionType.String));
+    parameters.add(new CsdlLogicalOrComparisonExpression(LogicalOrComparisonExpressionType.And));
+    csdlApply.setParameters(parameters);
+
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlApply.setAnnotations(csdlAnnotations);
+
+    EdmExpression apply = AbstractEdmExpression.getExpression(mock(Edm.class), csdlApply);
+
+    EdmDynamicExpression dynExp = assertDynamic(apply);
+    EdmApply asApply = dynExp.asApply();
+
+    assertEquals("Function", asApply.getFunction());
+    assertNotNull(asApply.getParameters());
+    assertEquals(2, asApply.getParameters().size());
+    assertTrue(asApply.getParameters().get(0).isConstant());
+    assertTrue(asApply.getParameters().get(1).isDynamic());
+
+    assertNotNull(asApply.getAnnotations());
+    assertEquals(1, asApply.getAnnotations().size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCastImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCastImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCastImplTest.java
new file mode 100644
index 0000000..1427e18
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCastImplTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.annotation.EdmCast;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlCast;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmCastImplTest extends AbstractAnnotationTest{
+  
+  @Test
+  public void initialCast() {
+    EdmExpression cast = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlCast());
+
+    EdmDynamicExpression dynExp = assertDynamic(cast);
+    assertTrue(dynExp.isCast());
+    assertNotNull(dynExp.asCast());
+
+    assertEquals("Cast", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+    try {
+      dynExp.asCast().getValue();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Cast expressions require an expression value.", e.getMessage());
+    }
+
+    EdmCast asCast = dynExp.asCast();
+    assertNull(asCast.getMaxLength());
+    assertNull(asCast.getPrecision());
+    assertNull(asCast.getScale());
+    assertNull(asCast.getSrid());
+    try {
+      asCast.getType();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Must specify a type for a Cast expression.", e.getMessage());
+    }
+
+    assertNotNull(asCast.getAnnotations());
+    assertTrue(asCast.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void castWithExpression() {
+    CsdlCast csdlExp = new CsdlCast();
+    csdlExp.setMaxLength(new Integer(1));
+    csdlExp.setPrecision(new Integer(2));
+    csdlExp.setScale(new Integer(3));
+    csdlExp.setType("Edm.String");
+    csdlExp.setValue(new CsdlConstantExpression(ConstantExpressionType.String));
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlExp.setAnnotations(csdlAnnotations);
+    EdmExpression isOf = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    EdmCast asIsOf = isOf.asDynamic().asCast();
+
+    assertEquals(new Integer(1), asIsOf.getMaxLength());
+    assertEquals(new Integer(2), asIsOf.getPrecision());
+    assertEquals(new Integer(3), asIsOf.getScale());
+
+    assertNotNull(asIsOf.getType());
+    assertTrue(asIsOf.getType() instanceof EdmPrimitiveType);
+
+    assertNotNull(asIsOf.getValue());
+    assertTrue(asIsOf.getValue().isConstant());
+
+    assertNotNull(asIsOf.getAnnotations());
+    assertEquals(1, asIsOf.getAnnotations().size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCollectionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCollectionImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCollectionImplTest.java
new file mode 100644
index 0000000..0d7e72d
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmCollectionImplTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmCollection;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlCollection;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
+//CHECKSTYLE:OFF
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression.LogicalOrComparisonExpressionType;
+//CHECKSTYLE:ON
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmCollectionImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialCollection() {
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlCollection());
+
+    EdmDynamicExpression dynExp = assertDynamic(exp);
+    assertTrue(dynExp.isCollection());
+    assertNotNull(dynExp.asCollection());
+
+    assertEquals("Collection", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmCollection asCollection = dynExp.asCollection();
+
+    assertNotNull(asCollection.getItems());
+    assertTrue(asCollection.getItems().isEmpty());
+  }
+
+  @Test
+  public void collectionWithThreeItems() {
+    CsdlCollection csdlCollection = new CsdlCollection();
+    List<CsdlExpression> items = new ArrayList<CsdlExpression>();
+    items.add(new CsdlConstantExpression(ConstantExpressionType.String));
+    items.add(new CsdlLogicalOrComparisonExpression(LogicalOrComparisonExpressionType.And));
+    items.add(new CsdlConstantExpression(ConstantExpressionType.Bool));
+    csdlCollection.setItems(items);
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlCollection);
+    EdmCollection asCollection = exp.asDynamic().asCollection();
+
+    assertNotNull(asCollection.getItems());
+    assertEquals(3, asCollection.getItems().size());
+
+    assertTrue(asCollection.getItems().get(0).isConstant());
+    assertTrue(asCollection.getItems().get(1).isDynamic());
+    assertTrue(asCollection.getItems().get(2).isConstant());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmConstantExpressionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmConstantExpressionImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmConstantExpressionImplTest.java
new file mode 100644
index 0000000..e45c760
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmConstantExpressionImplTest.java
@@ -0,0 +1,167 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmConstantExpressionImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void binaryExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.Binary, "qrvM3e7_");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Binary", exp.asConstant().getExpressionName());
+    assertEquals("qrvM3e7_", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void boolExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.Bool, "true");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Bool", exp.asConstant().getExpressionName());
+    assertEquals("true", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void dateExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.Date, "2012-02-29");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Date", exp.asConstant().getExpressionName());
+    assertEquals("2012-02-29", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void dateTimeOffsetExpression() {
+    CsdlConstantExpression csdlExp =
+        new CsdlConstantExpression(ConstantExpressionType.DateTimeOffset, "2012-02-29T01:02:03Z");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("DateTimeOffset", exp.asConstant().getExpressionName());
+    assertEquals("2012-02-29T01:02:03Z", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void decimalExpression() {
+    CsdlConstantExpression csdlExp =
+        new CsdlConstantExpression(ConstantExpressionType.Decimal, "-123456789012345678901234567890");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Decimal", exp.asConstant().getExpressionName());
+    assertEquals("-123456789012345678901234567890", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void durationExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.Duration, "PT10S");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Duration", exp.asConstant().getExpressionName());
+    assertEquals("PT10S", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void enumMemberExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.EnumMember, "Enum/enumMember");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("EnumMember", exp.asConstant().getExpressionName());
+    assertEquals("Enum/enumMember", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void floatExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.Float, "1.42");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Float", exp.asConstant().getExpressionName());
+    assertEquals("1.42", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void guidExpression() {
+    CsdlConstantExpression csdlExp =
+        new CsdlConstantExpression(ConstantExpressionType.Guid, "aabbccdd-aabb-ccdd-eeff-aabbccddeeff");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Guid", exp.asConstant().getExpressionName());
+    assertEquals("aabbccdd-aabb-ccdd-eeff-aabbccddeeff", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void intExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.Int, "42");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("Int", exp.asConstant().getExpressionName());
+    assertEquals("42", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void stringExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.String, "ABCD");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("String", exp.asConstant().getExpressionName());
+    assertEquals("ABCD", exp.asConstant().getValueAsString());
+  }
+
+  @Test
+  public void timeOfDayExpression() {
+    CsdlConstantExpression csdlExp = new CsdlConstantExpression(ConstantExpressionType.TimeOfDay, "00:00:00.999");
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    assertConstant(exp);
+
+    assertEquals("TimeOfDay", exp.asConstant().getExpressionName());
+    assertEquals("00:00:00.999", exp.asConstant().getValueAsString());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIfImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIfImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIfImplTest.java
new file mode 100644
index 0000000..fa41522
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIfImplTest.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.core.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmIf;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlIf;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
+//CHECKSTYLE:OFF
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression.LogicalOrComparisonExpressionType;
+//CHECKSTYLE:ON
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmIfImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialIf() {
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlIf());
+
+    EdmDynamicExpression dynExp = assertDynamic(exp);
+    assertTrue(dynExp.isIf());
+    assertNotNull(dynExp.asIf());
+
+    assertEquals("If", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmIf asIf = dynExp.asIf();
+
+    try {
+      asIf.getGuard();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Guard clause of an if expression must not be null", e.getMessage());
+    }
+
+    try {
+      asIf.getThen();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Then clause of an if expression must not be null", e.getMessage());
+    }
+
+    assertNull(asIf.getElse());
+
+    assertNotNull(asIf.getAnnotations());
+    assertTrue(asIf.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void withAllExpressions() {
+    CsdlIf csdlIf = new CsdlIf();
+    csdlIf.setGuard(new CsdlConstantExpression(ConstantExpressionType.Bool));
+    csdlIf.setThen(new CsdlConstantExpression(ConstantExpressionType.String));
+    csdlIf.setElse(new CsdlLogicalOrComparisonExpression(LogicalOrComparisonExpressionType.And));
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlIf.setAnnotations(csdlAnnotations);
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlIf);
+    EdmIf asIf = exp.asDynamic().asIf();
+
+    assertNotNull(asIf.getGuard());
+    assertTrue(asIf.getGuard().isConstant());
+    assertNotNull(asIf.getThen());
+    assertTrue(asIf.getThen().isConstant());
+    assertNotNull(asIf.getElse());
+    assertTrue(asIf.getElse().isDynamic());
+
+    assertNotNull(asIf.getAnnotations());
+    assertEquals(1, asIf.getAnnotations().size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIsOfImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIsOfImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIsOfImplTest.java
new file mode 100644
index 0000000..cba3abf
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmIsOfImplTest.java
@@ -0,0 +1,107 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmIsOf;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlIsOf;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmIsOfImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialIsOf() {
+    EdmExpression isOf = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlIsOf());
+
+    EdmDynamicExpression dynExp = assertDynamic(isOf);
+    assertTrue(dynExp.isIsOf());
+    assertNotNull(dynExp.asIsOf());
+
+    assertEquals("IsOf", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+    try {
+      dynExp.asIsOf().getValue();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("IsOf expressions require an expression value.", e.getMessage());
+    }
+
+    EdmIsOf asIsOf = dynExp.asIsOf();
+    assertNull(asIsOf.getMaxLength());
+    assertNull(asIsOf.getPrecision());
+    assertNull(asIsOf.getScale());
+    assertNull(asIsOf.getSrid());
+    try {
+      asIsOf.getType();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Must specify a type for an IsOf expression.", e.getMessage());
+    }
+
+    assertNotNull(asIsOf.getAnnotations());
+    assertTrue(asIsOf.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void isOfWithExpression() {
+    CsdlIsOf csdlExp = new CsdlIsOf();
+    csdlExp.setMaxLength(new Integer(1));
+    csdlExp.setPrecision(new Integer(2));
+    csdlExp.setScale(new Integer(3));
+    csdlExp.setType("Edm.String");
+    csdlExp.setValue(new CsdlConstantExpression(ConstantExpressionType.String));
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlExp.setAnnotations(csdlAnnotations);
+    EdmExpression isOf = AbstractEdmExpression.getExpression(mock(Edm.class), csdlExp);
+
+    EdmIsOf asIsOf = isOf.asDynamic().asIsOf();
+
+    assertEquals(new Integer(1), asIsOf.getMaxLength());
+    assertEquals(new Integer(2), asIsOf.getPrecision());
+    assertEquals(new Integer(3), asIsOf.getScale());
+
+    assertNotNull(asIsOf.getType());
+    assertTrue(asIsOf.getType() instanceof EdmPrimitiveType);
+
+    assertNotNull(asIsOf.getValue());
+    assertTrue(asIsOf.getValue().isConstant());
+
+    assertNotNull(asIsOf.getAnnotations());
+    assertEquals(1, asIsOf.getAnnotations().size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabeledElementImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabeledElementImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabeledElementImplTest.java
new file mode 100644
index 0000000..3a5a6a0
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabeledElementImplTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmLabeledElement;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLabeledElement;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmLabeledElementImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialLabeledElement() {
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlLabeledElement());
+
+    EdmDynamicExpression dynExp = assertDynamic(exp);
+    assertTrue(dynExp.isLabeledElement());
+    assertNotNull(dynExp.asLabeledElement());
+
+    assertEquals("LabeledElement", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmLabeledElement asLabeled = dynExp.asLabeledElement();
+
+    try {
+      asLabeled.getName();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("The LabeledElement expression must have a name attribute.", e.getMessage());
+    }
+
+    try {
+      asLabeled.getValue();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("The LabeledElement expression must have a child expression", e.getMessage());
+    }
+
+    assertNotNull(asLabeled.getAnnotations());
+    assertTrue(asLabeled.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void labeledElementWithNameAndValue() {
+    CsdlLabeledElement csdlLabeledElement = new CsdlLabeledElement();
+    csdlLabeledElement.setName("name");
+    csdlLabeledElement.setValue(new CsdlConstantExpression(ConstantExpressionType.String));
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlLabeledElement.setAnnotations(csdlAnnotations);
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlLabeledElement);
+    EdmLabeledElement asLabeled = exp.asDynamic().asLabeledElement();
+
+    assertEquals("name", asLabeled.getName());
+    assertNotNull(asLabeled.getValue());
+    assertTrue(asLabeled.getValue().isConstant());
+
+    assertNotNull(asLabeled.getAnnotations());
+    assertEquals(1, asLabeled.getAnnotations().size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabledElementReferenceImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabledElementReferenceImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabledElementReferenceImplTest.java
new file mode 100644
index 0000000..0fa2e64
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLabledElementReferenceImplTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLabeledElementReference;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmLabledElementReferenceImplTest extends AbstractAnnotationTest {
+  @Test
+  public void initialPropertyPath() {
+    EdmExpression path = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlLabeledElementReference());
+
+    EdmDynamicExpression dynExp = assertDynamic(path);
+    assertTrue(dynExp.isLabeledElementReference());
+    assertNotNull(dynExp.asLabeledElementReference());
+
+    assertEquals("LabeledElementReference", dynExp.getExpressionName());
+    assertNull(dynExp.asLabeledElementReference().getValue());
+    assertSingleKindDynamicExpression(dynExp);
+  }
+
+  @Test
+  public void annotationPathWithValue() {
+    EdmExpression exp =
+        AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlLabeledElementReference().setValue("value"));
+    assertEquals("value", exp.asDynamic().asLabeledElementReference().getValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLogicalOrComparisonImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLogicalOrComparisonImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLogicalOrComparisonImplTest.java
new file mode 100644
index 0000000..e5a4cf9
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmLogicalOrComparisonImplTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmConstantExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmLogicalOrComparisonExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression;
+//CHECKSTYLE:OFF
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlLogicalOrComparisonExpression.LogicalOrComparisonExpressionType;
+//CHECKSTYLE:ON
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmLogicalOrComparisonImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialLogicalOrOperationsClasses() {
+    for (LogicalOrComparisonExpressionType type : LogicalOrComparisonExpressionType.values()) {
+      EdmExpression path = AbstractEdmExpression.getExpression(
+          mock(Edm.class),
+          new CsdlLogicalOrComparisonExpression(type));
+
+      EdmDynamicExpression dynExp = assertDynamic(path);
+      assertEquals(type.toString(), dynExp.getExpressionName());
+      assertSingleKindDynamicExpression(dynExp);
+
+      EdmLogicalOrComparisonExpression logicOrComparisonExp = (EdmLogicalOrComparisonExpression) dynExp;
+      try {
+        logicOrComparisonExp.getLeftExpression();
+        fail("EdmException expected");
+      } catch (EdmException e) {
+        assertEquals("Comparison Or Logical expression MUST have a left and right expression.", e.getMessage());
+      }
+
+      try {
+        logicOrComparisonExp.getRightExpression();
+        fail("EdmException expected");
+      } catch (EdmException e) {
+        assertEquals("Comparison Or Logical expression MUST have a left and right expression.", e.getMessage());
+      }
+    }
+  }
+
+  @Test
+  public void logicalOrOperationsClassesWithExpressions() {
+    for (LogicalOrComparisonExpressionType type : LogicalOrComparisonExpressionType.values()) {
+      EdmExpression path = AbstractEdmExpression.getExpression(
+          mock(Edm.class),
+          new CsdlLogicalOrComparisonExpression(type)
+              .setLeft(new CsdlConstantExpression(ConstantExpressionType.String))
+              .setRight(new CsdlLogicalOrComparisonExpression(type)));
+
+      EdmDynamicExpression dynExp = assertDynamic(path);
+      assertEquals(type.toString(), dynExp.getExpressionName());
+      assertSingleKindDynamicExpression(dynExp);
+
+      EdmLogicalOrComparisonExpression logicOrComparisonExp = (EdmLogicalOrComparisonExpression) dynExp;
+      assertNotNull(logicOrComparisonExp.getLeftExpression());
+      assertNotNull(logicOrComparisonExp.getRightExpression());
+      if (type == LogicalOrComparisonExpressionType.Not) {
+        assertTrue(logicOrComparisonExp.getLeftExpression() == logicOrComparisonExp.getRightExpression());
+      } else {
+        assertTrue(logicOrComparisonExp.getLeftExpression() instanceof EdmConstantExpression);
+        assertTrue(logicOrComparisonExp.getRightExpression() instanceof EdmDynamicExpression);
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmNavigationPropertyPathImpTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmNavigationPropertyPathImpTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmNavigationPropertyPathImpTest.java
new file mode 100644
index 0000000..d4fe6f1
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmNavigationPropertyPathImpTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlNavigationPropertyPath;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmNavigationPropertyPathImpTest extends AbstractAnnotationTest {
+  @Test
+  public void initialPropertyPath() {
+    EdmExpression path = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlNavigationPropertyPath());
+
+    EdmDynamicExpression dynExp = assertDynamic(path);
+    assertTrue(dynExp.isNavigationPropertyPath());
+    assertNotNull(dynExp.asNavigationPropertyPath());
+
+    assertEquals("NavigationPropertyPath", dynExp.getExpressionName());
+    assertNull(dynExp.asNavigationPropertyPath().getValue());
+
+    assertSingleKindDynamicExpression(dynExp);
+  }
+
+  @Test
+  public void annotationPathWithValue() {
+    EdmExpression exp =
+        AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlNavigationPropertyPath().setValue("value"));
+    assertEquals("value", exp.asDynamic().asNavigationPropertyPath().getValue());
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPathImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPathImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPathImplTest.java
new file mode 100644
index 0000000..5f32f07
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPathImplTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPath;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmPathImplTest extends AbstractAnnotationTest{
+  @Test
+  public void initialPropertyPath() {
+    EdmExpression path = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlPath());
+
+    EdmDynamicExpression dynExp = assertDynamic(path);
+    assertTrue(dynExp.isPath());
+    assertNotNull(dynExp.asPath());
+
+    assertEquals("Path", dynExp.getExpressionName());
+    assertNull(dynExp.asPath().getValue());
+
+    assertSingleKindDynamicExpression(dynExp);
+  }
+
+  @Test
+  public void annotationPathWithValue() {
+    EdmExpression exp =
+        AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlPath().setValue("value"));
+    assertEquals("value", exp.asDynamic().asPath().getValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyPathImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyPathImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyPathImplTest.java
new file mode 100644
index 0000000..eb0228e
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyPathImplTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyPath;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmPropertyPathImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialPropertyPath() {
+    EdmExpression path = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlPropertyPath());
+
+    EdmDynamicExpression dynExp = assertDynamic(path);
+    assertTrue(dynExp.isPropertyPath());
+    assertNotNull(dynExp.asPropertyPath());
+
+    assertEquals("PropertyPath", dynExp.getExpressionName());
+    assertNull(dynExp.asPropertyPath().getValue());
+
+    assertSingleKindDynamicExpression(dynExp);
+  }
+
+  @Test
+  public void annotationPathWithValue() {
+    EdmExpression exp =
+        AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlPropertyPath().setValue("value"));
+    assertEquals("value", exp.asDynamic().asPropertyPath().getValue());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyValueImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyValueImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyValueImplTest.java
new file mode 100644
index 0000000..28d1740
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmPropertyValueImplTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyValue;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmPropertyValueImplTest extends AbstractAnnotationTest {
+  @Test
+  public void initialPropertyValue() {
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlPropertyValue());
+
+    EdmDynamicExpression dynExp = assertDynamic(exp);
+    assertTrue(dynExp.isPropertyValue());
+    assertNotNull(dynExp.asPropertyValue());
+
+    assertEquals("PropertyValue", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmPropertyValue asPropValue = dynExp.asPropertyValue();
+    try {
+      asPropValue.getProperty();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("PropertyValue expressions require a referenced property value.", e.getMessage());
+    }
+
+    try {
+      asPropValue.getValue();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("PropertyValue expressions require an expression value.", e.getMessage());
+    }
+
+    assertNotNull(asPropValue.getAnnotations());
+    assertTrue(asPropValue.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void propertyValue() {
+    CsdlPropertyValue csdlPropertyValue = new CsdlPropertyValue();
+    csdlPropertyValue.setProperty("property");
+    csdlPropertyValue.setValue(new CsdlConstantExpression(ConstantExpressionType.String));
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlPropertyValue.setAnnotations(csdlAnnotations);
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlPropertyValue);
+    EdmPropertyValue asPropValue = exp.asDynamic().asPropertyValue();
+
+    assertNotNull(asPropValue.getProperty());
+    assertEquals("property", asPropValue.getProperty());
+    assertNotNull(asPropValue.getValue());
+    assertTrue(asPropValue.getValue().isConstant());
+    
+    assertNotNull(asPropValue.getAnnotations());
+    assertEquals(1, asPropValue.getAnnotations().size());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmRecordImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmRecordImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmRecordImplTest.java
new file mode 100644
index 0000000..2f3bc1b
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmRecordImplTest.java
@@ -0,0 +1,158 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyValue;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlRecord;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmRecordImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialRecord() {
+    EdmExpression record = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlRecord());
+
+    EdmDynamicExpression dynExp = assertDynamic(record);
+    assertTrue(dynExp.isRecord());
+    assertNotNull(dynExp.asRecord());
+
+    assertEquals("Record", dynExp.getExpressionName());
+    assertNotNull(dynExp.asRecord().getPropertyValues());
+    assertTrue(dynExp.asRecord().getPropertyValues().isEmpty());
+
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmRecord asRecord = dynExp.asRecord();
+    try {
+      asRecord.getType();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Must specify a type for a Record expression.", e.getMessage());
+    }
+
+    assertNotNull(asRecord.getAnnotations());
+    assertTrue(asRecord.getAnnotations().isEmpty());
+  }
+
+  @Test
+  public void recordWithEntityTypeAndPropValues() {
+    CsdlRecord csdlRecord = new CsdlRecord();
+    csdlRecord.setType("ns.et");
+    Edm mock = mock(Edm.class);
+    when(mock.getEntityType(new FullQualifiedName("ns.et"))).thenReturn(mock(EdmEntityType.class));
+    List<CsdlPropertyValue> propertyValues = new ArrayList<CsdlPropertyValue>();
+    propertyValues.add(new CsdlPropertyValue());
+    csdlRecord.setPropertyValues(propertyValues);
+    List<CsdlAnnotation> csdlAnnotations = new ArrayList<CsdlAnnotation>();
+    csdlAnnotations.add(new CsdlAnnotation().setTerm("ns.term"));
+    csdlRecord.setAnnotations(csdlAnnotations);
+    EdmExpression record = AbstractEdmExpression.getExpression(mock, csdlRecord);
+
+    EdmDynamicExpression dynExp = assertDynamic(record);
+    EdmRecord asRecord = dynExp.asRecord();
+
+    assertNotNull(asRecord.getPropertyValues());
+    assertEquals(1, asRecord.getPropertyValues().size());
+
+    assertNotNull(asRecord.getType());
+    assertTrue(asRecord.getType() instanceof EdmEntityType);
+
+    assertNotNull(asRecord.getAnnotations());
+    assertEquals(1, asRecord.getAnnotations().size());
+  }
+
+  @Test
+  public void recordWithComplexType() {
+    CsdlRecord csdlRecord = new CsdlRecord();
+    csdlRecord.setType("ns.ct");
+    Edm mock = mock(Edm.class);
+    when(mock.getComplexType(new FullQualifiedName("ns.ct"))).thenReturn(mock(EdmComplexType.class));
+    EdmExpression record = AbstractEdmExpression.getExpression(mock, csdlRecord);
+
+    EdmDynamicExpression dynExp = assertDynamic(record);
+    EdmRecord asRecord = dynExp.asRecord();
+
+    assertNotNull(asRecord.getType());
+    assertTrue(asRecord.getType() instanceof EdmComplexType);
+  }
+
+  @Test
+  public void recordWithInvalidTypes() {
+    Edm edm = mock(Edm.class);
+    EdmExpression exp = AbstractEdmExpression.getExpression(edm, new CsdlRecord().setType("ns.invalid"));
+    EdmRecord record = exp.asDynamic().asRecord();
+    try {
+      record.getType();
+    } catch (EdmException e) {
+      assertEquals("Record expressions must specify a complex or entity type.", e.getMessage());
+    }
+
+    // Primitive
+    exp = AbstractEdmExpression.getExpression(edm, new CsdlRecord().setType("Edm.String"));
+    record = exp.asDynamic().asRecord();
+    try {
+      record.getType();
+    } catch (EdmException e) {
+      assertEquals("Record expressions must specify a complex or entity type.", e.getMessage());
+    }
+
+    // Enum
+    when(edm.getEnumType(new FullQualifiedName("ns.enum"))).thenReturn(mock(EdmEnumType.class));
+    exp = AbstractEdmExpression.getExpression(edm, new CsdlRecord().setType("ns.enum"));
+    record = exp.asDynamic().asRecord();
+    try {
+      record.getType();
+    } catch (EdmException e) {
+      assertEquals("Record expressions must specify a complex or entity type.", e.getMessage());
+    }
+
+    // Typedef
+    when(edm.getTypeDefinition(new FullQualifiedName("ns.typedef"))).thenReturn(mock(EdmTypeDefinition.class));
+    exp = AbstractEdmExpression.getExpression(edm, new CsdlRecord().setType("ns.typedef"));
+    record = exp.asDynamic().asRecord();
+    try {
+      record.getType();
+    } catch (EdmException e) {
+      assertEquals("Record expressions must specify a complex or entity type.", e.getMessage());
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmUrlRefImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmUrlRefImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmUrlRefImplTest.java
new file mode 100644
index 0000000..1f6d703
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/annotations/EdmUrlRefImplTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.edm.annotations;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmUrlRef;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlNull;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlUrlRef;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
+import org.junit.Test;
+
+public class EdmUrlRefImplTest extends AbstractAnnotationTest {
+
+  @Test
+  public void initialUrlRef() {
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), new CsdlUrlRef());
+
+    EdmDynamicExpression dynExp = assertDynamic(exp);
+    assertTrue(dynExp.isUrlRef());
+    assertNotNull(dynExp.asUrlRef());
+
+    assertEquals("UrlRef", dynExp.getExpressionName());
+    assertSingleKindDynamicExpression(dynExp);
+
+    EdmUrlRef asUrlRef = dynExp.asUrlRef();
+    try {
+      asUrlRef.getValue();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("URLRef expressions require an expression value.", e.getMessage());
+    }
+  }
+
+  @Test
+  public void urlRefWithValue() {
+    CsdlUrlRef csdlUrlRef = new CsdlUrlRef();
+    csdlUrlRef.setValue(new CsdlConstantExpression(ConstantExpressionType.String));
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlUrlRef);
+    EdmUrlRef asUrlRef = exp.asDynamic().asUrlRef();
+    assertNotNull(asUrlRef.getValue());
+    assertTrue(asUrlRef.getValue().isConstant());
+  }
+
+  @Test
+  public void urlRefWithInvalidValue() {
+    CsdlUrlRef csdlUrlRef = new CsdlUrlRef();
+    csdlUrlRef.setValue(new CsdlConstantExpression(ConstantExpressionType.Bool));
+    EdmExpression exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlUrlRef);
+    EdmUrlRef asUrlRef = exp.asDynamic().asUrlRef();
+    assertNotNull(asUrlRef.getValue());
+    assertTrue(asUrlRef.getValue().isConstant());
+
+    csdlUrlRef = new CsdlUrlRef();
+    csdlUrlRef.setValue(new CsdlNull());
+    exp = AbstractEdmExpression.getExpression(mock(Edm.class), csdlUrlRef);
+    asUrlRef = exp.asDynamic().asUrlRef();
+    assertNotNull(asUrlRef.getValue());
+    assertTrue(asUrlRef.getValue().isDynamic());
+    assertTrue(asUrlRef.getValue().asDynamic().isNull());
+    assertNotNull(asUrlRef.getValue().asDynamic().asNull());
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmAnnotationImplTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmAnnotationImplTest.java b/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmAnnotationImplTest.java
new file mode 100644
index 0000000..869af0f
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmAnnotationImplTest.java
@@ -0,0 +1,82 @@
+/*
+ * 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.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
+import org.apache.olingo.commons.core.edm.EdmAnnotationImpl;
+import org.junit.Test;
+
+public class EdmAnnotationImplTest {
+
+  @Test
+  public void initialAnnotation() {
+    EdmAnnotation anno = new EdmAnnotationImpl(mock(Edm.class), new CsdlAnnotation());
+
+    assertNull(anno.getQualifier());
+    assertNotNull(anno.getAnnotations());
+    assertTrue(anno.getAnnotations().isEmpty());
+    assertNull(anno.getExpression());
+    try {
+      anno.getTerm();
+      fail("EdmException expected");
+    } catch (EdmException e) {
+      assertEquals("Term must not be null for an annotation.", e.getMessage());
+    }
+  }
+
+  @Test
+  public void simpleAnnotationNoExpression() {
+    Edm mock = mock(Edm.class);
+    EdmTerm termMock = mock(EdmTerm.class);
+    when(mock.getTerm(new FullQualifiedName("ns", "termName"))).thenReturn(termMock);
+    EdmAnnotation anno =
+        new EdmAnnotationImpl(mock, new CsdlAnnotation().setQualifier("Qualifier").setTerm("ns.termName"));
+
+    assertEquals("Qualifier", anno.getQualifier());
+    assertNotNull(anno.getAnnotations());
+    assertTrue(anno.getAnnotations().isEmpty());
+    assertNotNull(anno.getTerm());
+    assertEquals(termMock, anno.getTerm());
+  }
+
+  @Test
+  public void simpleAnnotationWitConstantExpression() {
+    EdmAnnotation anno =
+        new EdmAnnotationImpl(mock(Edm.class), new CsdlAnnotation()
+            .setExpression(new CsdlConstantExpression(ConstantExpressionType.String).setValue("value")));
+
+    assertEquals("value", anno.getExpression().asConstant().getValueAsString());
+  }
+
+}


[4/4] olingo-odata4 git commit: [OLINGO786] FIx edm annotation classes

Posted by ch...@apache.org.
[OLINGO786] FIx edm annotation classes

This also includes tests for all edm classes.


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

Branch: refs/heads/olingo786
Commit: 41210245d78beb596dde1b1440da357aa83367b4
Parents: 67ccbf9
Author: Christian Amend <ch...@sap.com>
Authored: Mon Oct 19 15:11:15 2015 +0200
Committer: Christian Amend <ch...@sap.com>
Committed: Mon Oct 19 15:11:15 2015 +0200

----------------------------------------------------------------------
 .../xml/AbstractClientCsdlEdmDeserializer.java  |   4 +-
 .../olingo/commons/api/edm/EdmAnnotation.java   |   4 +-
 .../commons/api/edm/annotation/EdmAnd.java      |   2 +-
 .../edm/annotation/EdmAnnotationExpression.java |  50 ---
 .../api/edm/annotation/EdmAnnotationPath.java   |   2 +-
 .../commons/api/edm/annotation/EdmApply.java    |   4 +-
 .../commons/api/edm/annotation/EdmCast.java     |   4 +-
 .../api/edm/annotation/EdmCollection.java       |   4 +-
 .../EdmConstantAnnotationExpression.java        |  39 ---
 .../edm/annotation/EdmConstantExpression.java   |  40 +++
 .../EdmDynamicAnnotationExpression.java         | 313 -------------------
 .../edm/annotation/EdmDynamicExpression.java    | 313 +++++++++++++++++++
 .../commons/api/edm/annotation/EdmEq.java       |   2 +-
 .../api/edm/annotation/EdmExpression.java       |  56 ++++
 .../commons/api/edm/annotation/EdmGe.java       |   2 +-
 .../commons/api/edm/annotation/EdmGt.java       |   2 +-
 .../commons/api/edm/annotation/EdmIf.java       |   8 +-
 .../commons/api/edm/annotation/EdmIsOf.java     |   4 +-
 .../api/edm/annotation/EdmLabeledElement.java   |   4 +-
 .../annotation/EdmLabeledElementReference.java  |   2 +-
 .../commons/api/edm/annotation/EdmLe.java       |   2 +-
 .../EdmLogicalOrComparisonExpression.java       |  37 +++
 .../commons/api/edm/annotation/EdmLt.java       |   2 +-
 .../annotation/EdmNavigationPropertyPath.java   |   2 +-
 .../commons/api/edm/annotation/EdmNe.java       |   2 +-
 .../commons/api/edm/annotation/EdmNot.java      |   9 +-
 .../commons/api/edm/annotation/EdmNull.java     |   2 +-
 .../commons/api/edm/annotation/EdmOr.java       |   2 +-
 .../commons/api/edm/annotation/EdmPath.java     |   2 +-
 .../api/edm/annotation/EdmPropertyPath.java     |   2 +-
 .../api/edm/annotation/EdmPropertyValue.java    |   4 +-
 .../commons/api/edm/annotation/EdmRecord.java   |   2 +-
 ...mTwoParamsOpDynamicAnnotationExpression.java |  37 ---
 .../commons/api/edm/annotation/EdmUrlRef.java   |   4 +-
 .../api/edm/provider/annotation/CsdlCast.java   |   6 +-
 .../annotation/CsdlConstantExpression.java      |  16 +-
 .../commons/core/edm/EdmAnnotationImpl.java     | 182 +----------
 ...mAnnotatableDynamicAnnotationExpression.java |  53 ----
 ...AbstractEdmAnnotatableDynamicExpression.java |  56 ++++
 .../AbstractEdmAnnotationExpression.java        |  46 ---
 .../AbstractEdmDynamicAnnotationExpression.java | 291 -----------------
 .../AbstractEdmDynamicExpression.java           | 295 +++++++++++++++++
 .../AbstractEdmElementOrAttributeNotation.java  |  35 ---
 .../edm/annotation/AbstractEdmExpression.java   | 154 +++++++++
 ...bstractEdmLogicalOrComparisonExpression.java |  70 +++++
 ...mTwoParamsOpDynamicAnnotationExpression.java |  48 ---
 .../commons/core/edm/annotation/EdmAndImpl.java |  15 +-
 .../edm/annotation/EdmAnnotationPathImpl.java   |  19 +-
 .../core/edm/annotation/EdmApplyImpl.java       |  43 ++-
 .../core/edm/annotation/EdmCastImpl.java        |  29 +-
 .../core/edm/annotation/EdmCollectionImpl.java  |  33 +-
 .../EdmConstantAnnotationExpressionImpl.java    | 153 ---------
 .../annotation/EdmConstantExpressionImpl.java   | 148 +++++++++
 .../commons/core/edm/annotation/EdmEqImpl.java  |  10 +-
 .../commons/core/edm/annotation/EdmGeImpl.java  |  14 +-
 .../commons/core/edm/annotation/EdmGtImpl.java  |  10 +-
 .../commons/core/edm/annotation/EdmIfImpl.java  |  51 +--
 .../core/edm/annotation/EdmIsOfImpl.java        |  25 +-
 .../edm/annotation/EdmLabeledElementImpl.java   |  35 ++-
 .../EdmLabeledElementReferenceImpl.java         |  20 +-
 .../commons/core/edm/annotation/EdmLeImpl.java  |  11 +-
 .../commons/core/edm/annotation/EdmLtImpl.java  |  10 +-
 .../EdmNavigationPropertyPathImpl.java          |  20 +-
 .../commons/core/edm/annotation/EdmNeImpl.java  |  10 +-
 .../commons/core/edm/annotation/EdmNotImpl.java |  18 +-
 .../core/edm/annotation/EdmNullImpl.java        |   9 +-
 .../commons/core/edm/annotation/EdmOrImpl.java  |  10 +-
 .../core/edm/annotation/EdmPathImpl.java        |  19 +-
 .../edm/annotation/EdmPropertyPathImpl.java     |  15 +-
 .../edm/annotation/EdmPropertyValueImpl.java    |  35 ++-
 .../core/edm/annotation/EdmRecordImpl.java      |  41 ++-
 .../core/edm/annotation/EdmUrlRefImpl.java      |  28 +-
 .../edm/annotations/AbstractAnnotationTest.java | 127 ++++++++
 .../edm/annotations/EdmAnnotationPathTest.java  |  56 ++++
 .../core/edm/annotations/EdmApplyImplTest.java  | 115 +++++++
 .../core/edm/annotations/EdmCastImplTest.java   | 107 +++++++
 .../edm/annotations/EdmCollectionImplTest.java  |  82 +++++
 .../EdmConstantExpressionImplTest.java          | 167 ++++++++++
 .../core/edm/annotations/EdmIfImplTest.java     | 104 ++++++
 .../core/edm/annotations/EdmIsOfImplTest.java   | 107 +++++++
 .../annotations/EdmLabeledElementImplTest.java  |  93 ++++++
 .../EdmLabledElementReferenceImplTest.java      |  54 ++++
 .../EdmLogicalOrComparisonImplTest.java         |  97 ++++++
 .../EdmNavigationPropertyPathImpTest.java       |  56 ++++
 .../core/edm/annotations/EdmPathImplTest.java   |  55 ++++
 .../annotations/EdmPropertyPathImplTest.java    |  56 ++++
 .../annotations/EdmPropertyValueImplTest.java   |  92 ++++++
 .../core/edm/annotations/EdmRecordImplTest.java | 158 ++++++++++
 .../core/edm/annotations/EdmUrlRefImplTest.java |  89 ++++++
 .../edm/provider/EdmAnnotationImplTest.java     |  82 +++++
 .../xml/MetadataDocumentXmlSerializer.java      |  15 +-
 91 files changed, 3273 insertions(+), 1490 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
index a6943d1..9ab0dcd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
@@ -35,8 +35,8 @@ public abstract class AbstractClientCsdlEdmDeserializer<T> extends JsonDeseriali
 
   protected CsdlConstantExpression parseAnnotationConstExprConstruct(final JsonParser jp)
       throws IOException {
-    final CsdlConstantExpression constExpr = new CsdlConstantExpression();
-    constExpr.setType(CsdlConstantExpression.ConstantExpressionType.fromString(jp.getCurrentName()));
+    final CsdlConstantExpression constExpr =
+        new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.fromString(jp.getCurrentName()));
     constExpr.setValue(jp.nextTextValue());
     return constExpr;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
index c9556ec..7ebeeee 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmAnnotation.java
@@ -18,7 +18,7 @@
  */
 package org.apache.olingo.commons.api.edm;
 
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 
 /**
  * This class models an OData Annotation which can be applied to a target. 
@@ -35,5 +35,5 @@ public interface EdmAnnotation extends EdmAnnotatable {
    */
   String getQualifier();
 
-  EdmAnnotationExpression getExpression();
+  EdmExpression getExpression();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
index e043556..cfdfb49 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnd.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a logical and annotation 
  */
-public interface EdmAnd extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmAnd extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
deleted file mode 100644
index 9da491d..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationExpression.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.edm.annotation;
-
-/**
- * Super type of all annotation expressions
- * A expression is either constant or dynamic
- */
-public interface EdmAnnotationExpression {
-
-  /**
-   * Return true if the expression is constant
-   * @return true if the expression is constant
-   */
-  boolean isConstant();
-  
-  /**
-   * Casts the expression to {@link EdmConstantAnnotationExpression}
-   * @return Constant Expression
-   */
-  EdmConstantAnnotationExpression asConstant();
-  
-  /**
-   * Return true if the expression is dynamic
-   * @return true if the expression is dynamic
-   */
-  boolean isDynamic();
-  
-  /**
-   * Cast the expression to {@link EdmDynamicAnnotationExpression}
-   * @return Dynamic Expression
-   */
-  EdmDynamicAnnotationExpression asDynamic();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
index 440b760..a75b780 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmAnnotationPath.java
@@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents an annotation path
  */
-public interface EdmAnnotationPath extends EdmDynamicAnnotationExpression {
+public interface EdmAnnotationPath extends EdmDynamicExpression {
   
   /**
    * Value of the path

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
index 4aa407d..d304fc3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmApply.java
@@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
 /**
  * Represents an Edm:Apply expression
  */
-public interface EdmApply extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmApply extends EdmDynamicExpression, EdmAnnotatable {
 
   /**
    * A QualifiedName specifying the name of the client-side function to apply.
@@ -45,5 +45,5 @@ public interface EdmApply extends EdmDynamicAnnotationExpression, EdmAnnotatable
    * Returns the expressions applied to the parameters of the function
    * @return List of expression
    */
-  List<EdmAnnotationExpression> getParameters();
+  List<EdmExpression> getParameters();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
index ca60746..7a1f109 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCast.java
@@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.edm.geo.SRID;
  * Represents an edm:Cast expression.
  * Casts the value obtained from its single child expression to the specified type
  */
-public interface EdmCast extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmCast extends EdmDynamicExpression, EdmAnnotatable {
   /**
    * Returns the facet attribute MaxLength
    * @return Returns the facet attribute MaxLength
@@ -61,5 +61,5 @@ public interface EdmCast extends EdmDynamicAnnotationExpression, EdmAnnotatable
    * Cast value of the expression
    * @return Cast value
    */
-  EdmDynamicAnnotationExpression getValue();
+  EdmExpression getValue();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
index 884d26b..c464562 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmCollection.java
@@ -25,11 +25,11 @@ import java.util.List;
  * The value calculated by the collection expression is the collection of the values calculated 
  * by each of the child expressions.
  */
-public interface EdmCollection extends EdmDynamicAnnotationExpression {
+public interface EdmCollection extends EdmDynamicExpression {
 
   /**
    * Returns a list of child expression
    * @return List of child expression
    */
-  List<EdmAnnotationExpression> getItems();
+  List<EdmExpression> getItems();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java
deleted file mode 100644
index 7609e35..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantAnnotationExpression.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.edm.annotation;
-
-import org.apache.olingo.commons.api.data.Valuable;
-
-/**
- * Represents a constant expression
- */
-public interface EdmConstantAnnotationExpression extends EdmAnnotationExpression {
-  
-  /**
-   * Value of the constant expression
-   * @return value of the constant expression
-   */
-  Valuable getValue();
-
-  /**
-   * Returns the value of the expression as String
-   * @return String representation of the expression
-   */
-  String getValueAsString();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java
new file mode 100644
index 0000000..fd2031f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmConstantExpression.java
@@ -0,0 +1,40 @@
+/*
+ * 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.edm.annotation;
+
+import org.apache.olingo.commons.api.data.Valuable;
+
+/**
+ * Represents a constant expression
+ */
+public interface EdmConstantExpression extends EdmExpression {
+  
+  /**
+   * Value of the constant expression
+   * @return value of the constant expression
+   */
+  //TODO: Delete data package dependency
+  Valuable getValue();
+
+  /**
+   * Returns the value of the expression as String
+   * @return String representation of the expression
+   */
+  String getValueAsString();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java
deleted file mode 100644
index 9905a80..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * 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.edm.annotation;
-
-/**
- * Represents a dynamic expression
- */
-public interface EdmDynamicAnnotationExpression extends EdmAnnotationExpression {
-  
-  /**
-   * Returns true if the expression is a logical edm:Not expression
-   * @return  true if the expression is a logical edm:Not expression
-   */
-  boolean isNot();
-  
-  /**
-   * Casts the expression to a {@link EdmNot} expression
-   * @return EdmNot expression
-   */
-  EdmNot asNot();
-
-  /**
-   * Returns true if the expression is a logical edm:And expression
-   * @return  true if the expression is a logical edm:And expression
-   */
-  boolean isAnd();
-  
-  /**
-   * Casts the expression to a {@link EdmAnd} expression
-   * @return EdmAnd expression
-   */
-  EdmAnd asAnd();
-  
-  /**
-   * Returns true if the expression is a logical edm:Or expression
-   * @return  true if the expression is a logical edm:Or expression
-   */
-  boolean isOr();
-  
-  /**
-   * Casts the expression to a {@link EdmOr} expression
-   * @return EdmOr expression
-   */
-  EdmOr asOr();
-  
-  /**
-   * Returns true if the expression is a edm:Eq expression
-   * @return  true if the expression is a edm:Eq expression
-   */
-  boolean isEq();
-
-  /**
-   * Casts the expression to a {@link EdmEq} expression
-   * @return EdmEq expression
-   */
-  EdmEq asEq();
-  
-  /**
-   * Returns true if the expression is a edm:Ne expression
-   * @return  true if the expression is a edm:Ne expression
-   */
-  boolean isNe();
-  
-  /**
-   * Casts the expression to a {@link EdmNe} expression
-   * @return EdmNe expression
-   */
-  EdmNe asNe();
-  
-  /**
-   * Returns true if the expression is a edm:Gt expression
-   * @return  true if the expression is a edm:Gt expression
-   */
-  boolean isGt();
-  
-  /**
-   * Casts the expression to a {@link EdmGt} expression
-   * @return EdmGt expression
-   */
-  EdmGt asGt();
-  
-  /**
-   * Returns true if the expression is a edm:Ge expression
-   * @return  true if the expression is a edm:Ge expression
-   */
-  boolean isGe();
-  
-  /**
-   * Casts the expression to a {@link EdmGe} expression
-   * @return EdmGe expression
-   */
-  EdmGe asGe();
-  
-  /**
-   * Returns true if the expression is a edm:Lt expression
-   * @return  true if the expression is a edm:Lt expression
-   */
-  boolean isLt();
-  
-  /**
-   * Casts the expression to a {@link EdmLt} expression
-   * @return EdmLt expression
-   */
-  EdmLt asLt();
-  
-  /**
-   * Returns true if the expression is a edm:Le expression
-   * @return  true if the expression is a edm:Le expression
-   */
-  boolean isLe();
-  
-  /**
-   * Casts the expression to a {@link EdmLe} expression
-   * @return EdmLe expression
-   */
-  EdmLe asLe();
-  
-  /**
-   * Returns true if the expression is a edm:AnnotationPath expression
-   * @return  true if the expression is a edm:AnnotationPath expression
-   */
-  boolean isAnnotationPath();
-  
-  /**
-   * Casts the expression to a {@link EdmAnnotationPath} expression
-   * @return EdmAnnotationPath expression
-   */
-  EdmAnnotationPath asAnnotationPath();
-  
-  /**
-   * Returns true if the expression is a edm:Apply expression
-   * @return  true if the expression is a edm:Apply expression
-   */
-  boolean isApply();
-  
-  /**
-   * Casts the expression to a {@link EdmApply} expression
-   * @return EdmApply expression
-   */
-  EdmApply asApply();
-  
-  /**
-   * Returns true if the expression is a edm:Cast expression
-   * @return  true if the expression is a edm:Cast expression
-   */
-  boolean isCast();
-  
-  /**
-   * Casts the expression to a {@link EdmCast} expression
-   * @return EdmCast expression
-   */
-  EdmCast asCast();
-  
-  /**
-   * Returns true if the expression is a edm:Collection expression
-   * @return  true if the expression is a edm:Collection expression
-   */
-  boolean isCollection();
-  
-  /**
-   * Casts the expression to a {@link EdmCollection} expression
-   * @return EdmCollection expression
-   */
-  EdmCollection asCollection();
-  
-  /**
-   * Returns true if the expression is a edm:If expression
-   * @return  true if the expression is a edm:If expression
-   */
-  boolean isIf();
-  
-  /**
-   * Casts the expression to a {@link EdmIf} expression
-   * @return EdmIf expression
-   */
-  EdmIf asIf();
-  
-  /**
-   * Returns true if the expression is a edm:IsOf expression
-   * @return  true if the expression is a edm:IsOf expression
-   */
-  boolean isIsOf();
-  
-  /**
-   * Casts the expression to a {@link EdmIsOf} expression
-   * @return EdmIsOf expression
-   */
-  EdmIsOf asIsOf();
-  
-  /**
-   * Returns true if the expression is a edm:LabeledElement expression
-   * @return  true if the expression is a edm:LabeledElement expression
-   */
-  boolean isLabeledElement();
-  
-  /**
-   * Casts the expression to a {@link EdmLabeledElement} expression
-   * @return EdmLabeledElement expression
-   */
-  EdmLabeledElement asLabeledElement();
-  
-  /**
-   * Returns true if the expression is a edm:LabeledElementReference expression
-   * @return  true if the expression is a edm:LabeledElementReference expression
-   */
-  boolean isLabeledElementReference();
-  
-  /**
-   * Casts the expression to a {@link EdmLabeledElementReference} expression
-   * @return EdmLabeledElementReference expression
-   */
-  EdmLabeledElementReference asLabeledElementReference();
-  
-  /**
-   * Returns true if the expression is a edm:Null expression
-   * @return  true if the expression is a edm:Null expression
-   */
-  boolean isNull();
-  
-  /**
-   * Casts the expression to a {@link EdmNull} expression
-   * @return EdmNull expression
-   */
-  EdmNull asNull();
-  
-  /**
-   * Returns true if the expression is a edm:NavigationPropertyPath expression
-   * @return  true if the expression is a edm:NavigationPropertyPath expression
-   */
-  boolean isNavigationPropertyPath();
-
-  /**
-   * Casts the expression to a {@link EdmNavigationPropertyPath} expression
-   * @return EdmNavigationPropertyPath expression
-   */
-  EdmNavigationPropertyPath asNavigationPropertyPath();
-  
-  /**
-   * Returns true if the expression is a edm:Path expression
-   * @return  true if the expression is a edm:Path expression
-   */
-  boolean isPath();
-  
-  /**
-   * Casts the expression to a {@link EdmPath} expression
-   * @return EdmPath expression
-   */
-  EdmPath asPath();
-  
-  /**
-   * Returns true if the expression is a edm:PropertyPath expression
-   * @return  true if the expression is a edm:PropertyPath expression
-   */
-  boolean isPropertyPath();
-
-  /**
-   * Casts the expression to a {@link EdmPropertyPath} expression
-   * @return EdmPropertyPath expression
-   */
-  EdmPropertyPath asPropertyPath();
-  
-  /**
-   * Returns true if the expression is a edm:PropertyValue expression
-   * @return  true if the expression is a edm:PropertyValue expression
-   */
-  boolean isPropertyValue();
-  
-  /**
-   * Casts the expression to a {@link EdmPropertyValue} expression
-   * @return EdmPropertyValue expression
-   */
-  EdmPropertyValue asPropertyValue();
-  
-  /**
-   * Returns true if the expression is a edm:Record expression
-   * @return  true if the expression is a edm:Record expression
-   */
-  boolean isRecord();
-  
-  /**
-   * Casts the expression to a {@link EdmRecord} expression
-   * @return EdmRecord expression
-   */
-  EdmRecord asRecord();
-  
-  /**
-   * Returns true if the expression is a edm:UrlRef expression
-   * @return  true if the expression is a edm:UrlRef expression
-   */
-  boolean isUrlRef();
-
-  /**
-   * Casts the expression to a {@link EdmUrlRef} expression
-   * @return EdmUrlRef expression
-   */
-  EdmUrlRef asUrlRef();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java
new file mode 100644
index 0000000..8889029
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmDynamicExpression.java
@@ -0,0 +1,313 @@
+/*
+ * 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.edm.annotation;
+
+/**
+ * Represents a dynamic expression
+ */
+public interface EdmDynamicExpression extends EdmExpression {
+  
+  /**
+   * Returns true if the expression is a logical edm:Not expression
+   * @return  true if the expression is a logical edm:Not expression
+   */
+  boolean isNot();
+  
+  /**
+   * Casts the expression to a {@link EdmNot} expression
+   * @return EdmNot expression
+   */
+  EdmNot asNot();
+
+  /**
+   * Returns true if the expression is a logical edm:And expression
+   * @return  true if the expression is a logical edm:And expression
+   */
+  boolean isAnd();
+  
+  /**
+   * Casts the expression to a {@link EdmAnd} expression
+   * @return EdmAnd expression
+   */
+  EdmAnd asAnd();
+  
+  /**
+   * Returns true if the expression is a logical edm:Or expression
+   * @return  true if the expression is a logical edm:Or expression
+   */
+  boolean isOr();
+  
+  /**
+   * Casts the expression to a {@link EdmOr} expression
+   * @return EdmOr expression
+   */
+  EdmOr asOr();
+  
+  /**
+   * Returns true if the expression is a edm:Eq expression
+   * @return  true if the expression is a edm:Eq expression
+   */
+  boolean isEq();
+
+  /**
+   * Casts the expression to a {@link EdmEq} expression
+   * @return EdmEq expression
+   */
+  EdmEq asEq();
+  
+  /**
+   * Returns true if the expression is a edm:Ne expression
+   * @return  true if the expression is a edm:Ne expression
+   */
+  boolean isNe();
+  
+  /**
+   * Casts the expression to a {@link EdmNe} expression
+   * @return EdmNe expression
+   */
+  EdmNe asNe();
+  
+  /**
+   * Returns true if the expression is a edm:Gt expression
+   * @return  true if the expression is a edm:Gt expression
+   */
+  boolean isGt();
+  
+  /**
+   * Casts the expression to a {@link EdmGt} expression
+   * @return EdmGt expression
+   */
+  EdmGt asGt();
+  
+  /**
+   * Returns true if the expression is a edm:Ge expression
+   * @return  true if the expression is a edm:Ge expression
+   */
+  boolean isGe();
+  
+  /**
+   * Casts the expression to a {@link EdmGe} expression
+   * @return EdmGe expression
+   */
+  EdmGe asGe();
+  
+  /**
+   * Returns true if the expression is a edm:Lt expression
+   * @return  true if the expression is a edm:Lt expression
+   */
+  boolean isLt();
+  
+  /**
+   * Casts the expression to a {@link EdmLt} expression
+   * @return EdmLt expression
+   */
+  EdmLt asLt();
+  
+  /**
+   * Returns true if the expression is a edm:Le expression
+   * @return  true if the expression is a edm:Le expression
+   */
+  boolean isLe();
+  
+  /**
+   * Casts the expression to a {@link EdmLe} expression
+   * @return EdmLe expression
+   */
+  EdmLe asLe();
+  
+  /**
+   * Returns true if the expression is a edm:AnnotationPath expression
+   * @return  true if the expression is a edm:AnnotationPath expression
+   */
+  boolean isAnnotationPath();
+  
+  /**
+   * Casts the expression to a {@link EdmAnnotationPath} expression
+   * @return EdmAnnotationPath expression
+   */
+  EdmAnnotationPath asAnnotationPath();
+  
+  /**
+   * Returns true if the expression is a edm:Apply expression
+   * @return  true if the expression is a edm:Apply expression
+   */
+  boolean isApply();
+  
+  /**
+   * Casts the expression to a {@link EdmApply} expression
+   * @return EdmApply expression
+   */
+  EdmApply asApply();
+  
+  /**
+   * Returns true if the expression is a edm:Cast expression
+   * @return  true if the expression is a edm:Cast expression
+   */
+  boolean isCast();
+  
+  /**
+   * Casts the expression to a {@link EdmCast} expression
+   * @return EdmCast expression
+   */
+  EdmCast asCast();
+  
+  /**
+   * Returns true if the expression is a edm:Collection expression
+   * @return  true if the expression is a edm:Collection expression
+   */
+  boolean isCollection();
+  
+  /**
+   * Casts the expression to a {@link EdmCollection} expression
+   * @return EdmCollection expression
+   */
+  EdmCollection asCollection();
+  
+  /**
+   * Returns true if the expression is a edm:If expression
+   * @return  true if the expression is a edm:If expression
+   */
+  boolean isIf();
+  
+  /**
+   * Casts the expression to a {@link EdmIf} expression
+   * @return EdmIf expression
+   */
+  EdmIf asIf();
+  
+  /**
+   * Returns true if the expression is a edm:IsOf expression
+   * @return  true if the expression is a edm:IsOf expression
+   */
+  boolean isIsOf();
+  
+  /**
+   * Casts the expression to a {@link EdmIsOf} expression
+   * @return EdmIsOf expression
+   */
+  EdmIsOf asIsOf();
+  
+  /**
+   * Returns true if the expression is a edm:LabeledElement expression
+   * @return  true if the expression is a edm:LabeledElement expression
+   */
+  boolean isLabeledElement();
+  
+  /**
+   * Casts the expression to a {@link EdmLabeledElement} expression
+   * @return EdmLabeledElement expression
+   */
+  EdmLabeledElement asLabeledElement();
+  
+  /**
+   * Returns true if the expression is a edm:LabeledElementReference expression
+   * @return  true if the expression is a edm:LabeledElementReference expression
+   */
+  boolean isLabeledElementReference();
+  
+  /**
+   * Casts the expression to a {@link EdmLabeledElementReference} expression
+   * @return EdmLabeledElementReference expression
+   */
+  EdmLabeledElementReference asLabeledElementReference();
+  
+  /**
+   * Returns true if the expression is a edm:Null expression
+   * @return  true if the expression is a edm:Null expression
+   */
+  boolean isNull();
+  
+  /**
+   * Casts the expression to a {@link EdmNull} expression
+   * @return EdmNull expression
+   */
+  EdmNull asNull();
+  
+  /**
+   * Returns true if the expression is a edm:NavigationPropertyPath expression
+   * @return  true if the expression is a edm:NavigationPropertyPath expression
+   */
+  boolean isNavigationPropertyPath();
+
+  /**
+   * Casts the expression to a {@link EdmNavigationPropertyPath} expression
+   * @return EdmNavigationPropertyPath expression
+   */
+  EdmNavigationPropertyPath asNavigationPropertyPath();
+  
+  /**
+   * Returns true if the expression is a edm:Path expression
+   * @return  true if the expression is a edm:Path expression
+   */
+  boolean isPath();
+  
+  /**
+   * Casts the expression to a {@link EdmPath} expression
+   * @return EdmPath expression
+   */
+  EdmPath asPath();
+  
+  /**
+   * Returns true if the expression is a edm:PropertyPath expression
+   * @return  true if the expression is a edm:PropertyPath expression
+   */
+  boolean isPropertyPath();
+
+  /**
+   * Casts the expression to a {@link EdmPropertyPath} expression
+   * @return EdmPropertyPath expression
+   */
+  EdmPropertyPath asPropertyPath();
+  
+  /**
+   * Returns true if the expression is a edm:PropertyValue expression
+   * @return  true if the expression is a edm:PropertyValue expression
+   */
+  boolean isPropertyValue();
+  
+  /**
+   * Casts the expression to a {@link EdmPropertyValue} expression
+   * @return EdmPropertyValue expression
+   */
+  EdmPropertyValue asPropertyValue();
+  
+  /**
+   * Returns true if the expression is a edm:Record expression
+   * @return  true if the expression is a edm:Record expression
+   */
+  boolean isRecord();
+  
+  /**
+   * Casts the expression to a {@link EdmRecord} expression
+   * @return EdmRecord expression
+   */
+  EdmRecord asRecord();
+  
+  /**
+   * Returns true if the expression is a edm:UrlRef expression
+   * @return  true if the expression is a edm:UrlRef expression
+   */
+  boolean isUrlRef();
+
+  /**
+   * Casts the expression to a {@link EdmUrlRef} expression
+   * @return EdmUrlRef expression
+   */
+  EdmUrlRef asUrlRef();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
index bd95549..b36c852 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmEq.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a edm:Eq expression
  */
-public interface EdmEq extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmEq extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java
new file mode 100644
index 0000000..3f89b6f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmExpression.java
@@ -0,0 +1,56 @@
+/*
+ * 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.edm.annotation;
+
+/**
+ * Super type of all annotation expressions
+ * A expression is either constant or dynamic
+ */
+public interface EdmExpression {
+
+  /**
+   * Will return the name of the expression e.g. Apply or Cast.
+   * @return the name of the expression
+   */
+  String getExpressionName();
+
+  /**
+   * Return true if the expression is constant
+   * @return true if the expression is constant
+   */
+  boolean isConstant();
+  
+  /**
+   * Casts the expression to {@link EdmConstantExpression}
+   * @return Constant Expression
+   */
+  EdmConstantExpression asConstant();
+  
+  /**
+   * Return true if the expression is dynamic
+   * @return true if the expression is dynamic
+   */
+  boolean isDynamic();
+  
+  /**
+   * Cast the expression to {@link EdmDynamicExpression}
+   * @return Dynamic Expression
+   */
+  EdmDynamicExpression asDynamic();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
index dcdd2df..a15c6c3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGe.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a edm:Ge expression
  */
-public interface EdmGe extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmGe extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
index 0f49444..76e68d5 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmGt.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a edm:Gt expression
  */
-public interface EdmGt extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmGt extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
index 144397e..b7427f6 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIf.java
@@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
 /**
  * Represents a edm:If expression
  */
-public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmIf extends EdmDynamicExpression, EdmAnnotatable {
   
   /**
    * Returns the first expression of the edm:If expression.
@@ -31,7 +31,7 @@ public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
    * 
    * @return First expression of the if expression
    */
-  EdmAnnotationExpression getGuard();
+  EdmExpression getGuard();
   
   /**
    * Return the second expression of the edm:If expression.
@@ -40,7 +40,7 @@ public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
    * 
    * @return Second Expression of the edm:If expression
    */
-  EdmAnnotationExpression getThen();
+  EdmExpression getThen();
 
   /**
    * Return the third expression of the edm:If expression.
@@ -49,5 +49,5 @@ public interface EdmIf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
    * 
    * @return Third Expression of the edm:If expression
    */
-  EdmAnnotationExpression getElse();
+  EdmExpression getElse();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
index 54b600d..4df8f9f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmIsOf.java
@@ -26,7 +26,7 @@ import org.apache.olingo.commons.api.edm.geo.SRID;
  *  The edm:IsOf expression evaluates a child expression and returns a Boolean value indicating whether 
  *  the child expression returns the specified type
  */
-public interface EdmIsOf extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmIsOf extends EdmDynamicExpression, EdmAnnotatable {
  
   /**
    * Facet MaxLength
@@ -62,5 +62,5 @@ public interface EdmIsOf extends EdmDynamicAnnotationExpression, EdmAnnotatable
    * Returns true if the child expression returns the specified typed 
    * @return Returns true if the child expression returns the specified typed 
    */
-  EdmDynamicAnnotationExpression getValue();
+  EdmExpression getValue();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
index 9173b13..e772581 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElement.java
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
  * The edm:LabeledElement expression assigns a name to a child expression. The value of the child expression can 
  * then be reused elsewhere with an edm:LabeledElementReference (See {@link EdmLabeledElementReference}) expression.
  */
-public interface EdmLabeledElement extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmLabeledElement extends EdmDynamicExpression, EdmAnnotatable {
   
   /**
    * Returns the assigned name
@@ -37,5 +37,5 @@ public interface EdmLabeledElement extends EdmDynamicAnnotationExpression, EdmAn
    * 
    * @return child expression
    */
-  EdmDynamicAnnotationExpression getValue();
+  EdmExpression getValue();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
index 0bddf23..9358aed 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLabeledElementReference.java
@@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.edm.annotation;
  *  The edm:LabeledElementReference expression returns the value of an 
  *  edm:LabeledElement (see {@link EdmLabeledElement}) expression.
  */
-public interface EdmLabeledElementReference extends EdmDynamicAnnotationExpression {
+public interface EdmLabeledElementReference extends EdmDynamicExpression {
   
   /**
    * Returns the value of the edm:LabeledElement expression

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
index 18e8b4f..b258e23 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLe.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a edm:Le expression
  */
-public interface EdmLe extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmLe extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.java
new file mode 100644
index 0000000..4db2eab
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLogicalOrComparisonExpression.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.edm.annotation;
+
+/**
+ * Represents a generic expression with two child exprssions
+ */
+public interface EdmLogicalOrComparisonExpression extends EdmDynamicExpression {
+
+  /**
+   * Returns the first expression (left child)
+   * @return Child expression
+   */
+  EdmExpression getLeftExpression();
+  
+  /**
+   * Returns the second expression (right child)
+   * @return Child expression
+   */
+  EdmExpression getRightExpression();
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
index 392adc8..e59875f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmLt.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a edm:Lt expression
  */
-public interface EdmLt extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmLt extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
index e1d335f..cd3a2df 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNavigationPropertyPath.java
@@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.edm.annotation;
  * The edm:NavigationPropertyPath expression provides a value for terms or term properties that specify the 
  * built-in abstract type Edm.NavigationPropertyPath
  */
-public interface EdmNavigationPropertyPath extends EdmDynamicAnnotationExpression {
+public interface EdmNavigationPropertyPath extends EdmDynamicExpression {
   /**
    * Returns the navigation property path itself.
    * 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
index b7848c8..73252f3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNe.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a edm:Ne expression
  */
-public interface EdmNe extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmNe extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
index 7c302f4..f56b1cd 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNot.java
@@ -21,11 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a logical edm:Le expression
  */
-public interface EdmNot extends EdmDynamicAnnotationExpression {
-  
-  /**
-   * Returns an expression which should be inverted
-   * @return the expression which must be inverted
-   */
-  EdmAnnotationExpression getExpression();
+public interface EdmNot extends EdmLogicalOrComparisonExpression {
+//No additional methods needed.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
index a94c3f4..62749e8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmNull.java
@@ -23,6 +23,6 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
 /**
  * The edm:Null expression returns an untyped null value.
  */
-public interface EdmNull extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmNull extends EdmDynamicExpression, EdmAnnotatable {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
index 75b4639..1b0668f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmOr.java
@@ -21,6 +21,6 @@ package org.apache.olingo.commons.api.edm.annotation;
 /**
  * Represents a logical edm:And expression
  */
-public interface EdmOr extends EdmTwoParamsOpDynamicAnnotationExpression {
+public interface EdmOr extends EdmLogicalOrComparisonExpression {
   // No additional methods needed for now.
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
index f41dc04..847b5bd 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPath.java
@@ -23,7 +23,7 @@ package org.apache.olingo.commons.api.edm.annotation;
  *  It can be used in annotations that target entity containers, entity sets, entity types, complex types, 
  *  navigation properties of structured types, and properties of structured types.
  */
-public interface EdmPath extends EdmDynamicAnnotationExpression {
+public interface EdmPath extends EdmDynamicExpression {
   
   /**
    * Returns the target value of the expression

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
index f0c5efe..a683823 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyPath.java
@@ -22,7 +22,7 @@ package org.apache.olingo.commons.api.edm.annotation;
  * The edm:PropertyPath expression provides a value for terms or term properties that specify the built-in 
  * abstract type Edm.PropertyPath.
  */
-public interface EdmPropertyPath extends EdmDynamicAnnotationExpression {
+public interface EdmPropertyPath extends EdmDynamicExpression {
   
   /**
    * Returns the property path itself.

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
index 240370a..667f849 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmPropertyValue.java
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
  * The edm:PropertyValue element supplies a value to a property on the type instantiated by an 
  * edm:Record expression (See {@link EdmRecord}). The value is obtained by evaluating an expression.
  */
-public interface EdmPropertyValue extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmPropertyValue extends EdmDynamicExpression, EdmAnnotatable {
   /**
    * Property name
    * @return Property name
@@ -35,6 +35,6 @@ public interface EdmPropertyValue extends EdmDynamicAnnotationExpression, EdmAnn
    * Evaluated value of the expression (property value)
    * @return evaluated value of the expression
    */
-  EdmAnnotationExpression getValue();
+  EdmExpression getValue();
 
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
index 4389a07..7abd08a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmRecord.java
@@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType;
  * The edm:Record expression enables a new entity type or complex type instance to be constructed.
  * A record expression contains zero or more edm:PropertyValue (See {@link EdmPropertyValue} )elements.
  */
-public interface EdmRecord extends EdmDynamicAnnotationExpression, EdmAnnotatable {
+public interface EdmRecord extends EdmDynamicExpression, EdmAnnotatable {
   
   /**
    * List of edm:PropertyValues (See {@link EdmPropertyValue}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java
deleted file mode 100644
index 5fc5edf..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmTwoParamsOpDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.edm.annotation;
-
-/**
- * Represents a generic expression with two child exprssions
- */
-public interface EdmTwoParamsOpDynamicAnnotationExpression extends EdmDynamicAnnotationExpression {
-
-  /**
-   * Returns the first expression (left child)
-   * @return Child expression
-   */
-  EdmAnnotationExpression getLeftExpression();
-  
-  /**
-   * Returns the second expression (right child)
-   * @return Child expression
-   */
-  EdmAnnotationExpression getRightExpression();
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
index 613c2e1..1fbc63a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/annotation/EdmUrlRef.java
@@ -22,11 +22,11 @@ package org.apache.olingo.commons.api.edm.annotation;
  * The edm:UrlRef expression enables a value to be obtained by sending a GET request to the value of 
  * the UrlRef expression. 
  */
-public interface EdmUrlRef extends EdmDynamicAnnotationExpression {
+public interface EdmUrlRef extends EdmDynamicExpression {
   
   /**
    * Returns a expression of type Edm.String
    * @return expression of type Edm.String
    */
-  EdmAnnotationExpression getValue();
+  EdmExpression getValue();
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
index a2dc7e7..2545f3f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlCast.java
@@ -37,7 +37,7 @@ public class CsdlCast extends CsdlDynamicExpression implements CsdlAnnotatable{
   private Integer precision;
   private Integer scale;
   private SRID srid;
-  private CsdlDynamicExpression value;
+  private CsdlExpression value;
   private List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>();
 
   @Override
@@ -114,11 +114,11 @@ public class CsdlCast extends CsdlDynamicExpression implements CsdlAnnotatable{
    * Cast value of the expression
    * @return Cast value
    */
-  public CsdlDynamicExpression getValue() {
+  public CsdlExpression getValue() {
     return value;
   }
 
-  public void setValue(final CsdlDynamicExpression value) {
+  public void setValue(final CsdlExpression value) {
     this.value = value;
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
index 8e8d5cd..c860598 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/annotation/CsdlConstantExpression.java
@@ -23,7 +23,7 @@ public class CsdlConstantExpression extends CsdlExpression {
 
   private static final long serialVersionUID = 5618680702707972904L;
 
-  private ConstantExpressionType type;
+  private final ConstantExpressionType type;
   private String value;
 
   /**
@@ -96,7 +96,9 @@ public class CsdlConstantExpression extends CsdlExpression {
     }
   }
 
-  public CsdlConstantExpression() {}
+  public CsdlConstantExpression(ConstantExpressionType type) {
+    this.type = type;
+  }
 
   public CsdlConstantExpression(ConstantExpressionType type, String value) {
     this.type = type;
@@ -112,16 +114,6 @@ public class CsdlConstantExpression extends CsdlExpression {
   }
 
   /**
-   * Sets the type of the constant expression
-   * @param type type of the constant expression
-   * @return this for method chaining
-   */
-  public CsdlConstantExpression setType(final ConstantExpressionType type) {
-    this.type = type;
-    return this;
-  }
-
-  /**
    * Value of the constant expression
    * @return value of the constant expression as String
    */

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
index 53fbfde..09bfefd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
@@ -18,53 +18,20 @@
  */
 package org.apache.olingo.commons.core.edm;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotatable;
 import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmException;
 import org.apache.olingo.commons.api.edm.EdmTerm;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
+import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlDynamicExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.CsdlPropertyValue;
-import org.apache.olingo.commons.core.edm.annotation.EdmAndImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmAnnotationPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmApplyImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmCastImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmCollectionImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmConstantAnnotationExpressionImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmEqImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmGeImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmGtImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmIfImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmIsOfImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLabeledElementImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLabeledElementReferenceImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLeImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmLtImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNavigationPropertyPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNeImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNotImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmNullImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmOrImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmPropertyPathImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmPropertyValueImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmRecordImpl;
-import org.apache.olingo.commons.core.edm.annotation.EdmUrlRefImpl;
+import org.apache.olingo.commons.core.edm.annotation.AbstractEdmExpression;
 
 public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnnotation {
 
   private final CsdlAnnotation annotation;
   private EdmTerm term;
-  private EdmAnnotationExpression expression;
+  private EdmExpression expression;
 
   public EdmAnnotationImpl(final Edm edm, final CsdlAnnotation annotation) {
     super(edm, annotation);
@@ -74,6 +41,9 @@ public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnno
   @Override
   public EdmTerm getTerm() {
     if (term == null) {
+      if (annotation.getTerm() == null) {
+        throw new EdmException("Term must not be null for an annotation.");
+      }
       term = edm.getTerm(new FullQualifiedName(annotation.getTerm()));
     }
     return term;
@@ -84,142 +54,14 @@ public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnno
     return annotation.getQualifier();
   }
 
-  private EdmAnnotationExpression getExpression(final CsdlExpression exp) {
-    EdmAnnotationExpression _expression = null;
-
-    if (exp.isConstant()) {
-      _expression = new EdmConstantAnnotationExpressionImpl(exp.asConstant());
-    } else if (annotation.getExpression().isDynamic()) {
-      _expression = getDynamicExpression(exp.asDynamic());
-    }
-
-    return _expression;
-  }
-
-  private EdmDynamicAnnotationExpression getDynamicExpression(final CsdlDynamicExpression exp) {
-    EdmDynamicAnnotationExpression _expression = null;
-
-    if (exp.isLogicalOrComparison()) {
-      switch (exp.asLogicalOrComparison().getType()) {
-      case Not:
-        _expression = new EdmNotImpl(getExpression(exp.asLogicalOrComparison().getLeft()));
-        break;
-      case And:
-        _expression = new EdmAndImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Or:
-        _expression = new EdmOrImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Eq:
-        _expression = new EdmEqImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Ne:
-        _expression = new EdmNeImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Ge:
-        _expression = new EdmGeImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Gt:
-        _expression = new EdmGtImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Le:
-        _expression = new EdmLeImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      case Lt:
-        _expression = new EdmLtImpl(
-            getExpression(exp.asLogicalOrComparison().getLeft()),
-            getExpression(exp.asLogicalOrComparison().getRight()));
-        break;
-
-      default:
-      }
-    } else if (exp.isAnnotationPath()) {
-      _expression = new EdmAnnotationPathImpl(exp.asAnnotationPath().getValue());
-    } else if (exp.isApply()) {
-      final List<EdmAnnotationExpression> parameters =
-          new ArrayList<EdmAnnotationExpression>(exp.asApply().getParameters().size());
-      for (CsdlExpression param : exp.asApply().getParameters()) {
-        parameters.add(getExpression(param));
-      }
-      _expression = new EdmApplyImpl(exp.asApply().getFunction(), parameters);
-    } else if (exp.isCast()) {
-      _expression = new EdmCastImpl(edm, exp.asCast(), getDynamicExpression(exp.asCast().getValue()));
-    } else if (exp.isCollection()) {
-      final List<EdmAnnotationExpression> items =
-          new ArrayList<EdmAnnotationExpression>(exp.asCollection().getItems().size());
-      for (CsdlExpression param : exp.asCollection().getItems()) {
-        items.add(getExpression(param));
-      }
-      _expression = new EdmCollectionImpl(items);
-    } else if (exp.isIf()) {
-      _expression = new EdmIfImpl(
-          getExpression(exp.asIf().getGuard()),
-          getExpression(exp.asIf().getThen()),
-          getExpression(exp.asIf().getElse()));
-    } else if (exp.isIsOf()) {
-      _expression = new EdmIsOfImpl(edm, exp.asIsOf(), getDynamicExpression(exp.asIsOf().getValue().asDynamic()));
-    } else if (exp.isLabeledElement()) {
-      _expression = new EdmLabeledElementImpl(
-          exp.asLabeledElement().getName(), getDynamicExpression(exp.asLabeledElement().getValue().asDynamic()));
-    } else if (exp.isLabeledElementReference()) {
-      _expression = new EdmLabeledElementReferenceImpl(exp.asLabeledElementReference().getValue());
-    } else if (exp.isNull()) {
-      _expression = new EdmNullImpl();
-    } else if (exp.isNavigationPropertyPath()) {
-      _expression = new EdmNavigationPropertyPathImpl(exp.asNavigationPropertyPath().getValue());
-    } else if (exp.isPath()) {
-      _expression = new EdmPathImpl(exp.asPath().getValue());
-    } else if (exp.isPropertyPath()) {
-      _expression = new EdmPropertyPathImpl(exp.asPropertyPath().getValue());
-    } else if (exp.isPropertyValue()) {
-      _expression = new EdmPropertyValueImpl(
-          exp.asPropertyValue().getProperty(), getExpression(exp.asPropertyValue().getValue()));
-    } else if (exp.isRecord()) {
-      final List<EdmPropertyValue> propertyValues =
-          new ArrayList<EdmPropertyValue>(exp.asRecord().getPropertyValues().size());
-      for (CsdlPropertyValue propertyValue : exp.asRecord().getPropertyValues()) {
-        propertyValues.add(new EdmPropertyValueImpl(
-            propertyValue.getProperty(), getExpression(propertyValue.getValue())));
-      }
-      _expression = new EdmRecordImpl(edm, exp.asRecord().getType(), propertyValues);
-    } else if (exp.isUrlRef()) {
-      _expression = new EdmUrlRefImpl(getExpression(exp.asUrlRef().getValue()));
-    }
-
-    if (_expression instanceof EdmAnnotatable && exp instanceof CsdlAnnotatable) {
-      for (CsdlAnnotation _annotation : ((CsdlAnnotatable) exp).getAnnotations()) {
-        ((EdmAnnotatable) _expression).getAnnotations().add(new EdmAnnotationImpl(edm, _annotation));
-      }
-    }
-
-    return _expression;
-  }
+ 
 
   @Override
-  public EdmAnnotationExpression getExpression() {
+  public EdmExpression getExpression() {
     if (expression == null) {
-      expression = getExpression(annotation.getExpression());
+      if (annotation.getExpression() != null) {
+        expression = AbstractEdmExpression.getExpression(edm, annotation.getExpression());
+      }
     }
     return expression;
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java
deleted file mode 100644
index 4011fa2..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.edm.annotation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAnnotatable;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-
-public abstract class AbstractEdmAnnotatableDynamicAnnotationExpression
-extends AbstractEdmDynamicAnnotationExpression implements EdmAnnotatable {
-
-  private final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
-
-  //TODO: Can we derive this method from AbstractEdmAnnotatable?
-  @Override
-  public EdmAnnotation getAnnotation(final EdmTerm term, String qualifier) {
-    EdmAnnotation result = null;
-    for (EdmAnnotation annotation : getAnnotations()) {
-      if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
-        if (qualifier == annotation.getQualifier()
-            || (qualifier != null && qualifier.equals(annotation.getQualifier()))) {
-          result = annotation;
-          break;
-        }
-      }
-    }
-    return result;
-  }
-
-  @Override
-  public List<EdmAnnotation> getAnnotations() {
-    return annotations;
-  }
-}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java
new file mode 100644
index 0000000..5ac562b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotatableDynamicExpression.java
@@ -0,0 +1,56 @@
+/*
+ * 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.edm.annotation;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotatable;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
+import org.apache.olingo.commons.core.edm.AbstractEdmAnnotatable;
+
+public abstract class AbstractEdmAnnotatableDynamicExpression extends AbstractEdmDynamicExpression implements
+    EdmAnnotatable {
+
+  private final AnnotationHelper helper;
+
+  public AbstractEdmAnnotatableDynamicExpression(Edm edm, String name, CsdlAnnotatable annotatable) {
+    super(edm, name);
+    helper = new AnnotationHelper(edm, annotatable);
+  }
+
+  @Override
+  public EdmAnnotation getAnnotation(final EdmTerm term, String qualifier) {
+    return helper.getAnnotation(term, qualifier);
+  }
+
+  @Override
+  public List<EdmAnnotation> getAnnotations() {
+    return helper.getAnnotations();
+  }
+
+  private class AnnotationHelper extends AbstractEdmAnnotatable {
+
+    public AnnotationHelper(Edm edm, CsdlAnnotatable annotatable) {
+      super(edm, annotatable);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/41210245/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java
deleted file mode 100644
index 26757c1..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/annotation/AbstractEdmAnnotationExpression.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.edm.annotation;
-
-import org.apache.olingo.commons.api.edm.annotation.EdmAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmConstantAnnotationExpression;
-import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpression;
-
-public abstract class AbstractEdmAnnotationExpression implements EdmAnnotationExpression {
-
-  @Override
-  public boolean isConstant() {
-    return this instanceof EdmConstantAnnotationExpression;
-  }
-
-  @Override
-  public EdmConstantAnnotationExpression asConstant() {
-    return isConstant() ? (EdmConstantAnnotationExpression) this : null;
-  }
-
-  @Override
-  public boolean isDynamic() {
-    return this instanceof EdmDynamicAnnotationExpression;
-  }
-
-  @Override
-  public EdmDynamicAnnotationExpression asDynamic() {
-    return isDynamic() ? (EdmDynamicAnnotationExpression) this : null;
-  }
-}