You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/04/23 16:01:55 UTC
[01/11] olingo-odata4 git commit: [OLINGO-564] Removed 'provider'
package level
Repository: olingo-odata4
Updated Branches:
refs/heads/OLINGO-564 [created] 754e23abe
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
deleted file mode 100644
index c11e880..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeInfo.java
+++ /dev/null
@@ -1,228 +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.provider;
-
-import org.apache.commons.lang3.StringUtils;
-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.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-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.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class EdmTypeInfo {
-
- public static class Builder {
-
- private String typeExpression;
- private String defaultNamespace;
- private Edm edm;
-
- public Builder setTypeExpression(final String typeExpression) {
- this.typeExpression = typeExpression;
- return this;
- }
-
- public Builder setDefaultNamespace(final String defaultNamespace) {
- this.defaultNamespace = defaultNamespace;
- return this;
- }
-
- public Builder setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public EdmTypeInfo build() {
- return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1 && StringUtils.isNotBlank(defaultNamespace)
- ? defaultNamespace + "." + typeExpression
- : typeExpression);
- }
- }
-
- private final boolean collection;
- private final FullQualifiedName fullQualifiedName;
- private EdmPrimitiveTypeKind primitiveType;
- private EdmTypeDefinition typeDefinition;
- private EdmEnumType enumType;
- private EdmComplexType complexType;
- private EdmEntityType entityType;
-
- private EdmTypeInfo(final Edm edm, final String typeExpression) {
- String baseType;
- final int collStartIdx = typeExpression.indexOf("Collection(");
- final int collEndIdx = typeExpression.lastIndexOf(')');
- if (collStartIdx == -1) {
- baseType = typeExpression;
- collection = false;
- } else {
- if (collEndIdx == -1) {
- throw new IllegalArgumentException("Malformed type: " + typeExpression);
- }
-
- collection = true;
- baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
- }
-
- baseType = baseType.replaceAll("^#", "");
-
- final String typeName;
- final String namespace;
-
- final int lastDotIdx = baseType.lastIndexOf('.');
- if (lastDotIdx == -1) {
- namespace = EdmPrimitiveType.EDM_NAMESPACE;
- typeName = baseType;
- } else {
- namespace = baseType.substring(0, lastDotIdx);
- typeName = baseType.substring(lastDotIdx + 1);
- }
-
- if (StringUtils.isBlank(typeName)) {
- throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
- }
-
- fullQualifiedName = new FullQualifiedName(namespace, typeName);
-
- try {
- primitiveType = EdmPrimitiveTypeKind.valueOf(fullQualifiedName.getName());
- } catch (final IllegalArgumentException e) {
- primitiveType = null;
- }
- if (primitiveType == null && edm != null) {
- typeDefinition = edm.getTypeDefinition(fullQualifiedName);
- if (typeDefinition == null) {
- enumType = edm.getEnumType(fullQualifiedName);
- if (enumType == null) {
- complexType = edm.getComplexType(fullQualifiedName);
- if (complexType == null) {
- entityType = edm.getEntityType(fullQualifiedName);
- }
- }
- }
- }
- }
-
- public String internal() {
- final StringBuilder deserialize = new StringBuilder();
-
- if (isCollection()) {
- deserialize.append("Collection(");
- }
-
- deserialize.append(getFullQualifiedName().toString());
-
- if (isCollection()) {
- deserialize.append(")");
- }
-
- return deserialize.toString();
- }
-
- public String external() {
- final StringBuilder serialize = new StringBuilder();
-
- if (isCollection()) {
- serialize.append('#');
- serialize.append("Collection(");
- }
-
- if (isPrimitiveType()) {
- serialize.append(getFullQualifiedName().getName());
- }else{
- serialize.append(getFullQualifiedName().toString());
- }
-
- if (isCollection()) {
- serialize.append(")");
- }
-
- if (!isPrimitiveType() && !isCollection()) {
- serialize.insert(0, '#');
- }
-
- return serialize.toString();
- }
-
- public boolean isCollection() {
- return collection;
- }
-
- public FullQualifiedName getFullQualifiedName() {
- return fullQualifiedName;
- }
-
- public boolean isPrimitiveType() {
- return primitiveType != null;
- }
-
- public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
- return primitiveType;
- }
-
- public boolean isTypeDefinition() {
- return typeDefinition != null;
- }
-
- public EdmTypeDefinition getTypeDefinition() {
- return typeDefinition;
- }
-
- public boolean isEnumType() {
- return enumType != null;
- }
-
- public EdmEnumType getEnumType() {
- return enumType;
- }
-
- public boolean isComplexType() {
- return complexType != null;
- }
-
- public EdmComplexType getComplexType() {
- return complexType;
- }
-
- public boolean isEntityType() {
- return entityType != null;
- }
-
- public EdmEntityType getEntityType() {
- return entityType;
- }
-
- public EdmType getType() {
- return isPrimitiveType()
- ? EdmPrimitiveTypeFactory.getInstance(getPrimitiveTypeKind())
- : isTypeDefinition()
- ? getTypeDefinition()
- : isEnumType()
- ? getEnumType()
- : isComplexType()
- ? getComplexType()
- : isEntityType()
- ? getEntityType()
- : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/Target.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/Target.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/Target.java
deleted file mode 100644
index 4f45ccd..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/Target.java
+++ /dev/null
@@ -1,66 +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.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-/**
- * An Edm target element. It contains a target as a String name as well as the {@link FullQualifiedName} of the entity
- * container it is contained in.
- */
-public class Target {
-
- private String targetName;
- private FullQualifiedName entityContainer;
-
- public Target(String target, EdmEntityContainer defaultContainer) {
- final String[] bindingTargetParts = target.split("/");
- if (bindingTargetParts.length == 1) {
- entityContainer = defaultContainer.getFullQualifiedName();
- targetName = bindingTargetParts[0];
- } else {
- entityContainer = new FullQualifiedName(bindingTargetParts[0]);
- targetName = bindingTargetParts[1];
- }
- }
-
- /**
- * @return name of the target as a String
- */
- public String getTargetName() {
- return targetName;
- }
-
- /**
- * @return {@link FullQualifiedName} of the entity container this target is contained in.
- */
- public FullQualifiedName getEntityContainer() {
- return entityContainer;
- }
-
- @Override
- public String toString() {
- if (entityContainer == null) {
- return targetName;
- }
- return entityContainer.getFullQualifiedNameAsString() + "/" + targetName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
index 84795bf..26cafc2 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java
@@ -60,7 +60,7 @@ import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.aalto.stax.InputFactoryImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
index fb187fe..7543eac 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java
@@ -49,7 +49,7 @@ import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.serialization.ODataSerializer;
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.aalto.stax.OutputFactoryImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
index 34394bb..c9c715a 100755
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java
@@ -52,7 +52,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.serialization.ODataDeserializer;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
index bf54cda..703f6b6 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntityDeserializer.java
@@ -38,7 +38,7 @@ import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
index b0fce7c..b6a32ef 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySerializer.java
@@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonGenerator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java
index 355f321..33629f4 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonGeoValueDeserializer.java
@@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
import org.apache.olingo.commons.api.edm.geo.SRID;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java
index 47c4387..885ba30 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertyDeserializer.java
@@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
index 870cabd..d531108 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonPropertySerializer.java
@@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonGenerator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
index 0dd8dd4..84ed5f7 100755
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java
@@ -48,7 +48,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataSerializer;
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java
index c659a8a..ad8cbc4 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.core;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.ServiceMetadata;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
index 04f0556..efc75b7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/AbstractEdmNamedTest.java
@@ -22,7 +22,7 @@ import org.apache.olingo.commons.api.edm.EdmAnnotatable;
import org.apache.olingo.commons.api.edm.EdmNamed;
import org.apache.olingo.commons.api.edm.provider.Annotatable;
import org.apache.olingo.commons.api.edm.provider.Annotation;
-import org.apache.olingo.commons.core.edm.provider.AbstractEdmNamed;
+import org.apache.olingo.commons.core.edm.AbstractEdmNamed;
import org.junit.Test;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java
index 8a3dc87..a33fc6e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java
@@ -40,8 +40,8 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.edm.provider.Action;
import org.apache.olingo.commons.api.edm.provider.Parameter;
import org.apache.olingo.commons.api.edm.provider.ReturnType;
-import org.apache.olingo.commons.core.edm.provider.EdmActionImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmActionImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java
index 950112f..a5d098d 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java
@@ -31,8 +31,8 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.ActionImport;
-import org.apache.olingo.commons.core.edm.provider.EdmActionImportImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmActionImportImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
index 917f60b..87a7723 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
@@ -27,8 +27,8 @@ import org.apache.olingo.commons.api.edm.provider.ComplexType;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.commons.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java
index 312d636..52713a3 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java
@@ -45,8 +45,8 @@ import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
import org.apache.olingo.commons.api.edm.provider.EntitySet;
import org.apache.olingo.commons.api.edm.provider.FunctionImport;
import org.apache.olingo.commons.api.edm.provider.Singleton;
-import org.apache.olingo.commons.core.edm.provider.EdmEntityContainerImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmEntityContainerImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java
index 4e9dad0..0071ddd 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java
@@ -36,9 +36,9 @@ import org.apache.olingo.commons.api.edm.provider.EntitySet;
import org.apache.olingo.commons.api.edm.provider.EntityType;
import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-import org.apache.olingo.commons.core.edm.provider.EdmEntityContainerImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmEntitySetImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmEntityContainerImpl;
+import org.apache.olingo.commons.core.edm.EdmEntitySetImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
public class EdmEntitySetImplTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
index 045c1a7..8c39ac6 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
@@ -43,8 +43,8 @@ import org.apache.olingo.commons.api.edm.provider.EntityType;
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
import org.apache.olingo.commons.api.edm.provider.Property;
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-import org.apache.olingo.commons.core.edm.provider.EdmEntityTypeImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmEntityTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
index 0767f65..edc9a21 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
@@ -29,8 +29,8 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.edm.provider.EnumMember;
import org.apache.olingo.commons.api.edm.provider.EnumType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmEnumTypeImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmEnumTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import org.mockito.Mockito;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java
index a58ee2b..8adab01 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java
@@ -24,8 +24,8 @@ import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.Function;
import org.apache.olingo.commons.api.edm.provider.ReturnType;
-import org.apache.olingo.commons.core.edm.provider.EdmFunctionImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmFunctionImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
index 6180dfa..002ec05 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
@@ -30,9 +30,9 @@ import org.apache.olingo.commons.api.edm.provider.FunctionImport;
import org.apache.olingo.commons.api.edm.provider.Parameter;
import org.apache.olingo.commons.api.edm.provider.ReturnType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmEntityContainerImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmFunctionImportImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmEntityContainerImpl;
+import org.apache.olingo.commons.core.edm.EdmFunctionImportImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java
index f11865b..d4e957a 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java
@@ -25,7 +25,7 @@ import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-import org.apache.olingo.commons.core.edm.provider.EdmKeyPropertyRefImpl;
+import org.apache.olingo.commons.core.edm.EdmKeyPropertyRefImpl;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMappingTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMappingTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMappingTest.java
index bae57ef..5730d40 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMappingTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMappingTest.java
@@ -31,8 +31,8 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.Mapping;
import org.apache.olingo.commons.api.edm.provider.Parameter;
import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.commons.core.edm.provider.EdmParameterImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmPropertyImpl;
+import org.apache.olingo.commons.core.edm.EdmParameterImpl;
+import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
import org.junit.Test;
public class EdmMappingTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java
index 01d7c39..a0c2944 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java
@@ -19,8 +19,8 @@
package org.apache.olingo.server.core.edm.provider;
import org.apache.olingo.commons.api.edm.provider.EnumMember;
-import org.apache.olingo.commons.core.edm.provider.EdmMemberImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmMemberImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java
index 9a275ff..4751f59 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java
@@ -28,8 +28,8 @@ import org.apache.olingo.commons.api.edm.provider.EntityType;
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
-import org.apache.olingo.commons.core.edm.provider.EdmNavigationPropertyImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmNavigationPropertyImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
index dab89a6..bbcea0b 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
@@ -30,8 +30,8 @@ import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.EnumType;
import org.apache.olingo.commons.api.edm.provider.Parameter;
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.core.edm.provider.EdmParameterImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmParameterImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
index d9e73f9..cc3e819 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
@@ -30,8 +30,8 @@ import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.EnumType;
import org.apache.olingo.commons.api.edm.provider.Property;
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.core.edm.provider.EdmPropertyImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java
index 9e9f993..f7fb6c5 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java
@@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.edm.provider.Action;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.Function;
import org.apache.olingo.commons.api.edm.provider.Parameter;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java
index f629f19..aa98ad8 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java
@@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.edm.provider.EntityType;
import org.apache.olingo.commons.api.edm.provider.EnumType;
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
index a7168ae..e8cecee 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
@@ -29,8 +29,8 @@ import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.provider.ReturnType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmReturnTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmReturnTypeImpl;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
index 9e0b44e..9b08277 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
@@ -60,7 +60,7 @@ import org.apache.olingo.commons.api.edm.provider.Schema;
import org.apache.olingo.commons.api.edm.provider.Singleton;
import org.apache.olingo.commons.api.edm.provider.Term;
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java
index c80daa1..f502e20 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java
@@ -37,9 +37,9 @@ import org.apache.olingo.commons.api.edm.provider.EntityType;
import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.provider.PropertyRef;
import org.apache.olingo.commons.api.edm.provider.Singleton;
-import org.apache.olingo.commons.core.edm.provider.EdmEntityContainerImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmSingletonImpl;
+import org.apache.olingo.commons.core.edm.EdmEntityContainerImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmSingletonImpl;
import org.junit.Test;
public class EdmSingletonImplTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
index ac32302..845dea7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
@@ -25,8 +25,8 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeDefinitionImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeDefinitionImpl;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
index b9f6db6..5249de7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.edm.provider.Annotatable;
import org.apache.olingo.commons.api.edm.provider.Annotation;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeImpl;
import org.junit.Test;
import java.util.Arrays;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
index 7979159..4333308 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
@@ -32,8 +32,8 @@ import org.apache.olingo.commons.api.edm.provider.ComplexType;
import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.commons.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
public class ComplexTypeHelper {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java
index e9e21ab..af5b421 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java
@@ -38,8 +38,8 @@ import org.apache.olingo.commons.api.edm.provider.EdmProvider;
import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
import org.apache.olingo.commons.api.edm.provider.Property;
import org.apache.olingo.commons.core.edm.primitivetype.EdmString;
-import org.apache.olingo.commons.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.junit.Test;
import org.mockito.Mockito;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
index a7bd86e..d1b73f7 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
@@ -58,7 +58,7 @@ import org.apache.olingo.commons.api.edm.provider.ReturnType;
import org.apache.olingo.commons.api.edm.provider.Schema;
import org.apache.olingo.commons.api.edm.provider.Singleton;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.provider.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.edmx.EdmxReference;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
index 40cea2e..a13b929 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.core.uri;
import org.apache.olingo.commons.api.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.uri.UriInfoAll;
import org.apache.olingo.server.api.uri.UriInfoBatch;
import org.apache.olingo.server.api.uri.UriInfoCrossjoin;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
index a6d9792..050cce1 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
@@ -29,10 +29,10 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmEntitySetImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.commons.core.edm.provider.EdmSingletonImpl;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmEntitySetImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmSingletonImpl;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
index 88cd44e..3658960 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -24,7 +24,7 @@ import java.util.Arrays;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.core.Encoder;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriResourceKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
index 86cbf0e..e92dcbe 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
@@ -24,7 +24,7 @@ import java.util.Arrays;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriResourceKind;
import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
index 6f728be..3c9246a 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
@@ -20,7 +20,7 @@ package org.apache.olingo.server.core.uri.queryoption;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.uri.UriInfoResource;
import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
import org.apache.olingo.server.core.uri.UriInfoImpl;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
index 6bdd494..e8f2756 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
@@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.uri.UriInfoKind;
import org.apache.olingo.server.api.uri.UriInfoResource;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
index db3930e..f04d81c 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
@@ -23,7 +23,7 @@ import static org.junit.Assert.fail;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.server.api.uri.UriInfo;
import org.apache.olingo.server.core.uri.parser.Parser;
import org.apache.olingo.server.core.uri.parser.UriParserException;
[07/11] olingo-odata4 git commit: [OLINGO-564] Renamed client edm
classes
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfImpl.java
deleted file mode 100644
index df5756b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfImpl.java
+++ /dev/null
@@ -1,138 +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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.IsOf;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = IsOfImpl.IsOfDeserializer.class)
-public class IsOfImpl extends AbstractAnnotatableDynamicAnnotationExpression implements IsOf {
-
- private static final long serialVersionUID = -893355856129761174L;
-
- private String type;
-
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- private SRID srid;
-
- private DynamicAnnotationExpression value;
-
- @Override
- public String getType() {
- return type;
- }
-
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- }
-
- @Override
- public Integer getPrecision() {
- return precision;
- }
-
- public void setPrecision(final Integer precision) {
- this.precision = precision;
- }
-
- @Override
- public Integer getScale() {
- return scale;
- }
-
- public void setScale(final Integer scale) {
- this.scale = scale;
- }
-
- @Override
- public SRID getSrid() {
- return srid;
- }
-
- public void setSrid(final SRID srid) {
- this.srid = srid;
- }
-
- @Override
- public DynamicAnnotationExpression getValue() {
- return value;
- }
-
- public void setValue(final DynamicAnnotationExpression value) {
- this.value = value;
- }
-
- static class IsOfDeserializer extends AbstractEdmDeserializer<IsOfImpl> {
- @Override
- protected IsOfImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final IsOfImpl isof = new IsOfImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Type".equals(jp.getCurrentName())) {
- isof.setType(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- isof.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- final String maxLenght = jp.nextTextValue();
- isof.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
- } else if ("Precision".equals(jp.getCurrentName())) {
- isof.setPrecision(Integer.valueOf(jp.nextTextValue()));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- isof.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- isof.setSrid(SRID.valueOf(srid));
- }
- } else {
- isof.setValue(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
- return isof;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementImpl.java
deleted file mode 100644
index 8d190ce..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementImpl.java
+++ /dev/null
@@ -1,81 +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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElement;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = LabeledElementImpl.LabeledElementDeserializer.class)
-public class LabeledElementImpl
- extends AbstractAnnotatableDynamicAnnotationExpression implements LabeledElement {
-
- private static final long serialVersionUID = 4909387630253341824L;
-
- private String name;
-
- private DynamicAnnotationExpression value;
-
- @Override
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public DynamicAnnotationExpression getValue() {
- return value;
- }
-
- public void setValue(final DynamicAnnotationExpression value) {
- this.value = value;
- }
-
- static class LabeledElementDeserializer extends AbstractEdmDeserializer<LabeledElementImpl> {
- @Override
- protected LabeledElementImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final LabeledElementImpl element = new LabeledElementImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- element.setName(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- element.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else {
- element.setValue(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
- return element;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementReferenceImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementReferenceImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementReferenceImpl.java
deleted file mode 100644
index 7bd3a14..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/LabeledElementReferenceImpl.java
+++ /dev/null
@@ -1,28 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference;
-
-public class LabeledElementReferenceImpl
- extends AbstractElementOrAttributeExpression implements LabeledElementReference {
-
- private static final long serialVersionUID = 7560525604021670529L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NavigationPropertyPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NavigationPropertyPathImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NavigationPropertyPathImpl.java
deleted file mode 100644
index 8e04ebb..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NavigationPropertyPathImpl.java
+++ /dev/null
@@ -1,27 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath;
-
-public class NavigationPropertyPathImpl extends AbstractElementOrAttributeExpression implements NavigationPropertyPath {
-
- private static final long serialVersionUID = 879840502446301312L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NotImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NotImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NotImpl.java
deleted file mode 100644
index 044385d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NotImpl.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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.Not;
-
-public class NotImpl extends AbstractDynamicAnnotationExpression implements Not {
-
- private static final long serialVersionUID = -437788415922966812L;
-
- private DynamicAnnotationExpression expression;
-
- @Override
- public DynamicAnnotationExpression getExpression() {
- return expression;
- }
-
- public void setExpression(final DynamicAnnotationExpression expression) {
- this.expression = expression;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NullImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NullImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NullImpl.java
deleted file mode 100644
index f9030f6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/NullImpl.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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.provider.annotation.Null;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = NullImpl.NullDeserializer.class)
-public class NullImpl extends AbstractAnnotatableDynamicAnnotationExpression implements Null {
-
- private static final long serialVersionUID = -3148516847180393142L;
-
- static class NullDeserializer extends AbstractEdmDeserializer<NullImpl> {
- @Override
- protected NullImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final NullImpl _null = new NullImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Annotation".equals(jp.getCurrentName())) {
- _null.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
- return _null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PathImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PathImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PathImpl.java
deleted file mode 100644
index a3597e0..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PathImpl.java
+++ /dev/null
@@ -1,27 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.Path;
-
-public class PathImpl extends AbstractElementOrAttributeExpression implements Path {
-
- private static final long serialVersionUID = 6020168217561402545L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyPathImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyPathImpl.java
deleted file mode 100644
index 97dd2e6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyPathImpl.java
+++ /dev/null
@@ -1,27 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath;
-
-public class PropertyPathImpl extends AbstractElementOrAttributeExpression implements PropertyPath {
-
- private static final long serialVersionUID = -9133862135834738470L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyValueImpl.java
deleted file mode 100644
index 9df0413..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/PropertyValueImpl.java
+++ /dev/null
@@ -1,82 +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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = PropertyValueImpl.PropertyValueDeserializer.class)
-public class PropertyValueImpl extends AbstractAnnotatableDynamicAnnotationExpression implements PropertyValue {
-
- private static final long serialVersionUID = -8437649215282645228L;
-
- private String property;
-
- private AnnotationExpression value;
-
- @Override
- public String getProperty() {
- return property;
- }
-
- public void setProperty(final String property) {
- this.property = property;
- }
-
- @Override
- public AnnotationExpression getValue() {
- return value;
- }
-
- public void setValue(final AnnotationExpression value) {
- this.value = value;
- }
-
- static class PropertyValueDeserializer extends AbstractEdmDeserializer<PropertyValueImpl> {
- @Override
- protected PropertyValueImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final PropertyValueImpl propValue = new PropertyValueImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Property".equals(jp.getCurrentName())) {
- propValue.setProperty(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- propValue.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else if (isAnnotationConstExprConstruct(jp)) {
- propValue.setValue(parseAnnotationConstExprConstruct(jp));
- } else {
- propValue.setValue(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
- return propValue;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/RecordImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/RecordImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/RecordImpl.java
deleted file mode 100644
index 1f200f1..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/RecordImpl.java
+++ /dev/null
@@ -1,78 +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.client.core.edm.xml.annotation;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
-import org.apache.olingo.commons.api.edm.provider.annotation.Record;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = RecordImpl.RecordDeserializer.class)
-public class RecordImpl extends AbstractAnnotatableDynamicAnnotationExpression implements Record {
-
- private static final long serialVersionUID = 4275271751615410709L;
-
- private String type;
-
- private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>();
-
- @Override
- public String getType() {
- return type;
- }
-
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public List<PropertyValue> getPropertyValues() {
- return propertyValues;
- }
-
- static class RecordDeserializer extends AbstractEdmDeserializer<RecordImpl> {
- @Override
- protected RecordImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final RecordImpl record = new RecordImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Type".equals(jp.getCurrentName())) {
- record.setType(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- record.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else {
- record.getPropertyValues().add(jp.readValueAs(PropertyValueImpl.class));
- }
- }
- }
- return record;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/TwoParamsOpDynamicAnnotationExpressionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/TwoParamsOpDynamicAnnotationExpressionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/TwoParamsOpDynamicAnnotationExpressionImpl.java
deleted file mode 100644
index 00857c3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/TwoParamsOpDynamicAnnotationExpressionImpl.java
+++ /dev/null
@@ -1,62 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
-
-public class TwoParamsOpDynamicAnnotationExpressionImpl
- extends AbstractDynamicAnnotationExpression implements TwoParamsOpDynamicAnnotationExpression {
-
- private static final long serialVersionUID = 6241842185452451946L;
-
- private Type type;
-
- private DynamicAnnotationExpression left;
-
- private DynamicAnnotationExpression right;
-
- @Override
- public Type getType() {
- return type;
- }
-
- public void setType(final Type type) {
- this.type = type;
- }
-
- @Override
- public DynamicAnnotationExpression getLeftExpression() {
- return left;
- }
-
- public void setLeftExpression(final DynamicAnnotationExpression left) {
- this.left = left;
- }
-
- @Override
- public DynamicAnnotationExpression getRightExpression() {
- return right;
- }
-
- public void setRightExpression(final DynamicAnnotationExpression right) {
- this.right = right;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/UrlRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/UrlRefImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/UrlRefImpl.java
deleted file mode 100644
index 4c2ac48..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/UrlRefImpl.java
+++ /dev/null
@@ -1,66 +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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = UrlRefImpl.UrlRefDeserializer.class)
-public class UrlRefImpl extends AbstractDynamicAnnotationExpression implements UrlRef {
-
- private static final long serialVersionUID = -7693224811739000440L;
-
- private AnnotationExpression value;
-
- @Override
- public AnnotationExpression getValue() {
- return value;
- }
-
- public void setValue(final AnnotationExpression value) {
- this.value = value;
- }
-
- static class UrlRefDeserializer extends AbstractEdmDeserializer<UrlRefImpl> {
- @Override
- protected UrlRefImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final UrlRefImpl urlref = new UrlRefImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if (isAnnotationConstExprConstruct(jp)) {
- urlref.setValue(parseAnnotationConstExprConstruct(jp));
- } else {
- urlref.setValue(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
- return urlref;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
index 32cd726..8430cff 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java
@@ -28,8 +28,8 @@ import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
-import org.apache.olingo.client.core.edm.xml.EdmxImpl;
-import org.apache.olingo.client.core.edm.xml.XMLMetadataImpl;
+import org.apache.olingo.client.core.edm.xml.ClientEdmx;
+import org.apache.olingo.client.core.edm.xml.ClientXMLMetadata;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
@@ -114,7 +114,7 @@ public class ClientODataDeserializerImpl implements ClientODataDeserializer {
@Override
public XMLMetadata toMetadata(final InputStream input) {
try {
- return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
+ return new ClientXMLMetadata(getXmlMapper().readValue(input, ClientEdmx.class));
} catch (Exception e) {
throw new IllegalArgumentException("Could not parse as Edmx document", e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
index f3fde9e..4854887 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
@@ -27,7 +27,7 @@ import java.util.Calendar;
import java.util.Collections;
import java.util.TimeZone;
-import org.apache.olingo.client.core.edm.xml.EnumTypeImpl;
+import org.apache.olingo.client.core.edm.xml.ClientEnumType;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -51,7 +51,7 @@ public class URIEscapeTest {
@Test
public void _enum() throws UnsupportedEncodingException {
final EdmEnumType pattern =
- new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
+ new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new ClientEnumType());
assertEquals("Sales.Pattern'Yellow'", URIUtils.escape( pattern.toUriLiteral("Yellow")));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
index 7f9b57d..5edd2cf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
@@ -30,7 +30,7 @@ import org.apache.olingo.client.api.uri.FilterArgFactory;
import org.apache.olingo.client.api.uri.FilterFactory;
import org.apache.olingo.client.api.uri.URIFilter;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.edm.xml.EnumTypeImpl;
+import org.apache.olingo.client.core.edm.xml.ClientEnumType;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -55,7 +55,7 @@ public class FilterFactoryTest extends AbstractTest {
@Test
public void has() {
final EdmEnumType pattern =
- new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
+ new EdmEnumTypeImpl(null, new FullQualifiedName("Sales", "Pattern"), new ClientEnumType());
final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
assertEquals("(style has Sales.Pattern'Yellow')", filter.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index 56ed788..bb29eaa 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -29,8 +29,8 @@ import java.util.List;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.edm.xml.annotation.ConstantAnnotationExpressionImpl;
-import org.apache.olingo.client.core.edm.xml.annotation.PathImpl;
+import org.apache.olingo.client.core.edm.xml.annotation.ClientConstantAnnotationExpression;
+import org.apache.olingo.client.core.edm.xml.annotation.ClientPath;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
@@ -297,16 +297,16 @@ public class MetadataTest extends AbstractTest {
assertEquals(Constants.CANONICAL_FUNCTION_CONCAT, apply.getFunction());
assertEquals(3, apply.getParameters().size());
- final PathImpl firstArg = new PathImpl();
+ final ClientPath firstArg = new ClientPath();
firstArg.setValue("Name");
assertEquals(firstArg, apply.getParameters().get(0));
- final ConstantAnnotationExpression secondArg = new ConstantAnnotationExpressionImpl();
+ final ConstantAnnotationExpression secondArg = new ClientConstantAnnotationExpression();
secondArg.setType(ConstantAnnotationExpression.Type.String);
secondArg.setValue(" in ");
assertEquals(secondArg, apply.getParameters().get(1));
- final PathImpl thirdArg = new PathImpl();
+ final ClientPath thirdArg = new ClientPath();
thirdArg.setValue("Address/CountryName");
assertEquals(thirdArg, apply.getParameters().get(2));
[06/11] olingo-odata4 git commit: [OLINGO-564] Added package infos
Posted by mi...@apache.org.
[OLINGO-564] Added package infos
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/cceceafd
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/cceceafd
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/cceceafd
Branch: refs/heads/OLINGO-564
Commit: cceceafdb5c21e2f38c2b033a793d0b8e390b08b
Parents: ac32d23
Author: Michael Bolz <mi...@sap.com>
Authored: Thu Apr 23 11:06:09 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Thu Apr 23 11:06:09 2015 +0200
----------------------------------------------------------------------
.../olingo/commons/api/data/package-info.java | 22 ++++++++++++++++++++
.../olingo/commons/api/edm/package-info.java | 3 +++
.../commons/api/edm/provider/package-info.java | 22 ++++++++++++++++++++
3 files changed, 47 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cceceafd/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/package-info.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/package-info.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/package-info.java
new file mode 100644
index 0000000..40c8b1b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+/**
+ * Contains all the data objects of an OData responses and OData requests
+ */
+package org.apache.olingo.commons.api.data;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cceceafd/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/package-info.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/package-info.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/package-info.java
index ead4d12..052de43 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/package-info.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/package-info.java
@@ -16,5 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
+/**
+ * Contains representations for EDM objects created during the URI parsing
+ */
package org.apache.olingo.commons.api.edm;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cceceafd/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/package-info.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/package-info.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/package-info.java
new file mode 100644
index 0000000..abe2a3c
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+/**
+ * Contains representations for objects created during CSDL document parsing
+ */
+package org.apache.olingo.commons.api.edm.provider;
\ No newline at end of file
[09/11] olingo-odata4 git commit: [OLINGO-564] Renamed client edm
classes
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImportImpl.java
deleted file mode 100644
index 3591698..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImportImpl.java
+++ /dev/null
@@ -1,64 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.FunctionImport;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = FunctionImportImpl.FunctionImportDeserializer.class)
-public class FunctionImportImpl extends FunctionImport {
-
- private static final long serialVersionUID = -1686801084142932402L;
-
- static class FunctionImportDeserializer extends AbstractEdmDeserializer<FunctionImportImpl> {
- @Override
- protected FunctionImportImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final FunctionImportImpl functImpImpl = new FunctionImportImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- functImpImpl.setName(jp.nextTextValue());
- } else if ("Function".equals(jp.getCurrentName())) {
- functImpImpl.setFunction(jp.nextTextValue());
- } else if ("EntitySet".equals(jp.getCurrentName())) {
- functImpImpl.setEntitySet(jp.nextTextValue());
- } else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
- functImpImpl.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- functImpImpl.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return functImpImpl;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeAnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeAnnotationsImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeAnnotationsImpl.java
deleted file mode 100644
index ccea81b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeAnnotationsImpl.java
+++ /dev/null
@@ -1,88 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.client.api.edm.xml.IncludeAnnotations;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = IncludeAnnotationsImpl.IncludeAnnotationsDeserializer.class)
-public class IncludeAnnotationsImpl extends AbstractEdmItem implements IncludeAnnotations {
-
- private static final long serialVersionUID = -8157841387011422396L;
-
- private String termNamespace;
- private String qualifier;
- private String targetNamespace;
-
- @Override
- public String getTermNamespace() {
- return termNamespace;
- }
-
- public void setTermNamespace(final String termNamespace) {
- this.termNamespace = termNamespace;
- }
-
- @Override
- public String getQualifier() {
- return qualifier;
- }
-
- public void setQualifier(final String qualifier) {
- this.qualifier = qualifier;
- }
-
- @Override
- public String getTargetNamespace() {
- return targetNamespace;
- }
-
- public void setTargetNamespace(final String targetNamespace) {
- this.targetNamespace = targetNamespace;
- }
-
- static class IncludeAnnotationsDeserializer extends AbstractEdmDeserializer<IncludeAnnotations> {
- @Override
- protected IncludeAnnotations doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final IncludeAnnotationsImpl member = new IncludeAnnotationsImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("TermNamespace".equals(jp.getCurrentName())) {
- member.setTermNamespace(jp.nextTextValue());
- } else if ("Qualifier".equals(jp.getCurrentName())) {
- member.setQualifier(jp.nextTextValue());
- } else if ("TargetNamespace".equals(jp.getCurrentName())) {
- member.setTargetNamespace(jp.nextTextValue());
- }
- }
- }
- return member;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeImpl.java
deleted file mode 100644
index 55ac505..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/IncludeImpl.java
+++ /dev/null
@@ -1,76 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.client.api.edm.xml.Include;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = IncludeImpl.IncludeDeserializer.class)
-public class IncludeImpl extends AbstractEdmItem implements Include {
-
- private static final long serialVersionUID = -5450008299655584221L;
-
- private String namespace;
- private String alias;
-
- @Override
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(final String namespace) {
- this.namespace = namespace;
- }
-
- @Override
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(final String alias) {
- this.alias = alias;
- }
-
- static class IncludeDeserializer extends AbstractEdmDeserializer<Include> {
- @Override
- protected Include doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final IncludeImpl include = new IncludeImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Namespace".equals(jp.getCurrentName())) {
- include.setNamespace(jp.nextTextValue());
- } else if ("Alias".equals(jp.getCurrentName())) {
- include.setAlias(jp.nextTextValue());
- }
- }
- }
- return include;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyBindingImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyBindingImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyBindingImpl.java
deleted file mode 100644
index c01707f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyBindingImpl.java
+++ /dev/null
@@ -1,66 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = NavigationPropertyBindingImpl.NavigationPropertyBindingDeserializer.class)
-public class NavigationPropertyBindingImpl extends NavigationPropertyBinding {
-
- private static final long serialVersionUID = -7056978592235483660L;
-
- @Override
- public NavigationPropertyBinding setPath(final String path) {
- super.setPath(path);
- return this;
- }
-
- @Override
- public NavigationPropertyBinding setTarget(final String target) {
- super.setTarget(target);
- return this;
- }
-
- static class NavigationPropertyBindingDeserializer extends AbstractEdmDeserializer<NavigationPropertyBinding> {
- @Override
- protected NavigationPropertyBinding doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final NavigationPropertyBindingImpl member = new NavigationPropertyBindingImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Path".equals(jp.getCurrentName())) {
- member.setPath(jp.nextTextValue());
- } else if ("Target".equals(jp.getCurrentName())) {
- member.setTarget(jp.nextTextValue());
- }
- }
- }
- return member;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyImpl.java
deleted file mode 100644
index 904a57d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/NavigationPropertyImpl.java
+++ /dev/null
@@ -1,80 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = NavigationPropertyImpl.NavigationPropertyDeserializer.class)
-public class NavigationPropertyImpl extends NavigationProperty {
-
- private static final long serialVersionUID = 6240231735592427582L;
-
- static class NavigationPropertyDeserializer extends AbstractEdmDeserializer<NavigationProperty> {
-
- @Override
- protected NavigationProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final NavigationProperty property = new NavigationPropertyImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- property.setName(jp.nextTextValue());
- } else if ("Type".equals(jp.getCurrentName())) {
- String metadataTypeName = jp.nextTextValue();
- if (metadataTypeName.startsWith("Collection(")) {
- property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
- metadataTypeName.length() - 1));
- property.setCollection(true);
- } else {
- property.setType(metadataTypeName);
- property.setCollection(false);
- }
- } else if ("Nullable".equals(jp.getCurrentName())) {
- property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Partner".equals(jp.getCurrentName())) {
- property.setPartner(jp.nextTextValue());
- } else if ("ContainsTarget".equals(jp.getCurrentName())) {
- property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
- jp.nextToken();
- property.getReferentialConstraints().add(jp.readValueAs(ReferentialConstraintImpl.class));
- } else if ("OnDelete".equals(jp.getCurrentName())) {
- jp.nextToken();
- property.setOnDelete(jp.readValueAs(OnDeleteImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- property.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
- return property;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/OnDeleteImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/OnDeleteImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/OnDeleteImpl.java
deleted file mode 100644
index 9228c4c..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/OnDeleteImpl.java
+++ /dev/null
@@ -1,54 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.commons.api.edm.provider.OnDelete;
-import org.apache.olingo.commons.api.edm.provider.OnDeleteAction;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = OnDeleteImpl.OnDeleteDeserializer.class)
-public class OnDeleteImpl extends OnDelete {
-
- private static final long serialVersionUID = -7130889202653716784L;
-
- static class OnDeleteDeserializer extends AbstractEdmDeserializer<OnDelete> {
- @Override
- protected OnDelete doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final OnDelete ondelete = new OnDeleteImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Action".equals(jp.getCurrentName())) {
- OnDeleteAction action = OnDeleteAction.valueOf(jp.nextTextValue());
- ondelete.setAction(action);
- }
- }
- }
- return ondelete;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterImpl.java
deleted file mode 100644
index fb0b5f6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ParameterImpl.java
+++ /dev/null
@@ -1,84 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.Parameter;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ParameterImpl.ParameterDeserializer.class)
-public class ParameterImpl extends Parameter {
-
- private static final long serialVersionUID = 7119478691341167904L;
-
- static class ParameterDeserializer extends AbstractEdmDeserializer<ParameterImpl> {
- @Override
- protected ParameterImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final ParameterImpl parameter = new ParameterImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- parameter.setName(jp.nextTextValue());
- } else if ("Type".equals(jp.getCurrentName())) {
- String metadataTypeName = jp.nextTextValue();
- if (metadataTypeName.startsWith("Collection(")) {
- parameter.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
- metadataTypeName.length() - 1));
- parameter.setCollection(true);
- } else {
- parameter.setType(metadataTypeName);
- parameter.setCollection(false);
- }
- } else if ("Nullable".equals(jp.getCurrentName())) {
- parameter.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- final String maxLenght = jp.nextTextValue();
- parameter.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
- } else if ("Precision".equals(jp.getCurrentName())) {
- parameter.setPrecision(Integer.valueOf(jp.nextTextValue()));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- parameter.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- parameter.setSrid(SRID.valueOf(srid));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- parameter.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return parameter;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyImpl.java
deleted file mode 100644
index 1cc18e9..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyImpl.java
+++ /dev/null
@@ -1,88 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.Property;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = PropertyImpl.PropertyDeserializer.class)
-public class PropertyImpl extends Property {
-
- private static final long serialVersionUID = -4521766603286651372L;
-
- static class PropertyDeserializer extends AbstractEdmDeserializer<PropertyImpl> {
- @Override
- protected PropertyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final PropertyImpl property = new org.apache.olingo.client.core.edm.xml.PropertyImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- property.setName(jp.nextTextValue());
- } else if ("Type".equals(jp.getCurrentName())) {
- String metadataTypeName = jp.nextTextValue();
- if (metadataTypeName.startsWith("Collection(")) {
- property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
- metadataTypeName.length() - 1));
- property.setCollection(true);
- } else {
- property.setType(metadataTypeName);
- property.setCollection(false);
- }
- } else if ("Nullable".equals(jp.getCurrentName())) {
- property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("DefaultValue".equals(jp.getCurrentName())) {
- property.setDefaultValue(jp.nextTextValue());
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- final String maxLenght = jp.nextTextValue();
- property.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
- } else if ("Precision".equals(jp.getCurrentName())) {
- property.setPrecision(Integer.valueOf(jp.nextTextValue()));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- property.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("Unicode".equals(jp.getCurrentName())) {
- property.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- property.setSrid(SRID.valueOf(srid));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- property.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return property;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyRefImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyRefImpl.java
deleted file mode 100644
index 6fc5434..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/PropertyRefImpl.java
+++ /dev/null
@@ -1,54 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = PropertyRefImpl.PropertyRefDeserializer.class)
-public class PropertyRefImpl extends PropertyRef {
-
- private static final long serialVersionUID = 1504095609268590326L;
-
- static class PropertyRefDeserializer extends AbstractEdmDeserializer<PropertyRef> {
- @Override
- protected PropertyRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final PropertyRef propertyRef = new PropertyRefImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- propertyRef.setName(jp.nextTextValue());
- } else if ("Alias".equals(jp.getCurrentName())) {
- propertyRef.setAlias(jp.nextTextValue());
- }
- }
- }
- return propertyRef;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferenceImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferenceImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferenceImpl.java
deleted file mode 100644
index e4383d3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferenceImpl.java
+++ /dev/null
@@ -1,98 +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.client.core.edm.xml;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.api.edm.xml.Include;
-import org.apache.olingo.client.api.edm.xml.IncludeAnnotations;
-import org.apache.olingo.client.api.edm.xml.Reference;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = ReferenceImpl.ReferenceDeserializer.class)
-public class ReferenceImpl extends AbstractEdmItem implements Reference {
-
- private static final long serialVersionUID = 7720274712545267654L;
-
- private URI uri;
- private final List<Include> includes = new ArrayList<Include>();
- private final List<IncludeAnnotations> includeAnnotations = new ArrayList<IncludeAnnotations>();
- private final List<Annotation> annotations = new ArrayList<Annotation>();
-
- @Override
- public List<Annotation> getAnnotations() {
- return annotations;
- }
-
- @Override
- public URI getUri() {
- return uri;
- }
-
- public void setUri(final URI uri) {
- this.uri = uri;
- }
-
- @Override
- public List<Include> getIncludes() {
- return includes;
- }
-
- @Override
- public List<IncludeAnnotations> getIncludeAnnotations() {
- return includeAnnotations;
- }
-
- static class ReferenceDeserializer extends AbstractEdmDeserializer<ReferenceImpl> {
- @Override
- protected ReferenceImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final ReferenceImpl reference = new ReferenceImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Uri".equals(jp.getCurrentName())) {
- reference.setUri(URI.create(jp.nextTextValue()));
- } else if ("Include".equals(jp.getCurrentName())) {
- jp.nextToken();
- reference.getIncludes().add(jp.readValueAs( IncludeImpl.class));
- } else if ("IncludeAnnotations".equals(jp.getCurrentName())) {
- jp.nextToken();
- reference.getIncludeAnnotations().add(jp.readValueAs( IncludeAnnotationsImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- reference.getAnnotations().add(jp.readValueAs( AnnotationImpl.class));
- }
- }
- }
-
- return reference;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferentialConstraintImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferentialConstraintImpl.java
deleted file mode 100644
index a09fc11..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferentialConstraintImpl.java
+++ /dev/null
@@ -1,54 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ReferentialConstraintImpl.ReferentialConstraintDeserializer.class)
-public class ReferentialConstraintImpl extends ReferentialConstraint {
-
- private static final long serialVersionUID = -5822115908069878139L;
-
- static class ReferentialConstraintDeserializer extends AbstractEdmDeserializer<ReferentialConstraint> {
- @Override
- protected ReferentialConstraint doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final ReferentialConstraint refConst = new ReferentialConstraintImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Property".equals(jp.getCurrentName())) {
- refConst.setProperty(jp.nextTextValue());
- } else if ("ReferencedProperty".equals(jp.getCurrentName())) {
- refConst.setReferencedProperty(jp.nextTextValue());
- }
- }
- }
- return refConst;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeImpl.java
deleted file mode 100644
index 8caeca8..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeImpl.java
+++ /dev/null
@@ -1,78 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.ReturnType;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ReturnTypeImpl.ReturnTypeDeserializer.class)
-public class ReturnTypeImpl extends ReturnType {
-
- private static final long serialVersionUID = 6261092793901735110L;
-
- static class ReturnTypeDeserializer extends AbstractEdmDeserializer<ReturnTypeImpl> {
- @Override
- protected ReturnTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final ReturnTypeImpl returnType = new ReturnTypeImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Type".equals(jp.getCurrentName())) {
- String metadataTypeName = jp.nextTextValue();
- if (metadataTypeName.startsWith("Collection(")) {
- returnType.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
- metadataTypeName.length() - 1));
- returnType.setCollection(true);
- } else {
- returnType.setType(metadataTypeName);
- returnType.setCollection(false);
- }
- } else if ("Nullable".equals(jp.getCurrentName())) {
- returnType.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- final String maxLenght = jp.nextTextValue();
- returnType.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
- } else if ("Precision".equals(jp.getCurrentName())) {
- returnType.setPrecision(Integer.valueOf(jp.nextTextValue()));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- returnType.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- returnType.setSrid(SRID.valueOf(srid));
- }
- }
- }
- }
-
- return returnType;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaImpl.java
deleted file mode 100644
index da8df2e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaImpl.java
+++ /dev/null
@@ -1,86 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.commons.api.edm.provider.Schema;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = SchemaImpl.SchemaDeserializer.class)
-public class SchemaImpl extends Schema {
-
- private static final long serialVersionUID = 1911087363912024939L;
-
- static class SchemaDeserializer extends AbstractEdmDeserializer<SchemaImpl> {
- @Override
- protected SchemaImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final SchemaImpl schema = new SchemaImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Namespace".equals(jp.getCurrentName())) {
- schema.setNamespace(jp.nextTextValue());
- } else if ("Alias".equals(jp.getCurrentName())) {
- schema.setAlias(jp.nextTextValue());
- } else if ("ComplexType".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getComplexTypes().add(jp.readValueAs(ComplexTypeImpl.class));
- } else if ("EntityType".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getEntityTypes().add(jp.readValueAs(EntityTypeImpl.class));
- } else if ("EnumType".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getEnumTypes().add(jp.readValueAs(EnumTypeImpl.class));
- } else if ("EntityContainer".equals(jp.getCurrentName())) {
- jp.nextToken();
- EntityContainerImpl entityContainer = jp.readValueAs(EntityContainerImpl.class);
- schema.setEntityContainer(entityContainer);
- } else if ("Action".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getActions().add(jp.readValueAs(ActionImpl.class));
- } else if ("Function".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getFunctions().add(jp.readValueAs(FunctionImpl.class));
- } else if ("TypeDefinition".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getTypeDefinitions().add(jp.readValueAs(TypeDefinitionImpl.class));
- }
- } else if ("Annotations".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getAnnotationGroups().add(jp.readValueAs(AnnotationsImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else if ("Term".equals(jp.getCurrentName())) {
- jp.nextToken();
- schema.getTerms().add(jp.readValueAs(TermImpl.class));
- }
- }
-
- return schema;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonImpl.java
deleted file mode 100644
index c0066ba..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonImpl.java
+++ /dev/null
@@ -1,62 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.commons.api.edm.provider.Singleton;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = SingletonImpl.SingletonDeserializer.class)
-public class SingletonImpl extends Singleton {
-
- private static final long serialVersionUID = 1656749615107151921L;
-
- static class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
- @Override
- protected SingletonImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final SingletonImpl singleton = new SingletonImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- singleton.setName(jp.nextTextValue());
- } else if ("Type".equals(jp.getCurrentName())) {
- singleton.setType(jp.nextTextValue());
- } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
- jp.nextToken();
- singleton.getNavigationPropertyBindings().add(
- jp.readValueAs(NavigationPropertyBindingImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- singleton.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return singleton;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermImpl.java
deleted file mode 100644
index 8dbdd9b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermImpl.java
+++ /dev/null
@@ -1,83 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.Term;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-@JsonDeserialize(using = TermImpl.TermDeserializer.class)
-public class TermImpl extends Term {
-
- private static final long serialVersionUID = -8350072064720586186L;
-
- static class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
- @Override
- protected TermImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final TermImpl term = new TermImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- term.setName(jp.nextTextValue());
- } else if ("Type".equals(jp.getCurrentName())) {
- term.setType(jp.nextTextValue());
- } else if ("BaseTerm".equals(jp.getCurrentName())) {
- term.setBaseTerm(jp.nextTextValue());
- } else if ("DefaultValue".equals(jp.getCurrentName())) {
- term.setDefaultValue(jp.nextTextValue());
- } else if ("Nullable".equals(jp.getCurrentName())) {
- term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- final String maxLenght = jp.nextTextValue();
- term.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
- } else if ("Precision".equals(jp.getCurrentName())) {
- term.setPrecision(Integer.valueOf(jp.nextTextValue()));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- term.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- term.setSrid(SRID.valueOf(srid));
- }
- } else if ("AppliesTo".equals(jp.getCurrentName())) {
- term.getAppliesTo().addAll(Arrays.asList(StringUtils.split(jp.nextTextValue())));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- term.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return term;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionImpl.java
deleted file mode 100644
index 81013ce..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionImpl.java
+++ /dev/null
@@ -1,74 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = TypeDefinitionImpl.TypeDefinitionDeserializer.class)
-public class TypeDefinitionImpl extends TypeDefinition {
-
- private static final long serialVersionUID = -902407149079419602L;
-
- static class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
- @Override
- protected TypeDefinitionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final TypeDefinitionImpl typeDefinition = new TypeDefinitionImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- typeDefinition.setName(jp.nextTextValue());
- } else if ("UnderlyingType".equals(jp.getCurrentName())) {
- typeDefinition.setUnderlyingType(jp.nextTextValue());
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- typeDefinition.setMaxLength(jp.nextIntValue(0));
- } else if ("Unicode".equals(jp.getCurrentName())) {
- typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Precision".equals(jp.getCurrentName())) {
- typeDefinition.setPrecision(jp.nextIntValue(0));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- typeDefinition.setSrid(SRID.valueOf(srid));
- }
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- typeDefinition.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return typeDefinition;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/XMLMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/XMLMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/XMLMetadataImpl.java
deleted file mode 100644
index d7a65dd..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/XMLMetadataImpl.java
+++ /dev/null
@@ -1,75 +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.client.core.edm.xml;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.edm.xml.Edmx;
-import org.apache.olingo.client.api.edm.xml.Reference;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-import org.apache.olingo.commons.api.edm.provider.Schema;
-
-/**
- * Entry point for access information about EDM metadata.
- */
-public class XMLMetadataImpl extends AbstractEdmItem implements XMLMetadata {
-
- private static final long serialVersionUID = 6025723060298454901L;
- protected final Edmx edmx;
-
- public XMLMetadataImpl(final Edmx edmx) {
- this.edmx = edmx;
- }
-
- @Override
- public List<Schema> getSchemas() {
- return this.edmx.getDataServices().getSchemas();
- }
-
- @Override
- public Schema getSchema(final int index) {
- return getSchemas().get(index);
- }
-
- @Override
- public Schema getSchema(final String key) {
- return getSchemaByNsOrAlias().get(key);
- }
-
- @Override
- public Map<String, Schema> getSchemaByNsOrAlias() {
- final Map<String, Schema> schemaByNsOrAlias = new HashMap<String, Schema>();
- for (Schema schema : getSchemas()) {
- schemaByNsOrAlias.put(schema.getNamespace(), schema);
- if (StringUtils.isNotBlank(schema.getAlias())) {
- schemaByNsOrAlias.put(schema.getAlias(), schema);
- }
- }
- return schemaByNsOrAlias;
- }
-
- @Override
- public List<Reference> getReferences() {
- return this.edmx.getReferences();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotatableDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotatableDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotatableDynamicAnnotationExpression.java
deleted file mode 100644
index c530fc9..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotatableDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,38 +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.client.core.edm.xml.annotation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.provider.Annotatable;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-
-abstract class AbstractAnnotatableDynamicAnnotationExpression
- extends AbstractDynamicAnnotationExpression implements Annotatable {
-
- private static final long serialVersionUID = -450668773857358139L;
-
- private final List<Annotation> annotations = new ArrayList<Annotation>();
-
- @Override
- public List<Annotation> getAnnotations() {
- return annotations;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotationExpression.java
deleted file mode 100644
index 00def87..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractAnnotationExpression.java
+++ /dev/null
@@ -1,49 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-
-public abstract class AbstractAnnotationExpression extends AbstractEdmItem implements AnnotationExpression {
-
- private static final long serialVersionUID = -4238652997159205377L;
-
- @Override
- public boolean isConstant() {
- return this instanceof ConstantAnnotationExpression;
- }
-
- @Override
- public ConstantAnnotationExpression asConstant() {
- return isConstant() ? (ConstantAnnotationExpression) this : null;
- }
-
- @Override
- public boolean isDynamic() {
- return this instanceof DynamicAnnotationExpression;
- }
-
- @Override
- public DynamicAnnotationExpression asDynamic() {
- return isDynamic() ? (DynamicAnnotationExpression) this : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotatableDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotatableDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotatableDynamicAnnotationExpression.java
new file mode 100644
index 0000000..2f020c7
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotatableDynamicAnnotationExpression.java
@@ -0,0 +1,38 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+
+abstract class AbstractClientAnnotatableDynamicAnnotationExpression
+ extends AbstractClientDynamicAnnotationExpression implements Annotatable {
+
+ private static final long serialVersionUID = -450668773857358139L;
+
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+ @Override
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotationExpression.java
new file mode 100644
index 0000000..18761be
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientAnnotationExpression.java
@@ -0,0 +1,49 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+
+public abstract class AbstractClientAnnotationExpression extends AbstractEdmItem implements AnnotationExpression {
+
+ private static final long serialVersionUID = -4238652997159205377L;
+
+ @Override
+ public boolean isConstant() {
+ return this instanceof ConstantAnnotationExpression;
+ }
+
+ @Override
+ public ConstantAnnotationExpression asConstant() {
+ return isConstant() ? (ConstantAnnotationExpression) this : null;
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return this instanceof DynamicAnnotationExpression;
+ }
+
+ @Override
+ public DynamicAnnotationExpression asDynamic() {
+ return isDynamic() ? (DynamicAnnotationExpression) this : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientDynamicAnnotationExpression.java
new file mode 100644
index 0000000..82e2d9f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientDynamicAnnotationExpression.java
@@ -0,0 +1,357 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonLocation;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
+import org.apache.olingo.commons.api.edm.provider.annotation.Cast;
+import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.If;
+import org.apache.olingo.commons.api.edm.provider.annotation.IsOf;
+import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElement;
+import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference;
+import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.Not;
+import org.apache.olingo.commons.api.edm.provider.annotation.Null;
+import org.apache.olingo.commons.api.edm.provider.annotation.Path;
+import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath;
+import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
+import org.apache.olingo.commons.api.edm.provider.annotation.Record;
+import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = AbstractClientDynamicAnnotationExpression.DynamicAnnotationExpressionDeserializer.class)
+public abstract class AbstractClientDynamicAnnotationExpression
+ extends AbstractClientAnnotationExpression implements DynamicAnnotationExpression {
+
+ private static final long serialVersionUID = 1093411847477874348L;
+
+ @Override
+ public boolean isNot() {
+ return this instanceof Not;
+ }
+
+ @Override
+ public Not asNot() {
+ return isNot() ? (Not) this : null;
+
+ }
+
+ @Override
+ public boolean isTwoParamsOp() {
+ return this instanceof TwoParamsOpDynamicAnnotationExpression;
+ }
+
+ @Override
+ public TwoParamsOpDynamicAnnotationExpression asTwoParamsOp() {
+ return isTwoParamsOp() ? (TwoParamsOpDynamicAnnotationExpression) this : null;
+ }
+
+ @Override
+ public boolean isAnnotationPath() {
+ return this instanceof AnnotationPath;
+ }
+
+ @Override
+ public AnnotationPath asAnnotationPath() {
+ return isAnnotationPath() ? (AnnotationPath) this : null;
+ }
+
+ @Override
+ public boolean isApply() {
+ return this instanceof Apply;
+ }
+
+ @Override
+ public Apply asApply() {
+ return isApply() ? (Apply) this : null;
+ }
+
+ @Override
+ public boolean isCast() {
+ return this instanceof Cast;
+ }
+
+ @Override
+ public Cast asCast() {
+ return isCast() ? (Cast) this : null;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return this instanceof Collection;
+ }
+
+ @Override
+ public Collection asCollection() {
+ return isCollection() ? (Collection) this : null;
+ }
+
+ @Override
+ public boolean isIf() {
+ return this instanceof If;
+ }
+
+ @Override
+ public If asIf() {
+ return isIf() ? (If) this : null;
+ }
+
+ @Override
+ public boolean isIsOf() {
+ return this instanceof IsOf;
+ }
+
+ @Override
+ public IsOf asIsOf() {
+ return isIsOf() ? (IsOf) this : null;
+ }
+
+ @Override
+ public boolean isLabeledElement() {
+ return this instanceof LabeledElement;
+ }
+
+ @Override
+ public LabeledElement asLabeledElement() {
+ return isLabeledElement() ? (LabeledElement) this : null;
+ }
+
+ @Override
+ public boolean isLabeledElementReference() {
+ return this instanceof LabeledElementReference;
+ }
+
+ @Override
+ public LabeledElementReference asLabeledElementReference() {
+ return isLabeledElementReference() ? (LabeledElementReference) this : null;
+ }
+
+ @Override
+ public boolean isNull() {
+ return this instanceof Null;
+ }
+
+ @Override
+ public Null asNull() {
+ return isNull() ? (Null) this : null;
+ }
+
+ @Override
+ public boolean isNavigationPropertyPath() {
+ return this instanceof NavigationPropertyPath;
+ }
+
+ @Override
+ public NavigationPropertyPath asNavigationPropertyPath() {
+ return isNavigationPropertyPath() ? (NavigationPropertyPath) this : null;
+ }
+
+ @Override
+ public boolean isPath() {
+ return this instanceof Path;
+ }
+
+ @Override
+ public Path asPath() {
+ return isPath() ? (Path) this : null;
+ }
+
+ @Override
+ public boolean isPropertyPath() {
+ return this instanceof PropertyPath;
+ }
+
+ @Override
+ public PropertyPath asPropertyPath() {
+ return isPropertyPath() ? (PropertyPath) this : null;
+ }
+
+ @Override
+ public boolean isPropertyValue() {
+ return this instanceof PropertyValue;
+ }
+
+ @Override
+ public PropertyValue asPropertyValue() {
+ return isPropertyValue() ? (PropertyValue) this : null;
+ }
+
+ @Override
+ public boolean isRecord() {
+ return this instanceof Record;
+ }
+
+ @Override
+ public Record asRecord() {
+ return isRecord() ? (Record) this : null;
+ }
+
+ @Override
+ public boolean isUrlRef() {
+ return this instanceof UrlRef;
+ }
+
+ @Override
+ public UrlRef asUrlRef() {
+ return isUrlRef() ? (UrlRef) this : null;
+ }
+
+ static class DynamicAnnotationExpressionDeserializer
+ extends AbstractClientEdmDeserializer<AbstractClientDynamicAnnotationExpression> {
+
+ private static final String[] EL_OR_ATTR = {
+ AnnotationPath.class.getSimpleName(), NavigationPropertyPath.class.getSimpleName(),
+ Path.class.getSimpleName(), PropertyPath.class.getSimpleName()
+ };
+
+ private static final String APPLY = Apply.class.getSimpleName();
+ private static final String CAST = Cast.class.getSimpleName();
+ private static final String COLLECTION = Collection.class.getSimpleName();
+ private static final String IF = If.class.getSimpleName();
+ private static final String IS_OF = IsOf.class.getSimpleName();
+ private static final String LABELED_ELEMENT = LabeledElement.class.getSimpleName();
+ private static final String NULL = Null.class.getSimpleName();
+ private static final String RECORD = Record.class.getSimpleName();
+ private static final String URL_REF = UrlRef.class.getSimpleName();
+
+ private AbstractClientElementOrAttributeExpression getElementOrAttributeExpression(final String simpleClassName)
+ throws JsonParseException {
+
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends AbstractClientElementOrAttributeExpression> elOrAttrClass =
+ (Class<? extends AbstractClientElementOrAttributeExpression>) ClassUtils.getClass(
+ getClass().getPackage().getName() + ".Client" + simpleClassName);
+ return elOrAttrClass.newInstance();
+ } catch (Exception e) {
+ throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e);
+ }
+ }
+
+ private AbstractClientAnnotationExpression parseConstOrEnumExpression(final JsonParser jp) throws IOException {
+ AbstractClientAnnotationExpression result;
+ if (isAnnotationConstExprConstruct(jp)) {
+ result = parseAnnotationConstExprConstruct(jp);
+ } else {
+ result = jp.readValueAs(AbstractClientDynamicAnnotationExpression.class);
+ }
+ jp.nextToken();
+
+ return result;
+ }
+
+ @Override
+ protected AbstractClientDynamicAnnotationExpression doDeserialize(final JsonParser jp,
+ final DeserializationContext ctxt) throws IOException {
+
+ AbstractClientDynamicAnnotationExpression expression = null;
+
+ if ("Not".equals(jp.getCurrentName())) {
+ final ClientNot not = new ClientNot();
+
+ jp.nextToken();
+ //Search for field name
+ while (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
+ jp.nextToken();
+ }
+ not.setExpression(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ //Search for end object
+ while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals("Not")) {
+ jp.nextToken();
+ }
+
+ expression = not;
+ } else if (TwoParamsOpDynamicAnnotationExpression.Type.fromString(jp.getCurrentName()) != null) {
+ final ClientTwoParamsOpDynamicAnnotationExpression dynExprDoubleParamOp =
+ new ClientTwoParamsOpDynamicAnnotationExpression();
+ dynExprDoubleParamOp.setType(TwoParamsOpDynamicAnnotationExpression.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ //Search for field name
+ while (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
+ jp.nextToken();
+ }
+ dynExprDoubleParamOp.setLeftExpression(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ dynExprDoubleParamOp.setRightExpression(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ //Search for expression
+ while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals(dynExprDoubleParamOp
+ .getType().name())) {
+ jp.nextToken();
+ }
+
+ expression = dynExprDoubleParamOp;
+ } else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) {
+ final AbstractClientElementOrAttributeExpression elOrAttr =
+ getElementOrAttributeExpression(jp.getCurrentName());
+ elOrAttr.setValue(jp.nextTextValue());
+ expression = elOrAttr;
+ } else if (APPLY.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientApply.class);
+ } else if (CAST.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCast.class);
+ } else if (COLLECTION.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCollection.class);
+ } else if (IF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ jp.nextToken();
+
+ final ClientIf ifImpl = new ClientIf();
+ ifImpl.setGuard(parseConstOrEnumExpression(jp));
+ ifImpl.setThen(parseConstOrEnumExpression(jp));
+ ifImpl.setElse(parseConstOrEnumExpression(jp));
+
+ expression = ifImpl;
+ } else if (IS_OF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientIsOf.class);
+ } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientLabeledElement.class);
+ } else if (NULL.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientNull.class);
+ } else if (RECORD.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientRecord.class);
+ } else if (URL_REF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientUrlRef.class);
+ }
+
+ return expression;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientElementOrAttributeExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientElementOrAttributeExpression.java
new file mode 100644
index 0000000..34601fd
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractClientElementOrAttributeExpression.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.client.core.edm.xml.annotation;
+
+/**
+ * Groups dynamic expressions that may be provided using element notation or attribute notation.
+ */
+abstract class AbstractClientElementOrAttributeExpression extends AbstractClientDynamicAnnotationExpression {
+
+ private static final long serialVersionUID = 1588336268773032932L;
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value = value;
+ }
+}
[10/11] olingo-odata4 git commit: [OLINGO-564] Renamed client edm
classes
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java
new file mode 100644
index 0000000..cea0c83
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationProperty.java
@@ -0,0 +1,80 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientNavigationProperty.NavigationPropertyDeserializer.class)
+public class ClientNavigationProperty extends NavigationProperty {
+
+ private static final long serialVersionUID = 6240231735592427582L;
+
+ static class NavigationPropertyDeserializer extends AbstractClientEdmDeserializer<NavigationProperty> {
+
+ @Override
+ protected NavigationProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final NavigationProperty property = new ClientNavigationProperty();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ property.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ String metadataTypeName = jp.nextTextValue();
+ if (metadataTypeName.startsWith("Collection(")) {
+ property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
+ metadataTypeName.length() - 1));
+ property.setCollection(true);
+ } else {
+ property.setType(metadataTypeName);
+ property.setCollection(false);
+ }
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Partner".equals(jp.getCurrentName())) {
+ property.setPartner(jp.nextTextValue());
+ } else if ("ContainsTarget".equals(jp.getCurrentName())) {
+ property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.getReferentialConstraints().add(jp.readValueAs(ClientReferentialConstraint.class));
+ } else if ("OnDelete".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.setOnDelete(jp.readValueAs(ClientOnDelete.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+ return property;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java
new file mode 100644
index 0000000..dae72f3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientNavigationPropertyBinding.java
@@ -0,0 +1,66 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientNavigationPropertyBinding.NavigationPropertyBindingDeserializer.class)
+public class ClientNavigationPropertyBinding extends NavigationPropertyBinding {
+
+ private static final long serialVersionUID = -7056978592235483660L;
+
+ @Override
+ public NavigationPropertyBinding setPath(final String path) {
+ super.setPath(path);
+ return this;
+ }
+
+ @Override
+ public NavigationPropertyBinding setTarget(final String target) {
+ super.setTarget(target);
+ return this;
+ }
+
+ static class NavigationPropertyBindingDeserializer extends AbstractClientEdmDeserializer<NavigationPropertyBinding> {
+ @Override
+ protected NavigationPropertyBinding doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientNavigationPropertyBinding member = new ClientNavigationPropertyBinding();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Path".equals(jp.getCurrentName())) {
+ member.setPath(jp.nextTextValue());
+ } else if ("Target".equals(jp.getCurrentName())) {
+ member.setTarget(jp.nextTextValue());
+ }
+ }
+ }
+ return member;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.java
new file mode 100644
index 0000000..398fd58
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientOnDelete.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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.commons.api.edm.provider.OnDelete;
+import org.apache.olingo.commons.api.edm.provider.OnDeleteAction;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientOnDelete.OnDeleteDeserializer.class)
+public class ClientOnDelete extends OnDelete {
+
+ private static final long serialVersionUID = -7130889202653716784L;
+
+ static class OnDeleteDeserializer extends AbstractClientEdmDeserializer<OnDelete> {
+ @Override
+ protected OnDelete doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final OnDelete ondelete = new ClientOnDelete();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Action".equals(jp.getCurrentName())) {
+ OnDeleteAction action = OnDeleteAction.valueOf(jp.nextTextValue());
+ ondelete.setAction(action);
+ }
+ }
+ }
+ return ondelete;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java
new file mode 100644
index 0000000..34f95cf
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientParameter.java
@@ -0,0 +1,84 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientParameter.ParameterDeserializer.class)
+public class ClientParameter extends Parameter {
+
+ private static final long serialVersionUID = 7119478691341167904L;
+
+ static class ParameterDeserializer extends AbstractClientEdmDeserializer<ClientParameter> {
+ @Override
+ protected ClientParameter doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientParameter parameter = new ClientParameter();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ parameter.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ String metadataTypeName = jp.nextTextValue();
+ if (metadataTypeName.startsWith("Collection(")) {
+ parameter.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
+ metadataTypeName.length() - 1));
+ parameter.setCollection(true);
+ } else {
+ parameter.setType(metadataTypeName);
+ parameter.setCollection(false);
+ }
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ parameter.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ final String maxLenght = jp.nextTextValue();
+ parameter.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ parameter.setPrecision(Integer.valueOf(jp.nextTextValue()));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ parameter.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ parameter.setSrid(SRID.valueOf(srid));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ parameter.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return parameter;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientProperty.java
new file mode 100644
index 0000000..920c383
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientProperty.java
@@ -0,0 +1,88 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Property;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientProperty.PropertyDeserializer.class)
+public class ClientProperty extends Property {
+
+ private static final long serialVersionUID = -4521766603286651372L;
+
+ static class PropertyDeserializer extends AbstractClientEdmDeserializer<ClientProperty> {
+ @Override
+ protected ClientProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientProperty property = new ClientProperty();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ property.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ String metadataTypeName = jp.nextTextValue();
+ if (metadataTypeName.startsWith("Collection(")) {
+ property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
+ metadataTypeName.length() - 1));
+ property.setCollection(true);
+ } else {
+ property.setType(metadataTypeName);
+ property.setCollection(false);
+ }
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("DefaultValue".equals(jp.getCurrentName())) {
+ property.setDefaultValue(jp.nextTextValue());
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ final String maxLenght = jp.nextTextValue();
+ property.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ property.setPrecision(Integer.valueOf(jp.nextTextValue()));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ property.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("Unicode".equals(jp.getCurrentName())) {
+ property.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ property.setSrid(SRID.valueOf(srid));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ property.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return property;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.java
new file mode 100644
index 0000000..82dc0b0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientPropertyRef.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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.commons.api.edm.provider.PropertyRef;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientPropertyRef.PropertyRefDeserializer.class)
+public class ClientPropertyRef extends PropertyRef {
+
+ private static final long serialVersionUID = 1504095609268590326L;
+
+ static class PropertyRefDeserializer extends AbstractClientEdmDeserializer<PropertyRef> {
+ @Override
+ protected PropertyRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final PropertyRef propertyRef = new ClientPropertyRef();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ propertyRef.setName(jp.nextTextValue());
+ } else if ("Alias".equals(jp.getCurrentName())) {
+ propertyRef.setAlias(jp.nextTextValue());
+ }
+ }
+ }
+ return propertyRef;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java
new file mode 100644
index 0000000..a989ba3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReference.java
@@ -0,0 +1,98 @@
+/*
+ * 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.client.core.edm.xml;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.api.edm.xml.Include;
+import org.apache.olingo.client.api.edm.xml.IncludeAnnotations;
+import org.apache.olingo.client.api.edm.xml.Reference;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientReference.ReferenceDeserializer.class)
+public class ClientReference extends AbstractEdmItem implements Reference {
+
+ private static final long serialVersionUID = 7720274712545267654L;
+
+ private URI uri;
+ private final List<Include> includes = new ArrayList<Include>();
+ private final List<IncludeAnnotations> includeAnnotations = new ArrayList<IncludeAnnotations>();
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+ @Override
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+ @Override
+ public URI getUri() {
+ return uri;
+ }
+
+ public void setUri(final URI uri) {
+ this.uri = uri;
+ }
+
+ @Override
+ public List<Include> getIncludes() {
+ return includes;
+ }
+
+ @Override
+ public List<IncludeAnnotations> getIncludeAnnotations() {
+ return includeAnnotations;
+ }
+
+ static class ReferenceDeserializer extends AbstractClientEdmDeserializer<ClientReference> {
+ @Override
+ protected ClientReference doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientReference reference = new ClientReference();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Uri".equals(jp.getCurrentName())) {
+ reference.setUri(URI.create(jp.nextTextValue()));
+ } else if ("Include".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ reference.getIncludes().add(jp.readValueAs( ClientInclude.class));
+ } else if ("IncludeAnnotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ reference.getIncludeAnnotations().add(jp.readValueAs( ClientIncludeAnnotations.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ reference.getAnnotations().add(jp.readValueAs( ClientAnnotation.class));
+ }
+ }
+ }
+
+ return reference;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.java
new file mode 100644
index 0000000..9524e74
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReferentialConstraint.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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientReferentialConstraint.ReferentialConstraintDeserializer.class)
+public class ClientReferentialConstraint extends ReferentialConstraint {
+
+ private static final long serialVersionUID = -5822115908069878139L;
+
+ static class ReferentialConstraintDeserializer extends AbstractClientEdmDeserializer<ReferentialConstraint> {
+ @Override
+ protected ReferentialConstraint doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ReferentialConstraint refConst = new ClientReferentialConstraint();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Property".equals(jp.getCurrentName())) {
+ refConst.setProperty(jp.nextTextValue());
+ } else if ("ReferencedProperty".equals(jp.getCurrentName())) {
+ refConst.setReferencedProperty(jp.nextTextValue());
+ }
+ }
+ }
+ return refConst;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java
new file mode 100644
index 0000000..587a189
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientReturnType.java
@@ -0,0 +1,78 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.ReturnType;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientReturnType.ReturnTypeDeserializer.class)
+public class ClientReturnType extends ReturnType {
+
+ private static final long serialVersionUID = 6261092793901735110L;
+
+ static class ReturnTypeDeserializer extends AbstractClientEdmDeserializer<ClientReturnType> {
+ @Override
+ protected ClientReturnType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientReturnType returnType = new ClientReturnType();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ String metadataTypeName = jp.nextTextValue();
+ if (metadataTypeName.startsWith("Collection(")) {
+ returnType.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
+ metadataTypeName.length() - 1));
+ returnType.setCollection(true);
+ } else {
+ returnType.setType(metadataTypeName);
+ returnType.setCollection(false);
+ }
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ returnType.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ final String maxLenght = jp.nextTextValue();
+ returnType.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ returnType.setPrecision(Integer.valueOf(jp.nextTextValue()));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ returnType.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ returnType.setSrid(SRID.valueOf(srid));
+ }
+ }
+ }
+ }
+
+ return returnType;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java
new file mode 100644
index 0000000..46e76cd
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSchema.java
@@ -0,0 +1,86 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientSchema.SchemaDeserializer.class)
+public class ClientSchema extends Schema {
+
+ private static final long serialVersionUID = 1911087363912024939L;
+
+ static class SchemaDeserializer extends AbstractClientEdmDeserializer<ClientSchema> {
+ @Override
+ protected ClientSchema doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientSchema schema = new ClientSchema();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Namespace".equals(jp.getCurrentName())) {
+ schema.setNamespace(jp.nextTextValue());
+ } else if ("Alias".equals(jp.getCurrentName())) {
+ schema.setAlias(jp.nextTextValue());
+ } else if ("ComplexType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getComplexTypes().add(jp.readValueAs(ClientComplexType.class));
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getEntityTypes().add(jp.readValueAs(ClientEntityType.class));
+ } else if ("EnumType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getEnumTypes().add(jp.readValueAs(ClientEnumType.class));
+ } else if ("EntityContainer".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ClientEntityContainer entityContainer = jp.readValueAs(ClientEntityContainer.class);
+ schema.setEntityContainer(entityContainer);
+ } else if ("Action".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getActions().add(jp.readValueAs(ClientAction.class));
+ } else if ("Function".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getFunctions().add(jp.readValueAs(ClientFunction.class));
+ } else if ("TypeDefinition".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getTypeDefinitions().add(jp.readValueAs(ClientTypeDefinition.class));
+ }
+ } else if ("Annotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getAnnotationGroups().add(jp.readValueAs(ClientAnnotations.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else if ("Term".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ schema.getTerms().add(jp.readValueAs(ClientTerm.class));
+ }
+ }
+
+ return schema;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java
new file mode 100644
index 0000000..efe25ea
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientSingleton.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.commons.api.edm.provider.Singleton;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientSingleton.SingletonDeserializer.class)
+public class ClientSingleton extends Singleton {
+
+ private static final long serialVersionUID = 1656749615107151921L;
+
+ static class SingletonDeserializer extends AbstractClientEdmDeserializer<ClientSingleton> {
+ @Override
+ protected ClientSingleton doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientSingleton singleton = new ClientSingleton();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ singleton.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ singleton.setType(jp.nextTextValue());
+ } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ singleton.getNavigationPropertyBindings().add(
+ jp.readValueAs(ClientNavigationPropertyBinding.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ singleton.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return singleton;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java
new file mode 100644
index 0000000..b343ee9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTerm.java
@@ -0,0 +1,83 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Term;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+@JsonDeserialize(using = ClientTerm.TermDeserializer.class)
+public class ClientTerm extends Term {
+
+ private static final long serialVersionUID = -8350072064720586186L;
+
+ static class TermDeserializer extends AbstractClientEdmDeserializer<ClientTerm> {
+ @Override
+ protected ClientTerm doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientTerm term = new ClientTerm();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ term.setName(jp.nextTextValue());
+ } else if ("Type".equals(jp.getCurrentName())) {
+ term.setType(jp.nextTextValue());
+ } else if ("BaseTerm".equals(jp.getCurrentName())) {
+ term.setBaseTerm(jp.nextTextValue());
+ } else if ("DefaultValue".equals(jp.getCurrentName())) {
+ term.setDefaultValue(jp.nextTextValue());
+ } else if ("Nullable".equals(jp.getCurrentName())) {
+ term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ final String maxLenght = jp.nextTextValue();
+ term.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ term.setPrecision(Integer.valueOf(jp.nextTextValue()));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ term.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ term.setSrid(SRID.valueOf(srid));
+ }
+ } else if ("AppliesTo".equals(jp.getCurrentName())) {
+ term.getAppliesTo().addAll(Arrays.asList(StringUtils.split(jp.nextTextValue())));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ term.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return term;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java
new file mode 100644
index 0000000..87e2bb8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientTypeDefinition.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientTypeDefinition.TypeDefinitionDeserializer.class)
+public class ClientTypeDefinition extends TypeDefinition {
+
+ private static final long serialVersionUID = -902407149079419602L;
+
+ static class TypeDefinitionDeserializer extends AbstractClientEdmDeserializer<ClientTypeDefinition> {
+ @Override
+ protected ClientTypeDefinition doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientTypeDefinition typeDefinition = new ClientTypeDefinition();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ typeDefinition.setName(jp.nextTextValue());
+ } else if ("UnderlyingType".equals(jp.getCurrentName())) {
+ typeDefinition.setUnderlyingType(jp.nextTextValue());
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ typeDefinition.setMaxLength(jp.nextIntValue(0));
+ } else if ("Unicode".equals(jp.getCurrentName())) {
+ typeDefinition.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ typeDefinition.setPrecision(jp.nextIntValue(0));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ typeDefinition.setSrid(SRID.valueOf(srid));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ typeDefinition.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return typeDefinition;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientXMLMetadata.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientXMLMetadata.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientXMLMetadata.java
new file mode 100644
index 0000000..680e622
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientXMLMetadata.java
@@ -0,0 +1,75 @@
+/*
+ * 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.client.core.edm.xml;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.edm.xml.Edmx;
+import org.apache.olingo.client.api.edm.xml.Reference;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+
+/**
+ * Entry point for access information about EDM metadata.
+ */
+public class ClientXMLMetadata extends AbstractEdmItem implements XMLMetadata {
+
+ private static final long serialVersionUID = 6025723060298454901L;
+ protected final Edmx edmx;
+
+ public ClientXMLMetadata(final Edmx edmx) {
+ this.edmx = edmx;
+ }
+
+ @Override
+ public List<Schema> getSchemas() {
+ return this.edmx.getDataServices().getSchemas();
+ }
+
+ @Override
+ public Schema getSchema(final int index) {
+ return getSchemas().get(index);
+ }
+
+ @Override
+ public Schema getSchema(final String key) {
+ return getSchemaByNsOrAlias().get(key);
+ }
+
+ @Override
+ public Map<String, Schema> getSchemaByNsOrAlias() {
+ final Map<String, Schema> schemaByNsOrAlias = new HashMap<String, Schema>();
+ for (Schema schema : getSchemas()) {
+ schemaByNsOrAlias.put(schema.getNamespace(), schema);
+ if (StringUtils.isNotBlank(schema.getAlias())) {
+ schemaByNsOrAlias.put(schema.getAlias(), schema);
+ }
+ }
+ return schemaByNsOrAlias;
+ }
+
+ @Override
+ public List<Reference> getReferences() {
+ return this.edmx.getReferences();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeImpl.java
deleted file mode 100644
index af0b1d6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ComplexTypeImpl.java
+++ /dev/null
@@ -1,72 +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 >ied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.ComplexType;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ComplexTypeImpl.ComplexTypeDeserializer.class)
-public class ComplexTypeImpl extends ComplexType {
-
- private static final long serialVersionUID = 4076944306925840115L;
-
- static class ComplexTypeDeserializer extends AbstractEdmDeserializer<ComplexType> {
-
- @Override
- protected ComplexType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final ComplexTypeImpl complexType = new ComplexTypeImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- complexType.setName(jp.nextTextValue());
- } else if ("Abstract".equals(jp.getCurrentName())) {
- complexType.setAbstract(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("BaseType".equals(jp.getCurrentName())) {
- complexType.setBaseType(jp.nextTextValue());
- } else if ("OpenType".equals(jp.getCurrentName())) {
- complexType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Property".equals(jp.getCurrentName())) {
- jp.nextToken();
- complexType.getProperties().add(jp.readValueAs(PropertyImpl.class));
- } else if ("NavigationProperty".equals(jp.getCurrentName())) {
- jp.nextToken();
- complexType.getNavigationProperties().add(jp.readValueAs(NavigationPropertyImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- complexType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return complexType;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesImpl.java
deleted file mode 100644
index e446e29..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/DataServicesImpl.java
+++ /dev/null
@@ -1,93 +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.client.core.edm.xml;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.api.edm.xml.DataServices;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-import org.apache.olingo.commons.api.edm.provider.Schema;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = DataServicesImpl.DataServicesDeserializer.class)
-public class DataServicesImpl extends AbstractEdmItem implements DataServices {
-
- private static final long serialVersionUID = 4200317286476885204L;
-
- private final List<Schema> schemas = new ArrayList<Schema>();
-
- private String dataServiceVersion;
-
- private String maxDataServiceVersion;
-
- @Override
- public String getDataServiceVersion() {
- return dataServiceVersion;
- }
-
- public void setDataServiceVersion(final String version) {
- this.dataServiceVersion = version;
- }
-
- @Override
- public String getMaxDataServiceVersion() {
- return maxDataServiceVersion;
- }
-
- public void setMaxDataServiceVersion(final String version) {
- this.maxDataServiceVersion = version;
- }
-
- @Override
- public List<Schema> getSchemas() {
- return schemas;
- }
-
- static class DataServicesDeserializer extends AbstractEdmDeserializer<DataServicesImpl> {
-
- @Override
- protected DataServicesImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final DataServicesImpl dataServices = new DataServicesImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("DataServiceVersion".equals(jp.getCurrentName())) {
- dataServices.setDataServiceVersion(jp.nextTextValue());
- } else if ("MaxDataServiceVersion".equals(jp.getCurrentName())) {
- dataServices.setMaxDataServiceVersion(jp.nextTextValue());
- } else if ("Schema".equals(jp.getCurrentName())) {
- jp.nextToken();
- dataServices.getSchemas().add(jp.readValueAs(SchemaImpl.class));
- }
- }
- }
-
- return dataServices;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxImpl.java
deleted file mode 100644
index 6eb7365..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EdmxImpl.java
+++ /dev/null
@@ -1,95 +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.client.core.edm.xml;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.api.edm.xml.DataServices;
-import org.apache.olingo.client.api.edm.xml.Edmx;
-import org.apache.olingo.client.api.edm.xml.Reference;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = EdmxImpl.EdmxDeserializer.class)
-public class EdmxImpl extends AbstractEdmItem implements Edmx {
-
- private static final long serialVersionUID = -6293476719276092572L;
-
- private final List<Reference> references = new ArrayList<Reference>();
-
- private String version;
-
- private DataServices dataServices;
-
- @Override
- public String getVersion() {
- return version;
- }
-
- public void setVersion(final String version) {
- this.version = version;
- }
-
- @Override
- public DataServices getDataServices() {
- return dataServices;
- }
-
- public void setDataServices(final DataServices dataServices) {
- this.dataServices = dataServices;
- }
-
- @Override
- public List<Reference> getReferences() {
- return references;
- }
-
- static class EdmxDeserializer extends AbstractEdmDeserializer<EdmxImpl> {
-
- @Override
- protected EdmxImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EdmxImpl edmx = new EdmxImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Version".equals(jp.getCurrentName())) {
- edmx.setVersion(jp.nextTextValue());
- } else if ("DataServices".equals(jp.getCurrentName())) {
- jp.nextToken();
- edmx.setDataServices(jp.readValueAs(DataServicesImpl.class));
- } else if ("Reference".equals(jp.getCurrentName())) {
- jp.nextToken();
- edmx.getReferences().add(jp.readValueAs(ReferenceImpl.class));
- }
- }
- }
-
- return edmx;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerImpl.java
deleted file mode 100644
index 4d0abe6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityContainerImpl.java
+++ /dev/null
@@ -1,72 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.commons.api.edm.provider.EntityContainer;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = EntityContainerImpl.EntityContainerDeserializer.class)
-public class EntityContainerImpl extends EntityContainer {
-
- private static final long serialVersionUID = 5631432527646955795L;
-
- static class EntityContainerDeserializer extends AbstractEdmDeserializer<EntityContainerImpl> {
-
- @Override
- protected EntityContainerImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EntityContainerImpl entityContainer = new EntityContainerImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- entityContainer.setName(jp.nextTextValue());
- } else if ("Extends".equals(jp.getCurrentName())) {
- entityContainer.setExtendsContainer(jp.nextTextValue());
- } else if ("EntitySet".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityContainer.getEntitySets().add(jp.readValueAs(EntitySetImpl.class));
- } else if ("Singleton".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityContainer.getSingletons().add(jp.readValueAs(SingletonImpl.class));
- } else if ("ActionImport".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityContainer.getActionImports().add(jp.readValueAs(ActionImportImpl.class));
- } else if ("FunctionImport".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityContainer.getFunctionImports().add(jp.readValueAs(FunctionImportImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityContainer.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entityContainer;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
deleted file mode 100644
index 0dc07d0..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityKeyImpl.java
+++ /dev/null
@@ -1,63 +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.client.core.edm.xml;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
-import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = EntityKeyImpl.EntityKeyDeserializer.class)
-public class EntityKeyImpl extends AbstractEdmItem {
-
- private static final long serialVersionUID = 520227585458843347L;
-
- private final List<PropertyRef> propertyRefs = new ArrayList<PropertyRef>();
-
- public List<PropertyRef> getPropertyRefs() {
- return propertyRefs;
- }
-
- static class EntityKeyDeserializer extends AbstractEdmDeserializer<EntityKeyImpl> {
- @Override
- protected EntityKeyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EntityKeyImpl entityKey = new EntityKeyImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
-
- if (token == JsonToken.FIELD_NAME && "PropertyRef".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityKey.getPropertyRefs().add(jp.readValueAs(PropertyRefImpl.class));
- }
- }
-
- return entityKey;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetImpl.java
deleted file mode 100644
index 0368225..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntitySetImpl.java
+++ /dev/null
@@ -1,65 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.EntitySet;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = EntitySetImpl.EntitySetDeserializer.class)
-public class EntitySetImpl extends EntitySet {
-
- private static final long serialVersionUID = -5553885465204370676L;
-
- static class EntitySetDeserializer extends AbstractEdmDeserializer<EntitySet> {
- @Override
- protected EntitySet doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EntitySetImpl entitySet = new EntitySetImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- entitySet.setName(jp.nextTextValue());
- } else if ("EntityType".equals(jp.getCurrentName())) {
- entitySet.setType(jp.nextTextValue());
- } else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
- entitySet.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
- jp.nextToken();
- entitySet.getNavigationPropertyBindings().add(jp.readValueAs(NavigationPropertyBindingImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- entitySet.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entitySet;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeImpl.java
deleted file mode 100644
index f54ff27..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EntityTypeImpl.java
+++ /dev/null
@@ -1,76 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.EntityType;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = EntityTypeImpl.EntityTypeDeserializer.class)
-public class EntityTypeImpl extends EntityType {
-
- private static final long serialVersionUID = -3986417775876689669L;
-
- static class EntityTypeDeserializer extends AbstractEdmDeserializer<EntityType> {
- @Override
- protected EntityType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EntityTypeImpl entityType = new EntityTypeImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- entityType.setName(jp.nextTextValue());
- } else if ("Abstract".equals(jp.getCurrentName())) {
- entityType.setAbstract(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("BaseType".equals(jp.getCurrentName())) {
- entityType.setBaseType(jp.nextTextValue());
- } else if ("OpenType".equals(jp.getCurrentName())) {
- entityType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("HasStream".equals(jp.getCurrentName())) {
- entityType.setHasStream(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Key".equals(jp.getCurrentName())) {
- jp.nextToken();
- EntityKeyImpl keyImpl = jp.readValueAs(EntityKeyImpl.class);
- entityType.setKey(keyImpl.getPropertyRefs());
- } else if ("Property".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityType.getProperties().add(jp.readValueAs(PropertyImpl.class));
- } else if ("NavigationProperty".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityType.getNavigationProperties().add(jp.readValueAs(NavigationPropertyImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- entityType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return entityType;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumMemberImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumMemberImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumMemberImpl.java
deleted file mode 100644
index 74588a1..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumMemberImpl.java
+++ /dev/null
@@ -1,57 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.commons.api.edm.provider.EnumMember;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = EnumMemberImpl.EnumMemberDeserializer.class)
-public class EnumMemberImpl extends EnumMember {
-
- private static final long serialVersionUID = -6138606817225829791L;
-
- static class EnumMemberDeserializer extends AbstractEdmDeserializer<EnumMember> {
- @Override
- protected EnumMember doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EnumMember member = new EnumMember();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- member.setName(jp.nextTextValue());
- } else if ("Value".equals(jp.getCurrentName())) {
- member.setValue(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- member.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
- return member;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeImpl.java
deleted file mode 100644
index bd05df6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/EnumTypeImpl.java
+++ /dev/null
@@ -1,65 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.EnumType;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = EnumTypeImpl.EnumTypeDeserializer.class)
-public class EnumTypeImpl extends EnumType {
-
- private static final long serialVersionUID = 9191189755592743333L;
-
- static class EnumTypeDeserializer extends AbstractEdmDeserializer<EnumTypeImpl> {
- @Override
- protected EnumTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final EnumTypeImpl enumType = new EnumTypeImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- enumType.setName(jp.nextTextValue());
- } else if ("UnderlyingType".equals(jp.getCurrentName())) {
- enumType.setUnderlyingType(jp.nextTextValue());
- } else if ("IsFlags".equals(jp.getCurrentName())) {
- enumType.setFlags(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("Member".equals(jp.getCurrentName())) {
- jp.nextToken();
- enumType.getMembers().add(jp.readValueAs(EnumMemberImpl.class));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- enumType.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return enumType;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImpl.java
deleted file mode 100644
index d1e1d2c..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/FunctionImpl.java
+++ /dev/null
@@ -1,69 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.Function;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = FunctionImpl.FunctionDeserializer.class)
-public class FunctionImpl extends Function {
-
- private static final long serialVersionUID = -5494898295282843362L;
-
- static class FunctionDeserializer extends AbstractEdmDeserializer<FunctionImpl> {
- @Override
- protected FunctionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final FunctionImpl functionImpl = new FunctionImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- functionImpl.setName(jp.nextTextValue());
- } else if ("IsBound".equals(jp.getCurrentName())) {
- functionImpl.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("IsComposable".equals(jp.getCurrentName())) {
- functionImpl.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("EntitySetPath".equals(jp.getCurrentName())) {
- functionImpl.setEntitySetPath(jp.nextTextValue());
- } else if ("Parameter".equals(jp.getCurrentName())) {
- jp.nextToken();
- functionImpl.getParameters().add(jp.readValueAs(ParameterImpl.class));
- } else if ("ReturnType".equals(jp.getCurrentName())) {
- functionImpl.setReturnType(parseReturnType(jp, "Function"));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- functionImpl.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return functionImpl;
- }
- }
-}
[11/11] olingo-odata4 git commit: [OLINGO-564] Renamed client edm
classes
Posted by mi...@apache.org.
[OLINGO-564] Renamed client 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/754e23ab
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/754e23ab
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/754e23ab
Branch: refs/heads/OLINGO-564
Commit: 754e23abee9918bf6eca6bcbf97e4d1007b0b910
Parents: cceceaf
Author: Michael Bolz <mi...@sap.com>
Authored: Thu Apr 23 15:57:22 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Thu Apr 23 15:57:22 2015 +0200
----------------------------------------------------------------------
.../retrieve/XMLMetadataRequestImpl.java | 10 +-
.../edm/xml/AbstractClientEdmDeserializer.java | 62 ++++
.../core/edm/xml/AbstractEdmDeserializer.java | 61 ----
.../olingo/client/core/edm/xml/ActionImpl.java | 68 ----
.../client/core/edm/xml/ActionImportImpl.java | 58 ---
.../client/core/edm/xml/AnnotationImpl.java | 67 ----
.../client/core/edm/xml/AnnotationsImpl.java | 62 ----
.../client/core/edm/xml/ClientAction.java | 68 ++++
.../client/core/edm/xml/ClientActionImport.java | 58 +++
.../client/core/edm/xml/ClientAnnotation.java | 67 ++++
.../client/core/edm/xml/ClientAnnotations.java | 62 ++++
.../client/core/edm/xml/ClientComplexType.java | 72 ++++
.../client/core/edm/xml/ClientDataServices.java | 93 +++++
.../olingo/client/core/edm/xml/ClientEdmx.java | 95 +++++
.../core/edm/xml/ClientEntityContainer.java | 72 ++++
.../client/core/edm/xml/ClientEntityKey.java | 63 ++++
.../client/core/edm/xml/ClientEntitySet.java | 65 ++++
.../client/core/edm/xml/ClientEntityType.java | 76 ++++
.../client/core/edm/xml/ClientEnumMember.java | 57 +++
.../client/core/edm/xml/ClientEnumType.java | 65 ++++
.../client/core/edm/xml/ClientFunction.java | 69 ++++
.../core/edm/xml/ClientFunctionImport.java | 64 ++++
.../client/core/edm/xml/ClientInclude.java | 76 ++++
.../core/edm/xml/ClientIncludeAnnotations.java | 88 +++++
.../core/edm/xml/ClientNavigationProperty.java | 80 +++++
.../xml/ClientNavigationPropertyBinding.java | 66 ++++
.../client/core/edm/xml/ClientOnDelete.java | 54 +++
.../client/core/edm/xml/ClientParameter.java | 84 +++++
.../client/core/edm/xml/ClientProperty.java | 88 +++++
.../client/core/edm/xml/ClientPropertyRef.java | 54 +++
.../client/core/edm/xml/ClientReference.java | 98 +++++
.../edm/xml/ClientReferentialConstraint.java | 54 +++
.../client/core/edm/xml/ClientReturnType.java | 78 ++++
.../client/core/edm/xml/ClientSchema.java | 86 +++++
.../client/core/edm/xml/ClientSingleton.java | 62 ++++
.../olingo/client/core/edm/xml/ClientTerm.java | 83 +++++
.../core/edm/xml/ClientTypeDefinition.java | 74 ++++
.../client/core/edm/xml/ClientXMLMetadata.java | 75 ++++
.../client/core/edm/xml/ComplexTypeImpl.java | 72 ----
.../client/core/edm/xml/DataServicesImpl.java | 93 -----
.../olingo/client/core/edm/xml/EdmxImpl.java | 95 -----
.../core/edm/xml/EntityContainerImpl.java | 72 ----
.../client/core/edm/xml/EntityKeyImpl.java | 63 ----
.../client/core/edm/xml/EntitySetImpl.java | 65 ----
.../client/core/edm/xml/EntityTypeImpl.java | 76 ----
.../client/core/edm/xml/EnumMemberImpl.java | 57 ---
.../client/core/edm/xml/EnumTypeImpl.java | 65 ----
.../client/core/edm/xml/FunctionImpl.java | 69 ----
.../client/core/edm/xml/FunctionImportImpl.java | 64 ----
.../core/edm/xml/IncludeAnnotationsImpl.java | 88 -----
.../olingo/client/core/edm/xml/IncludeImpl.java | 76 ----
.../edm/xml/NavigationPropertyBindingImpl.java | 66 ----
.../core/edm/xml/NavigationPropertyImpl.java | 80 -----
.../client/core/edm/xml/OnDeleteImpl.java | 54 ---
.../client/core/edm/xml/ParameterImpl.java | 84 -----
.../client/core/edm/xml/PropertyImpl.java | 88 -----
.../client/core/edm/xml/PropertyRefImpl.java | 54 ---
.../client/core/edm/xml/ReferenceImpl.java | 98 -----
.../core/edm/xml/ReferentialConstraintImpl.java | 54 ---
.../client/core/edm/xml/ReturnTypeImpl.java | 78 ----
.../olingo/client/core/edm/xml/SchemaImpl.java | 86 -----
.../client/core/edm/xml/SingletonImpl.java | 62 ----
.../olingo/client/core/edm/xml/TermImpl.java | 83 -----
.../client/core/edm/xml/TypeDefinitionImpl.java | 74 ----
.../client/core/edm/xml/XMLMetadataImpl.java | 75 ----
...tAnnotatableDynamicAnnotationExpression.java | 38 --
.../AbstractAnnotationExpression.java | 49 ---
...tAnnotatableDynamicAnnotationExpression.java | 38 ++
.../AbstractClientAnnotationExpression.java | 49 +++
...stractClientDynamicAnnotationExpression.java | 357 +++++++++++++++++++
...tractClientElementOrAttributeExpression.java | 37 ++
.../AbstractDynamicAnnotationExpression.java | 356 ------------------
.../AbstractElementOrAttributeExpression.java | 37 --
.../edm/xml/annotation/AnnotationPathImpl.java | 27 --
.../core/edm/xml/annotation/ApplyImpl.java | 82 -----
.../core/edm/xml/annotation/CastImpl.java | 139 --------
.../xml/annotation/ClientAnnotationPath.java | 27 ++
.../core/edm/xml/annotation/ClientApply.java | 82 +++++
.../core/edm/xml/annotation/ClientCast.java | 139 ++++++++
.../edm/xml/annotation/ClientCollection.java | 65 ++++
.../ClientConstantAnnotationExpression.java | 52 +++
.../core/edm/xml/annotation/ClientIf.java | 61 ++++
.../core/edm/xml/annotation/ClientIsOf.java | 138 +++++++
.../xml/annotation/ClientLabeledElement.java | 81 +++++
.../ClientLabeledElementReference.java | 28 ++
.../ClientNavigationPropertyPath.java | 28 ++
.../core/edm/xml/annotation/ClientNot.java | 39 ++
.../core/edm/xml/annotation/ClientNull.java | 53 +++
.../core/edm/xml/annotation/ClientPath.java | 27 ++
.../edm/xml/annotation/ClientPropertyPath.java | 27 ++
.../edm/xml/annotation/ClientPropertyValue.java | 82 +++++
.../core/edm/xml/annotation/ClientRecord.java | 78 ++++
...tTwoParamsOpDynamicAnnotationExpression.java | 62 ++++
.../core/edm/xml/annotation/ClientUrlRef.java | 66 ++++
.../core/edm/xml/annotation/CollectionImpl.java | 65 ----
.../ConstantAnnotationExpressionImpl.java | 52 ---
.../client/core/edm/xml/annotation/IfImpl.java | 61 ----
.../core/edm/xml/annotation/IsOfImpl.java | 138 -------
.../edm/xml/annotation/LabeledElementImpl.java | 81 -----
.../annotation/LabeledElementReferenceImpl.java | 28 --
.../annotation/NavigationPropertyPathImpl.java | 27 --
.../client/core/edm/xml/annotation/NotImpl.java | 39 --
.../core/edm/xml/annotation/NullImpl.java | 53 ---
.../core/edm/xml/annotation/PathImpl.java | 27 --
.../edm/xml/annotation/PropertyPathImpl.java | 27 --
.../edm/xml/annotation/PropertyValueImpl.java | 82 -----
.../core/edm/xml/annotation/RecordImpl.java | 78 ----
...ParamsOpDynamicAnnotationExpressionImpl.java | 62 ----
.../core/edm/xml/annotation/UrlRefImpl.java | 66 ----
.../ClientODataDeserializerImpl.java | 6 +-
.../olingo/client/core/uri/URIEscapeTest.java | 4 +-
.../client/core/uri/v4/FilterFactoryTest.java | 4 +-
.../olingo/client/core/v4/MetadataTest.java | 10 +-
113 files changed, 3941 insertions(+), 3938 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
index 20d1da1..510c9e6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/XMLMetadataRequestImpl.java
@@ -31,8 +31,8 @@ import org.apache.olingo.client.api.edm.xml.Include;
import org.apache.olingo.client.api.edm.xml.IncludeAnnotations;
import org.apache.olingo.client.api.edm.xml.Reference;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.client.core.edm.xml.AnnotationsImpl;
-import org.apache.olingo.client.core.edm.xml.SchemaImpl;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotations;
+import org.apache.olingo.client.core.edm.xml.ClientSchema;
import org.apache.olingo.commons.api.edm.provider.Annotation;
import org.apache.olingo.commons.api.edm.provider.Annotations;
import org.apache.olingo.commons.api.edm.provider.Schema;
@@ -68,7 +68,7 @@ public class XMLMetadataRequestImpl
if (includedSchema != null) {
response.getBody().getSchemas().add(includedSchema);
if (StringUtils.isNotBlank(include.getAlias())) {
- ((SchemaImpl) includedSchema).setAlias(include.getAlias());
+ ((ClientSchema) includedSchema).setAlias(include.getAlias());
}
}
}
@@ -77,7 +77,7 @@ public class XMLMetadataRequestImpl
for (IncludeAnnotations include : reference.getIncludeAnnotations()) {
for (Schema schema : includeMetadata.getSchemas()) {
// create empty schema that will be fed with edm:Annotations that match the criteria in IncludeAnnotations
- final SchemaImpl forInclusion = new SchemaImpl();
+ final ClientSchema forInclusion = new ClientSchema();
forInclusion.setNamespace(schema.getNamespace());
forInclusion.setAlias(schema.getAlias());
@@ -91,7 +91,7 @@ public class XMLMetadataRequestImpl
&& (StringUtils.isBlank(include.getQualifier())
|| include.getQualifier().equals(annotationGroup.getQualifier()))) {
- final AnnotationsImpl toBeIncluded = new AnnotationsImpl();
+ final ClientAnnotations toBeIncluded = new ClientAnnotations();
toBeIncluded.setTarget(annotationGroup.getTarget());
toBeIncluded.setQualifier(annotationGroup.getQualifier());
// only import annotations with terms matching the given TermNamespace
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java
new file mode 100644
index 0000000..e02c054
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.xml;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.edm.xml.annotation.ClientConstantAnnotationExpression;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
+
+public abstract class AbstractClientEdmDeserializer<T> extends JsonDeserializer<T> {
+
+ protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ return ClientConstantAnnotationExpression.Type.fromString(jp.getCurrentName()) != null;
+ }
+
+ protected ClientConstantAnnotationExpression parseAnnotationConstExprConstruct(final JsonParser jp)
+ throws IOException {
+ final ClientConstantAnnotationExpression constExpr = new ClientConstantAnnotationExpression();
+ constExpr.setType(ClientConstantAnnotationExpression.Type.fromString(jp.getCurrentName()));
+ constExpr.setValue(jp.nextTextValue());
+ return constExpr;
+ }
+
+ protected ClientReturnType parseReturnType(final JsonParser jp, final String elementName) throws IOException {
+ final ClientReturnType returnType;
+ if (elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName())) {
+ returnType = new ClientReturnType();
+ returnType.setType(jp.nextTextValue());
+ } else {
+ jp.nextToken();
+ returnType = jp.readValueAs(ClientReturnType.class);
+ }
+ return returnType;
+ }
+
+ protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt) throws IOException;
+
+ @Override
+ public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
+ return doDeserialize(jp, ctxt);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
deleted file mode 100644
index 6453431..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractEdmDeserializer.java
+++ /dev/null
@@ -1,61 +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.client.core.edm.xml;
-
-import java.io.IOException;
-
-import org.apache.olingo.client.core.edm.xml.annotation.ConstantAnnotationExpressionImpl;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
-
-public abstract class AbstractEdmDeserializer<T> extends JsonDeserializer<T> {
-
- protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
- return ConstantAnnotationExpressionImpl.Type.fromString(jp.getCurrentName()) != null;
- }
-
- protected ConstantAnnotationExpressionImpl parseAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
- final ConstantAnnotationExpressionImpl constExpr = new ConstantAnnotationExpressionImpl();
- constExpr.setType(ConstantAnnotationExpressionImpl.Type.fromString(jp.getCurrentName()));
- constExpr.setValue(jp.nextTextValue());
- return constExpr;
- }
-
- protected ReturnTypeImpl parseReturnType(final JsonParser jp, final String elementName) throws IOException {
- final ReturnTypeImpl returnType;
- if (elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName())) {
- returnType = new ReturnTypeImpl();
- returnType.setType(jp.nextTextValue());
- } else {
- jp.nextToken();
- returnType = jp.readValueAs(ReturnTypeImpl.class);
- }
- return returnType;
- }
-
- protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt) throws IOException;
-
- @Override
- public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
- return doDeserialize(jp, ctxt);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImpl.java
deleted file mode 100644
index 3aaedba..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImpl.java
+++ /dev/null
@@ -1,68 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.olingo.commons.api.edm.provider.Action;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ActionImpl.ActionDeserializer.class)
-public class ActionImpl extends Action {
-
- private static final long serialVersionUID = 5321541275349234088L;
-
- static class ActionDeserializer extends AbstractEdmDeserializer<ActionImpl> {
-
- @Override
- protected ActionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final ActionImpl action = new ActionImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Name".equals(jp.getCurrentName())) {
- action.setName(jp.nextTextValue());
- } else if ("IsBound".equals(jp.getCurrentName())) {
- action.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
- } else if ("EntitySetPath".equals(jp.getCurrentName())) {
- action.setEntitySetPath(jp.nextTextValue());
- } else if ("Parameter".equals(jp.getCurrentName())) {
- jp.nextToken();
- action.getParameters().add(jp.readValueAs(ParameterImpl.class));
- } else if ("ReturnType".equals(jp.getCurrentName())) {
- action.setReturnType(parseReturnType(jp, "Action"));
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- action.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return action;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImportImpl.java
deleted file mode 100644
index 7b834a0..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ActionImportImpl.java
+++ /dev/null
@@ -1,58 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import org.apache.olingo.commons.api.edm.provider.ActionImport;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ActionImportImpl.ActionImportDeserializer.class)
-public class ActionImportImpl extends ActionImport {
-
- private static final long serialVersionUID = 2971468441177647068L;
-
- static class ActionImportDeserializer extends AbstractEdmDeserializer<ActionImportImpl> {
-
- @Override
- protected ActionImportImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final ActionImportImpl action = new ActionImportImpl();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Action".equals(jp.getCurrentName())) {
- action.setAction(jp.nextTextValue());
- } else if ("Name".equals(jp.getCurrentName())) {
- action.setName(jp.nextTextValue());
- } else if ("EntitySet".equals(jp.getCurrentName())) {
- action.setEntitySet(jp.nextTextValue());
- }
- }
- }
-
- return action;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationImpl.java
deleted file mode 100644
index 95939ec..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationImpl.java
+++ /dev/null
@@ -1,67 +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.client.core.edm.xml;
-
-import java.io.IOException;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.annotation.AbstractDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = AnnotationImpl.AnnotationDeserializer.class)
-public class AnnotationImpl extends Annotation {
-
- private static final long serialVersionUID = 5464714417411058033L;
-
- static class AnnotationDeserializer extends AbstractEdmDeserializer<Annotation> {
-
- @Override
- protected Annotation doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final AnnotationImpl annotation = new AnnotationImpl();
-
- for (; jp.getCurrentToken() != null && jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Term".equals(jp.getCurrentName())) {
- annotation.setTerm(jp.nextTextValue());
- } else if ("Qualifier".equals(jp.getCurrentName())) {
- annotation.setQualifier(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- annotation.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else if (isAnnotationConstExprConstruct(jp)) {
- // Constant Expressions
- annotation.setExpression(parseAnnotationConstExprConstruct(jp));
- } else {
- // Dynamic Expressions
- annotation.setExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
-
- return annotation;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationsImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationsImpl.java
deleted file mode 100644
index 21aff68..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AnnotationsImpl.java
+++ /dev/null
@@ -1,62 +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.client.core.edm.xml;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.commons.api.edm.provider.Annotations;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = AnnotationsImpl.AnnotationsDeserializer.class)
-public class AnnotationsImpl extends Annotations {
-
- private static final long serialVersionUID = -5961207981571644200L;
-
- static class AnnotationsDeserializer extends AbstractEdmDeserializer<AnnotationsImpl> {
-
- @Override
- protected AnnotationsImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- final AnnotationsImpl annotations = new AnnotationsImpl();
-
- for (; jp.getCurrentToken() != null && jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Target".equals(jp.getCurrentName())) {
- annotations.setTarget(jp.nextTextValue());
- } else if ("Qualifier".equals(jp.getCurrentName())) {
- annotations.setQualifier(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- jp.nextToken();
- annotations.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- }
- }
- }
-
- return annotations;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java
new file mode 100644
index 0000000..57bdad6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.java
@@ -0,0 +1,68 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.Action;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientAction.ActionDeserializer.class)
+public class ClientAction extends Action {
+
+ private static final long serialVersionUID = 5321541275349234088L;
+
+ static class ActionDeserializer extends AbstractClientEdmDeserializer<ClientAction> {
+
+ @Override
+ protected ClientAction doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientAction action = new ClientAction();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ action.setName(jp.nextTextValue());
+ } else if ("IsBound".equals(jp.getCurrentName())) {
+ action.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("EntitySetPath".equals(jp.getCurrentName())) {
+ action.setEntitySetPath(jp.nextTextValue());
+ } else if ("Parameter".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ action.getParameters().add(jp.readValueAs(ClientParameter.class));
+ } else if ("ReturnType".equals(jp.getCurrentName())) {
+ action.setReturnType(parseReturnType(jp, "Action"));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ action.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return action;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java
new file mode 100644
index 0000000..8c251f3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.java
@@ -0,0 +1,58 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.commons.api.edm.provider.ActionImport;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientActionImport.ActionImportDeserializer.class)
+public class ClientActionImport extends ActionImport {
+
+ private static final long serialVersionUID = 2971468441177647068L;
+
+ static class ActionImportDeserializer extends AbstractClientEdmDeserializer<ClientActionImport> {
+
+ @Override
+ protected ClientActionImport doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientActionImport action = new ClientActionImport();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Action".equals(jp.getCurrentName())) {
+ action.setAction(jp.nextTextValue());
+ } else if ("Name".equals(jp.getCurrentName())) {
+ action.setName(jp.nextTextValue());
+ } else if ("EntitySet".equals(jp.getCurrentName())) {
+ action.setEntitySet(jp.nextTextValue());
+ }
+ }
+ }
+
+ return action;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java
new file mode 100644
index 0000000..85b866d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.java
@@ -0,0 +1,67 @@
+/*
+ * 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.client.core.edm.xml;
+
+import java.io.IOException;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.annotation.AbstractClientDynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientAnnotation.AnnotationDeserializer.class)
+public class ClientAnnotation extends Annotation {
+
+ private static final long serialVersionUID = 5464714417411058033L;
+
+ static class AnnotationDeserializer extends AbstractClientEdmDeserializer<Annotation> {
+
+ @Override
+ protected Annotation doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientAnnotation annotation = new ClientAnnotation();
+
+ for (; jp.getCurrentToken() != null && jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Term".equals(jp.getCurrentName())) {
+ annotation.setTerm(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ annotation.setQualifier(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ annotation.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ // Constant Expressions
+ annotation.setExpression(parseAnnotationConstExprConstruct(jp));
+ } else {
+ // Dynamic Expressions
+ annotation.setExpression(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+
+ return annotation;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java
new file mode 100644
index 0000000..55d9cbd
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotations.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.commons.api.edm.provider.Annotations;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientAnnotations.AnnotationsDeserializer.class)
+public class ClientAnnotations extends Annotations {
+
+ private static final long serialVersionUID = -5961207981571644200L;
+
+ static class AnnotationsDeserializer extends AbstractClientEdmDeserializer<ClientAnnotations> {
+
+ @Override
+ protected ClientAnnotations doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientAnnotations annotations = new ClientAnnotations();
+
+ for (; jp.getCurrentToken() != null && jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Target".equals(jp.getCurrentName())) {
+ annotations.setTarget(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ annotations.setQualifier(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ annotations.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return annotations;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java
new file mode 100644
index 0000000..ebc0452
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientComplexType.java
@@ -0,0 +1,72 @@
+/*
+ * 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 >ied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.ComplexType;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientComplexType.ComplexTypeDeserializer.class)
+public class ClientComplexType extends ComplexType {
+
+ private static final long serialVersionUID = 4076944306925840115L;
+
+ static class ComplexTypeDeserializer extends AbstractClientEdmDeserializer<ComplexType> {
+
+ @Override
+ protected ComplexType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientComplexType complexType = new ClientComplexType();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ complexType.setName(jp.nextTextValue());
+ } else if ("Abstract".equals(jp.getCurrentName())) {
+ complexType.setAbstract(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("BaseType".equals(jp.getCurrentName())) {
+ complexType.setBaseType(jp.nextTextValue());
+ } else if ("OpenType".equals(jp.getCurrentName())) {
+ complexType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ complexType.getProperties().add(jp.readValueAs(ClientProperty.class));
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ complexType.getNavigationProperties().add(jp.readValueAs(ClientNavigationProperty.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ complexType.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return complexType;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.java
new file mode 100644
index 0000000..f68c457
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientDataServices.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.client.core.edm.xml;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.api.edm.xml.DataServices;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientDataServices.DataServicesDeserializer.class)
+public class ClientDataServices extends AbstractEdmItem implements DataServices {
+
+ private static final long serialVersionUID = 4200317286476885204L;
+
+ private final List<Schema> schemas = new ArrayList<Schema>();
+
+ private String dataServiceVersion;
+
+ private String maxDataServiceVersion;
+
+ @Override
+ public String getDataServiceVersion() {
+ return dataServiceVersion;
+ }
+
+ public void setDataServiceVersion(final String version) {
+ this.dataServiceVersion = version;
+ }
+
+ @Override
+ public String getMaxDataServiceVersion() {
+ return maxDataServiceVersion;
+ }
+
+ public void setMaxDataServiceVersion(final String version) {
+ this.maxDataServiceVersion = version;
+ }
+
+ @Override
+ public List<Schema> getSchemas() {
+ return schemas;
+ }
+
+ static class DataServicesDeserializer extends AbstractClientEdmDeserializer<ClientDataServices> {
+
+ @Override
+ protected ClientDataServices doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientDataServices dataServices = new ClientDataServices();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("DataServiceVersion".equals(jp.getCurrentName())) {
+ dataServices.setDataServiceVersion(jp.nextTextValue());
+ } else if ("MaxDataServiceVersion".equals(jp.getCurrentName())) {
+ dataServices.setMaxDataServiceVersion(jp.nextTextValue());
+ } else if ("Schema".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ dataServices.getSchemas().add(jp.readValueAs(ClientSchema.class));
+ }
+ }
+ }
+
+ return dataServices;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEdmx.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEdmx.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEdmx.java
new file mode 100644
index 0000000..29a399c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEdmx.java
@@ -0,0 +1,95 @@
+/*
+ * 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.client.core.edm.xml;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.api.edm.xml.DataServices;
+import org.apache.olingo.client.api.edm.xml.Edmx;
+import org.apache.olingo.client.api.edm.xml.Reference;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientEdmx.EdmxDeserializer.class)
+public class ClientEdmx extends AbstractEdmItem implements Edmx {
+
+ private static final long serialVersionUID = -6293476719276092572L;
+
+ private final List<Reference> references = new ArrayList<Reference>();
+
+ private String version;
+
+ private DataServices dataServices;
+
+ @Override
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(final String version) {
+ this.version = version;
+ }
+
+ @Override
+ public DataServices getDataServices() {
+ return dataServices;
+ }
+
+ public void setDataServices(final DataServices dataServices) {
+ this.dataServices = dataServices;
+ }
+
+ @Override
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ static class EdmxDeserializer extends AbstractClientEdmDeserializer<ClientEdmx> {
+
+ @Override
+ protected ClientEdmx doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientEdmx edmx = new ClientEdmx();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Version".equals(jp.getCurrentName())) {
+ edmx.setVersion(jp.nextTextValue());
+ } else if ("DataServices".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ edmx.setDataServices(jp.readValueAs(ClientDataServices.class));
+ } else if ("Reference".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ edmx.getReferences().add(jp.readValueAs(ClientReference.class));
+ }
+ }
+ }
+
+ return edmx;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java
new file mode 100644
index 0000000..d91f8d3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityContainer.java
@@ -0,0 +1,72 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.commons.api.edm.provider.EntityContainer;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientEntityContainer.EntityContainerDeserializer.class)
+public class ClientEntityContainer extends EntityContainer {
+
+ private static final long serialVersionUID = 5631432527646955795L;
+
+ static class EntityContainerDeserializer extends AbstractClientEdmDeserializer<ClientEntityContainer> {
+
+ @Override
+ protected ClientEntityContainer doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientEntityContainer entityContainer = new ClientEntityContainer();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ entityContainer.setName(jp.nextTextValue());
+ } else if ("Extends".equals(jp.getCurrentName())) {
+ entityContainer.setExtendsContainer(jp.nextTextValue());
+ } else if ("EntitySet".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityContainer.getEntitySets().add(jp.readValueAs(ClientEntitySet.class));
+ } else if ("Singleton".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityContainer.getSingletons().add(jp.readValueAs(ClientSingleton.class));
+ } else if ("ActionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityContainer.getActionImports().add(jp.readValueAs(ClientActionImport.class));
+ } else if ("FunctionImport".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityContainer.getFunctionImports().add(jp.readValueAs(ClientFunctionImport.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityContainer.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return entityContainer;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java
new file mode 100644
index 0000000..f238699
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityKey.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+import org.apache.olingo.commons.api.edm.provider.PropertyRef;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientEntityKey.EntityKeyDeserializer.class)
+public class ClientEntityKey extends AbstractEdmItem {
+
+ private static final long serialVersionUID = 520227585458843347L;
+
+ private final List<PropertyRef> propertyRefs = new ArrayList<PropertyRef>();
+
+ public List<PropertyRef> getPropertyRefs() {
+ return propertyRefs;
+ }
+
+ static class EntityKeyDeserializer extends AbstractClientEdmDeserializer<ClientEntityKey> {
+ @Override
+ protected ClientEntityKey doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientEntityKey entityKey = new ClientEntityKey();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+
+ if (token == JsonToken.FIELD_NAME && "PropertyRef".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityKey.getPropertyRefs().add(jp.readValueAs(ClientPropertyRef.class));
+ }
+ }
+
+ return entityKey;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java
new file mode 100644
index 0000000..655f80d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntitySet.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.EntitySet;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientEntitySet.EntitySetDeserializer.class)
+public class ClientEntitySet extends EntitySet {
+
+ private static final long serialVersionUID = -5553885465204370676L;
+
+ static class EntitySetDeserializer extends AbstractClientEdmDeserializer<EntitySet> {
+ @Override
+ protected EntitySet doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientEntitySet entitySet = new ClientEntitySet();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ entitySet.setName(jp.nextTextValue());
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ entitySet.setType(jp.nextTextValue());
+ } else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
+ entitySet.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("NavigationPropertyBinding".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entitySet.getNavigationPropertyBindings().add(jp.readValueAs(ClientNavigationPropertyBinding.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entitySet.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return entitySet;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java
new file mode 100644
index 0000000..9089bc9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEntityType.java
@@ -0,0 +1,76 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientEntityType.EntityTypeDeserializer.class)
+public class ClientEntityType extends EntityType {
+
+ private static final long serialVersionUID = -3986417775876689669L;
+
+ static class EntityTypeDeserializer extends AbstractClientEdmDeserializer<EntityType> {
+ @Override
+ protected EntityType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientEntityType entityType = new ClientEntityType();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ entityType.setName(jp.nextTextValue());
+ } else if ("Abstract".equals(jp.getCurrentName())) {
+ entityType.setAbstract(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("BaseType".equals(jp.getCurrentName())) {
+ entityType.setBaseType(jp.nextTextValue());
+ } else if ("OpenType".equals(jp.getCurrentName())) {
+ entityType.setOpenType(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("HasStream".equals(jp.getCurrentName())) {
+ entityType.setHasStream(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Key".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ClientEntityKey keyImpl = jp.readValueAs(ClientEntityKey.class);
+ entityType.setKey(keyImpl.getPropertyRefs());
+ } else if ("Property".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityType.getProperties().add(jp.readValueAs(ClientProperty.class));
+ } else if ("NavigationProperty".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityType.getNavigationProperties().add(jp.readValueAs(ClientNavigationProperty.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ entityType.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return entityType;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java
new file mode 100644
index 0000000..af6f64d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumMember.java
@@ -0,0 +1,57 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.commons.api.edm.provider.EnumMember;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientEnumMember.EnumMemberDeserializer.class)
+public class ClientEnumMember extends EnumMember {
+
+ private static final long serialVersionUID = -6138606817225829791L;
+
+ static class EnumMemberDeserializer extends AbstractClientEdmDeserializer<EnumMember> {
+ @Override
+ protected EnumMember doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final EnumMember member = new EnumMember();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ member.setName(jp.nextTextValue());
+ } else if ("Value".equals(jp.getCurrentName())) {
+ member.setValue(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ member.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+ return member;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java
new file mode 100644
index 0000000..284b5c9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientEnumType.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientEnumType.EnumTypeDeserializer.class)
+public class ClientEnumType extends EnumType {
+
+ private static final long serialVersionUID = 9191189755592743333L;
+
+ static class EnumTypeDeserializer extends AbstractClientEdmDeserializer<ClientEnumType> {
+ @Override
+ protected ClientEnumType doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientEnumType enumType = new ClientEnumType();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ enumType.setName(jp.nextTextValue());
+ } else if ("UnderlyingType".equals(jp.getCurrentName())) {
+ enumType.setUnderlyingType(jp.nextTextValue());
+ } else if ("IsFlags".equals(jp.getCurrentName())) {
+ enumType.setFlags(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Member".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ enumType.getMembers().add(jp.readValueAs(ClientEnumMember.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ enumType.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return enumType;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java
new file mode 100644
index 0000000..c9260f1
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunction.java
@@ -0,0 +1,69 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.Function;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientFunction.FunctionDeserializer.class)
+public class ClientFunction extends Function {
+
+ private static final long serialVersionUID = -5494898295282843362L;
+
+ static class FunctionDeserializer extends AbstractClientEdmDeserializer<ClientFunction> {
+ @Override
+ protected ClientFunction doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientFunction functionImpl = new ClientFunction();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ functionImpl.setName(jp.nextTextValue());
+ } else if ("IsBound".equals(jp.getCurrentName())) {
+ functionImpl.setBound(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("IsComposable".equals(jp.getCurrentName())) {
+ functionImpl.setComposable(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("EntitySetPath".equals(jp.getCurrentName())) {
+ functionImpl.setEntitySetPath(jp.nextTextValue());
+ } else if ("Parameter".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ functionImpl.getParameters().add(jp.readValueAs(ClientParameter.class));
+ } else if ("ReturnType".equals(jp.getCurrentName())) {
+ functionImpl.setReturnType(parseReturnType(jp, "Function"));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ functionImpl.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return functionImpl;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java
new file mode 100644
index 0000000..3a7230f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientFunctionImport.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.commons.api.edm.provider.FunctionImport;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientFunctionImport.FunctionImportDeserializer.class)
+public class ClientFunctionImport extends FunctionImport {
+
+ private static final long serialVersionUID = -1686801084142932402L;
+
+ static class FunctionImportDeserializer extends AbstractClientEdmDeserializer<ClientFunctionImport> {
+ @Override
+ protected ClientFunctionImport doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientFunctionImport functImpImpl = new ClientFunctionImport();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ functImpImpl.setName(jp.nextTextValue());
+ } else if ("Function".equals(jp.getCurrentName())) {
+ functImpImpl.setFunction(jp.nextTextValue());
+ } else if ("EntitySet".equals(jp.getCurrentName())) {
+ functImpImpl.setEntitySet(jp.nextTextValue());
+ } else if ("IncludeInServiceDocument".equals(jp.getCurrentName())) {
+ functImpImpl.setIncludeInServiceDocument(BooleanUtils.toBoolean(jp.nextTextValue()));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ functImpImpl.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+
+ return functImpImpl;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java
new file mode 100644
index 0000000..01984e0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientInclude.java
@@ -0,0 +1,76 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.client.api.edm.xml.Include;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientInclude.IncludeDeserializer.class)
+public class ClientInclude extends AbstractEdmItem implements Include {
+
+ private static final long serialVersionUID = -5450008299655584221L;
+
+ private String namespace;
+ private String alias;
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(final String alias) {
+ this.alias = alias;
+ }
+
+ static class IncludeDeserializer extends AbstractClientEdmDeserializer<Include> {
+ @Override
+ protected Include doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientInclude include = new ClientInclude();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Namespace".equals(jp.getCurrentName())) {
+ include.setNamespace(jp.nextTextValue());
+ } else if ("Alias".equals(jp.getCurrentName())) {
+ include.setAlias(jp.nextTextValue());
+ }
+ }
+ }
+ return include;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java
new file mode 100644
index 0000000..4cf80c0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientIncludeAnnotations.java
@@ -0,0 +1,88 @@
+/*
+ * 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.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.client.api.edm.xml.IncludeAnnotations;
+import org.apache.olingo.commons.api.edm.provider.AbstractEdmItem;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientIncludeAnnotations.IncludeAnnotationsDeserializer.class)
+public class ClientIncludeAnnotations extends AbstractEdmItem implements IncludeAnnotations {
+
+ private static final long serialVersionUID = -8157841387011422396L;
+
+ private String termNamespace;
+ private String qualifier;
+ private String targetNamespace;
+
+ @Override
+ public String getTermNamespace() {
+ return termNamespace;
+ }
+
+ public void setTermNamespace(final String termNamespace) {
+ this.termNamespace = termNamespace;
+ }
+
+ @Override
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+
+ @Override
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ public void setTargetNamespace(final String targetNamespace) {
+ this.targetNamespace = targetNamespace;
+ }
+
+ static class IncludeAnnotationsDeserializer extends AbstractClientEdmDeserializer<IncludeAnnotations> {
+ @Override
+ protected IncludeAnnotations doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+
+ final ClientIncludeAnnotations member = new ClientIncludeAnnotations();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("TermNamespace".equals(jp.getCurrentName())) {
+ member.setTermNamespace(jp.nextTextValue());
+ } else if ("Qualifier".equals(jp.getCurrentName())) {
+ member.setQualifier(jp.nextTextValue());
+ } else if ("TargetNamespace".equals(jp.getCurrentName())) {
+ member.setTargetNamespace(jp.nextTextValue());
+ }
+ }
+ }
+ return member;
+ }
+ }
+}
[05/11] olingo-odata4 git commit: [OLINGO-564] Removed 'provider'
package level
Posted by mi...@apache.org.
[OLINGO-564] Removed 'provider' package level
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ac32d236
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ac32d236
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ac32d236
Branch: refs/heads/OLINGO-564
Commit: ac32d23610317ac1f43047935ff4741ffde3d706
Parents: a5c51d6
Author: Michael Bolz <mi...@sap.com>
Authored: Thu Apr 23 10:50:47 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Thu Apr 23 10:50:47 2015 +0200
----------------------------------------------------------------------
.../olingo/ext/proxy/AbstractService.java | 2 +-
.../proxy/commons/InvokerInvocationHandler.java | 2 +-
.../commons/OperationInvocationHandler.java | 2 +-
...turedComposableInvokerInvocationHandler.java | 2 +-
.../olingo/ext/proxy/utils/CoreUtils.java | 2 +-
.../olingo/ext/pojogen/AbstractUtility.java | 2 +-
.../java/org/apache/olingo/fit/V4Services.java | 2 +-
.../core/serialization/ODataBinderImpl.java | 2 +-
.../core/serialization/ODataReaderImpl.java | 2 +-
.../olingo/client/core/uri/URIEscapeTest.java | 2 +-
.../client/core/uri/v4/FilterFactoryTest.java | 2 +-
.../core/edm/AbstractEdmAnnotatable.java | 69 ++++
.../core/edm/AbstractEdmBindingTarget.java | 133 +++++++
.../commons/core/edm/AbstractEdmNamed.java | 38 ++
.../commons/core/edm/AbstractEdmOperation.java | 142 +++++++
.../core/edm/AbstractEdmOperationImport.java | 80 ++++
.../core/edm/AbstractEdmStructuredType.java | 196 ++++++++++
.../olingo/commons/core/edm/EdmActionImpl.java | 32 ++
.../commons/core/edm/EdmActionImportImpl.java | 46 +++
.../commons/core/edm/EdmAnnotationImpl.java | 225 +++++++++++
.../commons/core/edm/EdmAnnotationsImpl.java | 151 ++++++++
.../commons/core/edm/EdmComplexTypeImpl.java | 65 ++++
.../core/edm/EdmEntityContainerImpl.java | 327 ++++++++++++++++
.../commons/core/edm/EdmEntitySetImpl.java | 44 +++
.../commons/core/edm/EdmEntityTypeImpl.java | 146 +++++++
.../commons/core/edm/EdmEnumTypeImpl.java | 268 +++++++++++++
.../commons/core/edm/EdmFunctionImpl.java | 52 +++
.../commons/core/edm/EdmFunctionImportImpl.java | 63 ++++
.../commons/core/edm/EdmKeyPropertyRefImpl.java | 83 ++++
.../olingo/commons/core/edm/EdmMemberImpl.java | 56 +++
.../edm/EdmNavigationPropertyBindingImpl.java | 43 +++
.../core/edm/EdmNavigationPropertyImpl.java | 142 +++++++
.../commons/core/edm/EdmParameterImpl.java | 88 +++++
.../commons/core/edm/EdmPropertyImpl.java | 127 +++++++
.../commons/core/edm/EdmProviderImpl.java | 377 ++++++++++++++++++
.../core/edm/EdmReferentialConstraintImpl.java | 43 +++
.../commons/core/edm/EdmReturnTypeImpl.java | 80 ++++
.../olingo/commons/core/edm/EdmSchemaImpl.java | 304 +++++++++++++++
.../commons/core/edm/EdmSingletonImpl.java | 36 ++
.../olingo/commons/core/edm/EdmTermImpl.java | 148 ++++++++
.../commons/core/edm/EdmTypeDefinitionImpl.java | 163 ++++++++
.../olingo/commons/core/edm/EdmTypeImpl.java | 53 +++
.../olingo/commons/core/edm/EdmTypeInfo.java | 228 +++++++++++
.../apache/olingo/commons/core/edm/Target.java | 66 ++++
.../core/edm/annotation/EdmCastImpl.java | 2 +-
.../core/edm/annotation/EdmIsOfImpl.java | 2 +-
.../core/edm/annotation/EdmRecordImpl.java | 2 +-
.../edm/provider/AbstractEdmAnnotatable.java | 69 ----
.../edm/provider/AbstractEdmBindingTarget.java | 133 -------
.../core/edm/provider/AbstractEdmNamed.java | 38 --
.../core/edm/provider/AbstractEdmOperation.java | 142 -------
.../provider/AbstractEdmOperationImport.java | 80 ----
.../edm/provider/AbstractEdmStructuredType.java | 196 ----------
.../core/edm/provider/EdmActionImpl.java | 32 --
.../core/edm/provider/EdmActionImportImpl.java | 46 ---
.../core/edm/provider/EdmAnnotationImpl.java | 225 -----------
.../core/edm/provider/EdmAnnotationsImpl.java | 151 --------
.../core/edm/provider/EdmComplexTypeImpl.java | 65 ----
.../edm/provider/EdmEntityContainerImpl.java | 327 ----------------
.../core/edm/provider/EdmEntitySetImpl.java | 44 ---
.../core/edm/provider/EdmEntityTypeImpl.java | 146 -------
.../core/edm/provider/EdmEnumTypeImpl.java | 268 -------------
.../core/edm/provider/EdmFunctionImpl.java | 52 ---
.../edm/provider/EdmFunctionImportImpl.java | 63 ----
.../edm/provider/EdmKeyPropertyRefImpl.java | 83 ----
.../core/edm/provider/EdmMemberImpl.java | 56 ---
.../EdmNavigationPropertyBindingImpl.java | 43 ---
.../edm/provider/EdmNavigationPropertyImpl.java | 142 -------
.../core/edm/provider/EdmParameterImpl.java | 88 -----
.../core/edm/provider/EdmPropertyImpl.java | 127 -------
.../core/edm/provider/EdmProviderImpl.java | 378 -------------------
.../provider/EdmReferentialConstraintImpl.java | 43 ---
.../core/edm/provider/EdmReturnTypeImpl.java | 80 ----
.../core/edm/provider/EdmSchemaImpl.java | 304 ---------------
.../core/edm/provider/EdmSingletonImpl.java | 36 --
.../commons/core/edm/provider/EdmTermImpl.java | 148 --------
.../edm/provider/EdmTypeDefinitionImpl.java | 163 --------
.../commons/core/edm/provider/EdmTypeImpl.java | 53 ---
.../commons/core/edm/provider/EdmTypeInfo.java | 228 -----------
.../commons/core/edm/provider/Target.java | 66 ----
.../core/serialization/AtomDeserializer.java | 2 +-
.../core/serialization/AtomSerializer.java | 2 +-
.../core/serialization/JsonDeserializer.java | 2 +-
.../serialization/JsonEntityDeserializer.java | 2 +-
.../serialization/JsonEntitySerializer.java | 2 +-
.../serialization/JsonGeoValueDeserializer.java | 2 +-
.../serialization/JsonPropertyDeserializer.java | 2 +-
.../serialization/JsonPropertySerializer.java | 2 +-
.../core/serialization/JsonSerializer.java | 2 +-
.../olingo/server/core/ServiceMetadataImpl.java | 2 +-
.../core/edm/provider/AbstractEdmNamedTest.java | 2 +-
.../core/edm/provider/EdmActionImplTest.java | 4 +-
.../edm/provider/EdmActionImportImplTest.java | 4 +-
.../edm/provider/EdmComplexTypeImplTest.java | 4 +-
.../provider/EdmEntityContainerImplTest.java | 4 +-
.../core/edm/provider/EdmEntitySetImplTest.java | 6 +-
.../edm/provider/EdmEntityTypeImplTest.java | 4 +-
.../server/core/edm/provider/EdmEnumTest.java | 4 +-
.../core/edm/provider/EdmFunctionImplTest.java | 4 +-
.../edm/provider/EdmFunctionImportImplTest.java | 6 +-
.../edm/provider/EdmKeyPropertyRefImplTest.java | 2 +-
.../core/edm/provider/EdmMappingTest.java | 4 +-
.../core/edm/provider/EdmMemberImplTest.java | 4 +-
.../provider/EdmNavigationPropertyImplTest.java | 4 +-
.../core/edm/provider/EdmParameterImplTest.java | 4 +-
.../core/edm/provider/EdmPropertyImplTest.java | 4 +-
.../EdmProviderImplOverloadingTest.java | 2 +-
.../core/edm/provider/EdmProviderImplTest.java | 2 +-
.../edm/provider/EdmReturnTypeImplTest.java | 4 +-
.../core/edm/provider/EdmSchemaImplTest.java | 2 +-
.../core/edm/provider/EdmSingletonImplTest.java | 6 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 4 +-
.../core/edm/provider/EdmTypeImplTest.java | 2 +-
.../core/serializer/json/ComplexTypeHelper.java | 4 +-
.../serializer/utils/ContextURLBuilderTest.java | 4 +-
.../xml/MetadataDocumentXmlSerializerTest.java | 2 +-
.../olingo/server/core/uri/UriInfoImplTest.java | 2 +-
.../server/core/uri/UriResourceImplTest.java | 8 +-
.../core/uri/antlr/TestFullResourcePath.java | 2 +-
.../core/uri/antlr/TestUriParserImpl.java | 2 +-
.../core/uri/queryoption/QueryOptionTest.java | 2 +-
.../queryoption/expression/ExpressionTest.java | 2 +-
.../core/uri/validator/UriValidatorTest.java | 2 +-
123 files changed, 4196 insertions(+), 4197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
index f353856..8770286 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/AbstractService.java
@@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.PersistenceManager;
import org.apache.olingo.ext.proxy.commons.EntityContainerInvocationHandler;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java
index 5d2dcdd..44a2d30 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java
@@ -44,7 +44,7 @@ import org.apache.olingo.commons.api.edm.EdmOperation;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.ComplexCollection;
import org.apache.olingo.ext.proxy.api.EntityCollection;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
index 90873b4..73daaf3 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java
@@ -39,7 +39,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmFunction;
import org.apache.olingo.commons.api.edm.EdmOperation;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.api.OperationType;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java
index 9adbd05..c909ab0 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java
@@ -26,7 +26,7 @@ import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmOperation;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.Operations;
import org.apache.olingo.ext.proxy.api.annotations.Operation;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
index 682fc38..b21c45c 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java
@@ -57,7 +57,7 @@ import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.domain.ODataAnnotationImpl;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.AbstractTerm;
import org.apache.olingo.ext.proxy.api.ComplexCollection;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
index 2e0ef80..7e0dbdd 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
@@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.io.InputStream;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 711cdf0..4b1cd1f 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -71,7 +71,7 @@ import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.fit.metadata.Metadata;
import org.apache.olingo.fit.methods.PATCH;
import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
index fc295a0..25b405a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java
@@ -92,7 +92,7 @@ import org.apache.olingo.commons.core.domain.ODataDeletedEntityImpl;
import org.apache.olingo.commons.core.domain.ODataDeltaLinkImpl;
import org.apache.olingo.commons.core.domain.ODataPropertyImpl;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.serialization.ContextURLParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
index 39b1177..f153ddb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java
@@ -44,7 +44,7 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.Schema;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
-import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
index 6dd7de5..f3fde9e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
@@ -33,7 +33,7 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.core.edm.provider.EdmEnumTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmEnumTypeImpl;
import org.junit.Test;
public class URIEscapeTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
index a9fc341..7f9b57d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
@@ -34,7 +34,7 @@ import org.apache.olingo.client.core.edm.xml.EnumTypeImpl;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.provider.EdmEnumTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmEnumTypeImpl;
import org.junit.Test;
public class FilterFactoryTest extends AbstractTest {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmAnnotatable.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmAnnotatable.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmAnnotatable.java
new file mode 100644
index 0000000..773ca9e
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmAnnotatable.java
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+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.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public abstract class AbstractEdmAnnotatable implements EdmAnnotatable {
+
+ private final Annotatable annotatable;
+ private List<EdmAnnotation> annotations;
+ protected final Edm edm;
+
+ public AbstractEdmAnnotatable(final Edm edm, final Annotatable annotatable) {
+ this.edm = edm;
+ this.annotatable = annotatable;
+ }
+
+ @Override
+ public EdmAnnotation getAnnotation(final EdmTerm term) {
+ EdmAnnotation result = null;
+ for (EdmAnnotation annotation : getAnnotations()) {
+ if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
+ result = annotation;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<EdmAnnotation> getAnnotations() {
+ if (annotations == null) {
+ final List<EdmAnnotation> annotationsLocal = new ArrayList<EdmAnnotation>();
+ if (annotatable != null) {
+ for (Annotation annotation : annotatable.getAnnotations()) {
+ annotationsLocal.add(new EdmAnnotationImpl(edm, annotation));
+ }
+
+ annotations = Collections.unmodifiableList(annotationsLocal);
+ }
+ }
+ return annotations;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
new file mode 100644
index 0000000..62f12e6
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
@@ -0,0 +1,133 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.BindingTarget;
+import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
+
+public abstract class AbstractEdmBindingTarget extends AbstractEdmNamed implements EdmBindingTarget {
+
+ private final BindingTarget target;
+ private final EdmEntityContainer container;
+
+ private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
+
+ public AbstractEdmBindingTarget(final Edm edm, final EdmEntityContainer container, final BindingTarget target) {
+ super(edm, target.getName(), target);
+ this.container = container;
+ this.target = target;
+ }
+
+ @Override
+ public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
+ if (navigationPropertyBindings == null) {
+ List<NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
+ final List<EdmNavigationPropertyBinding> navigationPropertyBindingsLocal =
+ new ArrayList<EdmNavigationPropertyBinding>();
+ if (providerBindings != null) {
+ for (NavigationPropertyBinding binding : providerBindings) {
+ navigationPropertyBindingsLocal.add(new EdmNavigationPropertyBindingImpl(binding.getPath(),
+ binding.getTarget()));
+ }
+ navigationPropertyBindings = Collections.unmodifiableList(navigationPropertyBindingsLocal);
+ }
+ }
+ return navigationPropertyBindings;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return container;
+ }
+
+ @Override
+ public EdmEntityType getEntityType() {
+ final EdmEntityType entityType = edm.getEntityType(target.getTypeFQN());
+ if (entityType == null) {
+ throw new EdmException("Can´t find entity type: " + target.getTypeFQN() + " for entity set or singleton: "
+ + getName());
+ }
+ return entityType;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return container.getFullQualifiedName();
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return getName();
+ }
+
+ @Override
+ public EdmBindingTarget getRelatedBindingTarget(final String path) {
+ if (path == null) {
+ return null;
+ }
+ EdmBindingTarget bindingTarget = null;
+ boolean found = false;
+ for (final Iterator<EdmNavigationPropertyBinding> itor = getNavigationPropertyBindings().iterator(); itor.hasNext()
+ && !found;) {
+
+ final EdmNavigationPropertyBinding binding = itor.next();
+ if(binding.getPath() == null || binding.getTarget() == null){
+ throw new EdmException("Path or Target in navigation property binding must not be null!");
+ }
+ if (path.startsWith(binding.getPath())) {
+ final Target edmTarget = new Target(binding.getTarget(), container);
+
+ final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer());
+ if (entityContainer == null) {
+ throw new EdmException("Cannot find entity container with name: " + edmTarget.getEntityContainer());
+ }
+ try {
+ bindingTarget = entityContainer.getEntitySet(edmTarget.getTargetName());
+
+ if (bindingTarget == null) {
+ throw new EdmException("Cannot find EntitySet " + edmTarget.getTargetName());
+ }
+ } catch (EdmException e) {
+ // try with singletons ...
+ bindingTarget = entityContainer.getSingleton(edmTarget.getTargetName());
+
+ if (bindingTarget == null) {
+ throw new EdmException("Cannot find Singleton " + edmTarget.getTargetName());
+ }
+ } finally {
+ found = bindingTarget != null;
+ }
+ }
+ }
+
+ return bindingTarget;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNamed.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNamed.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNamed.java
new file mode 100644
index 0000000..ced2b92
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNamed.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmNamed;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+
+public abstract class AbstractEdmNamed extends AbstractEdmAnnotatable implements EdmNamed {
+
+ private final String name;
+
+ public AbstractEdmNamed(final Edm edm, final String name, final Annotatable annotatable) {
+ super(edm, annotatable);
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
new file mode 100644
index 0000000..6fc4f91
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java
@@ -0,0 +1,142 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmOperation;
+import org.apache.olingo.commons.api.edm.EdmParameter;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Operation;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+
+public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
+
+ private final Operation operation;
+ private Map<String, EdmParameter> parameters;
+ private List<String> parameterNames;
+ private EdmReturnType returnType;
+
+ protected AbstractEdmOperation(final Edm edm, final FullQualifiedName name, final Operation operation,
+ final EdmTypeKind kind) {
+
+ super(edm, name, kind, operation);
+ this.operation = operation;
+ }
+
+ @Override
+ public EdmParameter getParameter(final String name) {
+ if (parameters == null) {
+ createParameters();
+ }
+ return parameters.get(name);
+ }
+
+ @Override
+ public List<String> getParameterNames() {
+ if (parameterNames == null) {
+ createParameters();
+ }
+ return Collections.unmodifiableList(parameterNames);
+ }
+
+ private void createParameters() {
+ if(parameters == null) {
+ final Map<String, EdmParameter> parametersLocal = new LinkedHashMap<String, EdmParameter>();
+ final List<Parameter> providerParameters = operation.getParameters();
+ if (providerParameters != null) {
+ final List<String> parameterNamesLocal = new ArrayList<String>(providerParameters.size());
+ for (Parameter parameter : providerParameters) {
+ parametersLocal.put(parameter.getName(), new EdmParameterImpl(edm, parameter));
+ parameterNamesLocal.add(parameter.getName());
+ }
+
+ parameters = parametersLocal;
+ parameterNames = parameterNamesLocal;
+ } else {
+ parameterNames = Collections.emptyList();
+ }
+ }
+ }
+
+ @Override
+ public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
+ EdmEntitySet returnedEntitySet = null;
+ if (bindingParameterEntitySet != null && operation.getEntitySetPath() != null) {
+ final EdmBindingTarget relatedBindingTarget =
+ bindingParameterEntitySet.getRelatedBindingTarget(operation.getEntitySetPath());
+ if (relatedBindingTarget == null) {
+ throw new EdmException("Cannot find entity set with path: " + operation.getEntitySetPath());
+ }
+ if (relatedBindingTarget instanceof EdmEntitySet) {
+ returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
+ } else {
+ throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName()
+ + " must be an entity set");
+ }
+ }
+ return returnedEntitySet;
+ }
+
+ @Override
+ public EdmReturnType getReturnType() {
+ if (returnType == null && operation.getReturnType() != null) {
+ returnType = new EdmReturnTypeImpl(edm, operation.getReturnType());
+ }
+ return returnType;
+ }
+
+ @Override
+ public boolean isBound() {
+ return operation.isBound();
+ }
+
+ @Override
+ public FullQualifiedName getBindingParameterTypeFqn() {
+ if (isBound()) {
+ Parameter bindingParameter = operation.getParameters().get(0);
+ return bindingParameter.getTypeFQN();
+ }
+ return null;
+ }
+
+ @Override
+ public Boolean isBindingParameterTypeCollection() {
+ if (isBound()) {
+ Parameter bindingParameter = operation.getParameters().get(0);
+ return bindingParameter.isCollection();
+ }
+ return null;
+ }
+
+ @Override
+ public String getEntitySetPath() {
+ return operation.getEntitySetPath();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
new file mode 100644
index 0000000..c36c44f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmOperationImport;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.OperationImport;
+
+public abstract class AbstractEdmOperationImport extends AbstractEdmNamed implements EdmOperationImport {
+
+ protected final EdmEntityContainer container;
+ private final Target entitySet;
+ private EdmEntitySet returnedEntitySet;
+
+ public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container,
+ final OperationImport operationImport) {
+ super(edm, operationImport.getName(), operationImport);
+ this.container = container;
+ if (operationImport.getEntitySet() != null) {
+ this.entitySet = new Target(operationImport.getEntitySet(), container);
+ } else {
+ this.entitySet = null;
+ }
+ }
+
+ @Override
+ public FullQualifiedName getFullQualifiedName() {
+ return new FullQualifiedName(container.getNamespace(), getName());
+ }
+
+ @Override
+ public EdmEntitySet getReturnedEntitySet() {
+ if (entitySet != null && returnedEntitySet == null) {
+ EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer());
+ if (entityContainer == null) {
+ throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer());
+ }
+ returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName());
+ if (returnedEntitySet == null) {
+ throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName());
+ }
+ }
+ return returnedEntitySet;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return container;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return container.getFullQualifiedName();
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return getName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
new file mode 100644
index 0000000..736b69b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
@@ -0,0 +1,196 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.Property;
+import org.apache.olingo.commons.api.edm.provider.StructuralType;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
+
+ protected EdmStructuredType baseType;
+ protected FullQualifiedName baseTypeName;
+
+ private final StructuralType providerStructuredType;
+
+ private List<String> propertyNames;
+ private Map<String, EdmProperty> properties;
+ private List<String> navigationPropertyNames;
+ private Map<String, EdmNavigationProperty> navigationProperties;
+
+ public AbstractEdmStructuredType(
+ final Edm edm,
+ final FullQualifiedName typeName,
+ final EdmTypeKind kind,
+ final StructuralType structuredType) {
+
+ super(edm, typeName, kind, structuredType);
+ this.baseTypeName = structuredType.getBaseTypeFQN();
+ this.providerStructuredType = structuredType;
+ }
+
+ protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
+
+ protected abstract void checkBaseType();
+
+ @Override
+ public List<String> getPropertyNames() {
+ if (propertyNames == null) {
+ final List<String> localPropertyNames = new ArrayList<String>();
+ checkBaseType();
+ if (baseType != null) {
+ localPropertyNames.addAll(baseType.getPropertyNames());
+ }
+ localPropertyNames.addAll(getProperties().keySet());
+ propertyNames = Collections.unmodifiableList(localPropertyNames);
+ }
+ return propertyNames;
+ }
+
+ @Override
+ public List<String> getNavigationPropertyNames() {
+ if (navigationPropertyNames == null) {
+ final ArrayList<String> localNavigatinPropertyNames = new ArrayList<String>();
+ checkBaseType();
+ if (baseType != null) {
+ localNavigatinPropertyNames.addAll(baseType.getNavigationPropertyNames());
+ }
+ localNavigatinPropertyNames.addAll(getNavigationProperties().keySet());
+ navigationPropertyNames = Collections.unmodifiableList(localNavigatinPropertyNames);
+ }
+ return navigationPropertyNames;
+ }
+
+ @Override
+ public EdmElement getProperty(final String name) {
+ EdmElement property = getStructuralProperty(name);
+ if (property == null) {
+ property = getNavigationProperty(name);
+ }
+ return property;
+ }
+
+ @Override
+ public EdmProperty getStructuralProperty(final String name) {
+ EdmProperty property = null;
+ checkBaseType();
+ if (baseType != null) {
+ property = baseType.getStructuralProperty(name);
+ }
+ if (property == null) {
+ property = getProperties().get(name);
+ }
+ return property;
+ }
+
+ @Override
+ public EdmNavigationProperty getNavigationProperty(final String name) {
+ EdmNavigationProperty property = null;
+ checkBaseType();
+ if (baseType != null) {
+ property = baseType.getNavigationProperty(name);
+ }
+ if (property == null) {
+ property = getNavigationProperties().get(name);
+ }
+ return property;
+ }
+
+ @Override
+ public boolean compatibleTo(final EdmType targetType) {
+ EdmStructuredType sourceType = this;
+ if (targetType == null) {
+ throw new EdmException("Target type must not be null");
+ }
+ while (!sourceType.getName().equals(targetType.getName())
+ || !sourceType.getNamespace().equals(targetType.getNamespace())) {
+
+ sourceType = sourceType.getBaseType();
+ if (sourceType == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return null;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return getFullQualifiedName();
+ }
+
+ public Map<String, EdmProperty> getProperties() {
+ if (properties == null) {
+ final Map<String, EdmProperty> localPorperties = new LinkedHashMap<String, EdmProperty>();
+ final List<Property> structureTypeProperties = providerStructuredType.getProperties();
+ for (Property property : structureTypeProperties) {
+ localPorperties.put(property.getName(), new EdmPropertyImpl(edm, typeName, property));
+ }
+ properties = Collections.unmodifiableMap(localPorperties);
+ }
+ return properties;
+ }
+
+ public Map<String, EdmNavigationProperty> getNavigationProperties() {
+ if (navigationProperties == null) {
+ final Map<String, EdmNavigationProperty> localNavigationProperties =
+ new LinkedHashMap<String, EdmNavigationProperty>();
+ final List<NavigationProperty> structuredTypeNavigationProperties =
+ providerStructuredType.getNavigationProperties();
+
+ if (structuredTypeNavigationProperties != null) {
+ for (NavigationProperty navigationProperty : structuredTypeNavigationProperties) {
+ localNavigationProperties.put(navigationProperty.getName(),
+ new EdmNavigationPropertyImpl(edm, typeName, navigationProperty));
+ }
+ }
+
+ navigationProperties = Collections.unmodifiableMap(localNavigationProperties);
+ }
+ return navigationProperties;
+ }
+
+ public boolean isOpenType() {
+ return providerStructuredType.isOpenType();
+ }
+
+ public boolean isAbstract() {
+ return providerStructuredType.isAbstract();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImpl.java
new file mode 100644
index 0000000..91296d5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Action;
+
+public class EdmActionImpl extends AbstractEdmOperation implements EdmAction {
+
+ public EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
+ super(edm, name, action, EdmTypeKind.ACTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImportImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImportImpl.java
new file mode 100644
index 0000000..43e2f0b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmActionImportImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.ActionImport;
+
+public class EdmActionImportImpl extends AbstractEdmOperationImport implements EdmActionImport {
+
+ private final ActionImport actionImport;
+
+ public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final ActionImport actionImport) {
+
+ super(edm, container, actionImport);
+ this.actionImport = actionImport;
+ }
+
+ @Override
+ public EdmAction getUnboundAction() {
+ return edm.getUnboundAction(actionImport.getActionFQN());
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.ActionImport;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/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
new file mode 100644
index 0000000..8006639
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationImpl.java
@@ -0,0 +1,225 @@
+/*
+ * 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;
+
+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.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.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
+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;
+
+public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnnotation {
+
+ private final Annotation annotation;
+ private EdmTerm term;
+ private EdmAnnotationExpression expression;
+
+ public EdmAnnotationImpl(final Edm edm, final Annotation annotation) {
+ super(edm, annotation);
+ this.annotation = annotation;
+ }
+
+ @Override
+ public EdmTerm getTerm() {
+ if (term == null) {
+ term = edm.getTerm(new FullQualifiedName(annotation.getTerm()));
+ }
+ return term;
+ }
+
+ @Override
+ public String getQualifier() {
+ return annotation.getQualifier();
+ }
+
+ private EdmAnnotationExpression getExpression(final AnnotationExpression 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 DynamicAnnotationExpression exp) {
+ EdmDynamicAnnotationExpression _expression = null;
+
+ if (exp.isNot()) {
+ _expression = new EdmNotImpl(getDynamicExpression(exp.asNot().getExpression()));
+ } else if (exp.isTwoParamsOp()) {
+ switch (exp.asTwoParamsOp().getType()) {
+ case And:
+ _expression = new EdmAndImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Or:
+ _expression = new EdmOrImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Eq:
+ _expression = new EdmEqImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Ne:
+ _expression = new EdmNeImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Ge:
+ _expression = new EdmGeImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Gt:
+ _expression = new EdmGtImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Le:
+ _expression = new EdmLeImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ break;
+
+ case Lt:
+ _expression = new EdmLtImpl(
+ getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
+ getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
+ 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 (AnnotationExpression 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 (AnnotationExpression 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()));
+ } else if (exp.isLabeledElement()) {
+ _expression = new EdmLabeledElementImpl(
+ exp.asLabeledElement().getName(), getDynamicExpression(exp.asLabeledElement().getValue()));
+ } 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 (PropertyValue 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 Annotatable) {
+ for (Annotation _annotation : ((Annotatable) exp).getAnnotations()) {
+ ((EdmAnnotatable) _expression).getAnnotations().add(new EdmAnnotationImpl(edm, _annotation));
+ }
+ }
+
+ return _expression;
+ }
+
+ @Override
+ public EdmAnnotationExpression getExpression() {
+ if (expression == null) {
+ expression = getExpression(annotation.getExpression());
+ }
+ return expression;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationsImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationsImpl.java
new file mode 100644
index 0000000..0b10b17
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmAnnotationsImpl.java
@@ -0,0 +1,151 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.api.edm.provider.Annotations;
+
+public class EdmAnnotationsImpl implements EdmAnnotations {
+
+ private final Edm edm;
+ private final EdmSchema schema;
+ private final Annotations annotationGroup;
+ private EdmAnnotationsTarget target;
+ private List<EdmAnnotation> annotations;
+
+ public EdmAnnotationsImpl(final Edm edm, final EdmSchema schema, final Annotations annotationGroup) {
+ this.edm = edm;
+ this.schema = schema;
+ this.annotationGroup = annotationGroup;
+ }
+
+ private EdmAnnotationsTarget getTarget(final EdmStructuredType structured, final String path) {
+ EdmAnnotationsTarget _target = null;
+ if (structured != null) {
+ _target = path == null
+ ? structured
+ : structured.getStructuralProperty(path);
+ if (_target == null) {
+ _target = structured.getNavigationProperty(path);
+ }
+ }
+ return _target;
+ }
+
+ private EdmAnnotationsTarget getTarget(final EdmEnumType enumType, final String path) {
+ EdmAnnotationsTarget _target = null;
+ if (enumType != null) {
+ _target = path == null
+ ? enumType
+ : enumType.getMember(path);
+ }
+ return _target;
+ }
+
+ @Override
+ public EdmAnnotationsTarget getTarget() {
+ if (target == null) {
+ final String[] splitted = StringUtils.split(annotationGroup.getTarget(), '/');
+ final FullQualifiedName base = new FullQualifiedName(splitted[0]);
+ final String path = splitted.length > 1 ? splitted[1] : null;
+
+ final EdmEntityContainer baseEntityContainer = schema.getEntityContainer();
+
+ EdmAnnotationsTarget localTarget = baseEntityContainer == null ? null
+ : baseEntityContainer.getActionImport(path);
+ if (localTarget == null) {
+ localTarget = getTarget(edm.getComplexType(base), path);
+ if (localTarget == null) {
+ if(baseEntityContainer != null && baseEntityContainer.getFullQualifiedName().equals(base)){
+ localTarget = baseEntityContainer;
+ }
+ if (localTarget == null) {
+ localTarget = baseEntityContainer == null ? null : baseEntityContainer.getEntitySet(path);
+ if (localTarget == null) {
+ localTarget = getTarget(edm.getEntityType(base), path);
+ if (localTarget == null) {
+ localTarget = getTarget(edm.getEnumType(base), path);
+ if (localTarget == null) {
+ localTarget = baseEntityContainer == null ? null : baseEntityContainer.getFunctionImport(path);
+ if (localTarget == null) {
+ localTarget = baseEntityContainer == null ? null : baseEntityContainer.getSingleton(path);
+ if (localTarget == null) {
+ localTarget = edm.getTerm(base);
+ if (localTarget == null) {
+ localTarget = edm.getTypeDefinition(base);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ target = localTarget;
+ }
+
+ return target;
+ }
+
+ @Override
+ public String getQualifier() {
+ return annotationGroup.getQualifier();
+ }
+
+ @Override
+ public EdmAnnotation getAnnotation(final EdmTerm term) {
+ EdmAnnotation result = null;
+ for (EdmAnnotation annotation : getAnnotations()) {
+ if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
+ result = annotation;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<EdmAnnotation> getAnnotations() {
+ if (annotations == null) {
+ List<EdmAnnotation> annotationsLocal = new ArrayList<EdmAnnotation>();
+ for (Annotation annotation : annotationGroup.getAnnotations()) {
+ annotationsLocal.add(new EdmAnnotationImpl(edm, annotation));
+ }
+
+ annotations = Collections.unmodifiableList(annotationsLocal);
+ }
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmComplexTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmComplexTypeImpl.java
new file mode 100644
index 0000000..d39d594
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmComplexTypeImpl.java
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.ComplexType;
+
+public class EdmComplexTypeImpl extends AbstractEdmStructuredType implements EdmComplexType {
+
+ public EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
+ super(edm, name, EdmTypeKind.COMPLEX, complexType);
+ }
+
+ @Override
+ protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
+ EdmComplexType baseType = null;
+ if (baseTypeName != null) {
+ baseType = edm.getComplexType(baseTypeName);
+ if (baseType == null) {
+ throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: "
+ + getName());
+ }
+ }
+ return baseType;
+ }
+
+ @Override
+ public EdmComplexType getBaseType() {
+ checkBaseType();
+ return (EdmComplexType) baseType;
+ }
+
+ @Override
+ protected void checkBaseType() {
+ if (baseTypeName != null && baseType == null) {
+ baseType = buildBaseType(baseTypeName);
+ }
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.ComplexType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
new file mode 100644
index 0000000..2c6d871
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
@@ -0,0 +1,327 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmActionImport;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.ActionImport;
+import org.apache.olingo.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.commons.api.edm.provider.EntityContainer;
+import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.EntitySet;
+import org.apache.olingo.commons.api.edm.provider.FunctionImport;
+import org.apache.olingo.commons.api.edm.provider.Singleton;
+
+public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntityContainer {
+
+ private final EdmProvider provider;
+ private EntityContainer container;
+
+ private final FullQualifiedName entityContainerName;
+ private final FullQualifiedName parentContainerName;
+
+ private List<EdmSingleton> singletons;
+ private final Map<String, EdmSingleton> singletonCache = Collections.synchronizedMap(
+ new LinkedHashMap<String, EdmSingleton>());
+ private List<EdmEntitySet> entitySets;
+ private final Map<String, EdmEntitySet> entitySetCache = Collections.synchronizedMap(
+ new LinkedHashMap<String, EdmEntitySet>());
+ private List<EdmActionImport> actionImports;
+ private final Map<String, EdmActionImport> actionImportCache = Collections.synchronizedMap(
+ new LinkedHashMap<String, EdmActionImport>());
+ private List<EdmFunctionImport> functionImports;
+ private final Map<String, EdmFunctionImport> functionImportCache = Collections.synchronizedMap(
+ new LinkedHashMap<String, EdmFunctionImport>());
+
+ public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
+ final EntityContainerInfo entityContainerInfo) {
+ super(edm, entityContainerInfo.getContainerName().getName(), null);
+ this.provider = provider;
+ this.entityContainerName = entityContainerInfo.getContainerName();
+ this.parentContainerName = entityContainerInfo.getExtendsContainer();
+ }
+
+ public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
+ final EntityContainer entityContainer) {
+ super(edm, containerFQN.getName(), entityContainer);
+ this.provider = provider;
+ container = entityContainer;
+ this.entityContainerName = containerFQN;
+ this.parentContainerName = entityContainer.getExtendsContainerFQN();
+ }
+
+ @Override
+ public String getNamespace() {
+ return entityContainerName.getNamespace();
+ }
+
+ @Override
+ public FullQualifiedName getFullQualifiedName() {
+ return entityContainerName;
+ }
+
+ @Override
+ public EdmSingleton getSingleton(final String singletonName) {
+ EdmSingleton singleton = singletonCache.get(singletonName);
+ if (singleton == null) {
+ singleton = createSingleton(singletonName);
+ if (singleton != null) {
+ singletonCache.put(singletonName, singleton);
+ }
+ }
+ return singleton;
+ }
+
+ @Override
+ public EdmEntitySet getEntitySet(final String entitySetName) {
+ EdmEntitySet entitySet = entitySetCache.get(entitySetName);
+ if (entitySet == null) {
+ entitySet = createEntitySet(entitySetName);
+ if (entitySet != null) {
+ entitySetCache.put(entitySetName, entitySet);
+ }
+ }
+ return entitySet;
+ }
+
+ @Override
+ public EdmActionImport getActionImport(final String actionImportName) {
+ EdmActionImport actionImport = actionImportCache.get(actionImportName);
+ if (actionImport == null) {
+ actionImport = createActionImport(actionImportName);
+ if (actionImport != null) {
+ actionImportCache.put(actionImportName, actionImport);
+ }
+ }
+ return actionImport;
+ }
+
+ @Override
+ public EdmFunctionImport getFunctionImport(final String functionImportName) {
+ EdmFunctionImport functionImport = functionImportCache.get(functionImportName);
+ if (functionImport == null) {
+ functionImport = createFunctionImport(functionImportName);
+ if (functionImport != null) {
+ functionImportCache.put(functionImportName, functionImport);
+ }
+ }
+ return functionImport;
+ }
+
+ @Override
+ public List<EdmEntitySet> getEntitySets() {
+ if (entitySets == null) {
+ loadAllEntitySets();
+ }
+ return Collections.unmodifiableList(entitySets);
+ }
+
+ @Override
+ public List<EdmFunctionImport> getFunctionImports() {
+ if (functionImports == null) {
+ loadAllFunctionImports();
+ }
+ return Collections.unmodifiableList(functionImports);
+ }
+
+ @Override
+ public List<EdmSingleton> getSingletons() {
+ if (singletons == null) {
+ loadAllSingletons();
+ }
+ return Collections.unmodifiableList(singletons);
+ }
+
+ @Override
+ public List<EdmActionImport> getActionImports() {
+ if (actionImports == null) {
+ loadAllActionImports();
+ }
+ return Collections.unmodifiableList(actionImports);
+ }
+
+ @Override
+ public FullQualifiedName getParentContainerName() {
+ return parentContainerName;
+ }
+
+ protected EdmSingleton createSingleton(final String singletonName) {
+ EdmSingleton singleton = null;
+
+ try {
+ final Singleton providerSingleton = provider.getSingleton(entityContainerName, singletonName);
+ if (providerSingleton != null) {
+ singleton = new EdmSingletonImpl(edm, this, providerSingleton);
+ }
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+
+ return singleton;
+ }
+
+ protected EdmEntitySet createEntitySet(final String entitySetName) {
+ EdmEntitySet entitySet = null;
+
+ try {
+ final EntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName);
+ if (providerEntitySet != null) {
+ entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet);
+ }
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+
+ return entitySet;
+ }
+
+ protected EdmActionImport createActionImport(final String actionImportName) {
+ EdmActionImport actionImport = null;
+
+ try {
+ final ActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName);
+ if (providerImport != null) {
+ actionImport = new EdmActionImportImpl(edm, this, providerImport);
+ }
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+
+ return actionImport;
+ }
+
+ protected EdmFunctionImport createFunctionImport(final String functionImportName) {
+ EdmFunctionImport functionImport = null;
+
+ try {
+ final FunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName);
+ if (providerImport != null) {
+ functionImport = new EdmFunctionImportImpl(edm, this, providerImport);
+ }
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+
+ return functionImport;
+ }
+
+ protected void loadAllEntitySets() {
+ loadContainer();
+ final List<EntitySet> providerEntitySets = container.getEntitySets();
+ final List<EdmEntitySet> entitySetsLocal = new ArrayList<EdmEntitySet>();
+
+ if (providerEntitySets != null) {
+ for (EntitySet entitySet : providerEntitySets) {
+ final EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
+ entitySetCache.put(impl.getName(), impl);
+ entitySetsLocal.add(impl);
+ }
+ entitySets = entitySetsLocal;
+ }
+ }
+
+ protected void loadAllFunctionImports() {
+ loadContainer();
+ final List<FunctionImport> providerFunctionImports = container.getFunctionImports();
+ final ArrayList<EdmFunctionImport> functionImportsLocal = new ArrayList<EdmFunctionImport>();
+
+ if (providerFunctionImports != null) {
+ for (FunctionImport functionImport : providerFunctionImports) {
+ EdmFunctionImportImpl impl = new EdmFunctionImportImpl(edm, this, functionImport);
+ functionImportCache.put(impl.getName(), impl);
+ functionImportsLocal.add(impl);
+ }
+ functionImports = functionImportsLocal;
+ }
+ }
+
+ protected void loadAllSingletons() {
+ loadContainer();
+ final List<Singleton> providerSingletons = container.getSingletons();
+ final List<EdmSingleton> singletonsLocal = new ArrayList<EdmSingleton>();
+
+ if (providerSingletons != null) {
+ for (Singleton singleton : providerSingletons) {
+ final EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
+ singletonCache.put(singleton.getName(), impl);
+ singletonsLocal.add(impl);
+ }
+ singletons = singletonsLocal;
+ }
+ }
+
+ protected void loadAllActionImports() {
+ loadContainer();
+ final List<ActionImport> providerActionImports = container.getActionImports();
+ final List<EdmActionImport> actionImportsLocal = new ArrayList<EdmActionImport>();
+
+ if (providerActionImports != null) {
+ for (ActionImport actionImport : providerActionImports) {
+ final EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
+ actionImportCache.put(actionImport.getName(), impl);
+ actionImportsLocal.add(impl);
+ }
+ actionImports = actionImportsLocal;
+ }
+
+ }
+
+ private void loadContainer() {
+ if (container == null) {
+ try {
+ EntityContainer containerLocal = provider.getEntityContainer();
+ if (containerLocal == null) {
+ containerLocal = new EntityContainer().setName(getName());
+ }
+
+ container = containerLocal;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return null;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return getFullQualifiedName();
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.EntityContainer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntitySetImpl.java
new file mode 100644
index 0000000..2d4bd0d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntitySetImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.provider.EntitySet;
+
+public class EdmEntitySetImpl extends AbstractEdmBindingTarget implements EdmEntitySet {
+
+ private EntitySet entitySet;
+
+ public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final EntitySet entitySet) {
+ super(edm, container, entitySet);
+ this.entitySet = entitySet;
+ }
+
+ @Override
+ public boolean isIncludeInServiceDocument() {
+ return entitySet.isIncludeInServiceDocument();
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.EntitySet;
+ }
+}
[08/11] olingo-odata4 git commit: [OLINGO-564] Renamed client edm
classes
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java
deleted file mode 100644
index 18ffb34..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractDynamicAnnotationExpression.java
+++ /dev/null
@@ -1,356 +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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonLocation;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.ClassUtils;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath;
-import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
-import org.apache.olingo.commons.api.edm.provider.annotation.Cast;
-import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.If;
-import org.apache.olingo.commons.api.edm.provider.annotation.IsOf;
-import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElement;
-import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference;
-import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath;
-import org.apache.olingo.commons.api.edm.provider.annotation.Not;
-import org.apache.olingo.commons.api.edm.provider.annotation.Null;
-import org.apache.olingo.commons.api.edm.provider.annotation.Path;
-import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath;
-import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
-import org.apache.olingo.commons.api.edm.provider.annotation.Record;
-import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = AbstractDynamicAnnotationExpression.DynamicAnnotationExpressionDeserializer.class)
-public abstract class AbstractDynamicAnnotationExpression
- extends AbstractAnnotationExpression implements DynamicAnnotationExpression {
-
- private static final long serialVersionUID = 1093411847477874348L;
-
- @Override
- public boolean isNot() {
- return this instanceof Not;
- }
-
- @Override
- public Not asNot() {
- return isNot() ? (Not) this : null;
-
- }
-
- @Override
- public boolean isTwoParamsOp() {
- return this instanceof TwoParamsOpDynamicAnnotationExpression;
- }
-
- @Override
- public TwoParamsOpDynamicAnnotationExpression asTwoParamsOp() {
- return isTwoParamsOp() ? (TwoParamsOpDynamicAnnotationExpression) this : null;
- }
-
- @Override
- public boolean isAnnotationPath() {
- return this instanceof AnnotationPath;
- }
-
- @Override
- public AnnotationPath asAnnotationPath() {
- return isAnnotationPath() ? (AnnotationPath) this : null;
- }
-
- @Override
- public boolean isApply() {
- return this instanceof Apply;
- }
-
- @Override
- public Apply asApply() {
- return isApply() ? (Apply) this : null;
- }
-
- @Override
- public boolean isCast() {
- return this instanceof Cast;
- }
-
- @Override
- public Cast asCast() {
- return isCast() ? (Cast) this : null;
- }
-
- @Override
- public boolean isCollection() {
- return this instanceof Collection;
- }
-
- @Override
- public Collection asCollection() {
- return isCollection() ? (Collection) this : null;
- }
-
- @Override
- public boolean isIf() {
- return this instanceof If;
- }
-
- @Override
- public If asIf() {
- return isIf() ? (If) this : null;
- }
-
- @Override
- public boolean isIsOf() {
- return this instanceof IsOf;
- }
-
- @Override
- public IsOf asIsOf() {
- return isIsOf() ? (IsOf) this : null;
- }
-
- @Override
- public boolean isLabeledElement() {
- return this instanceof LabeledElement;
- }
-
- @Override
- public LabeledElement asLabeledElement() {
- return isLabeledElement() ? (LabeledElement) this : null;
- }
-
- @Override
- public boolean isLabeledElementReference() {
- return this instanceof LabeledElementReference;
- }
-
- @Override
- public LabeledElementReference asLabeledElementReference() {
- return isLabeledElementReference() ? (LabeledElementReference) this : null;
- }
-
- @Override
- public boolean isNull() {
- return this instanceof Null;
- }
-
- @Override
- public Null asNull() {
- return isNull() ? (Null) this : null;
- }
-
- @Override
- public boolean isNavigationPropertyPath() {
- return this instanceof NavigationPropertyPath;
- }
-
- @Override
- public NavigationPropertyPath asNavigationPropertyPath() {
- return isNavigationPropertyPath() ? (NavigationPropertyPath) this : null;
- }
-
- @Override
- public boolean isPath() {
- return this instanceof Path;
- }
-
- @Override
- public Path asPath() {
- return isPath() ? (Path) this : null;
- }
-
- @Override
- public boolean isPropertyPath() {
- return this instanceof PropertyPath;
- }
-
- @Override
- public PropertyPath asPropertyPath() {
- return isPropertyPath() ? (PropertyPath) this : null;
- }
-
- @Override
- public boolean isPropertyValue() {
- return this instanceof PropertyValue;
- }
-
- @Override
- public PropertyValue asPropertyValue() {
- return isPropertyValue() ? (PropertyValue) this : null;
- }
-
- @Override
- public boolean isRecord() {
- return this instanceof Record;
- }
-
- @Override
- public Record asRecord() {
- return isRecord() ? (Record) this : null;
- }
-
- @Override
- public boolean isUrlRef() {
- return this instanceof UrlRef;
- }
-
- @Override
- public UrlRef asUrlRef() {
- return isUrlRef() ? (UrlRef) this : null;
- }
-
- static class DynamicAnnotationExpressionDeserializer
- extends AbstractEdmDeserializer<AbstractDynamicAnnotationExpression> {
-
- private static final String[] EL_OR_ATTR = {
- AnnotationPath.class.getSimpleName(), NavigationPropertyPath.class.getSimpleName(),
- Path.class.getSimpleName(), PropertyPath.class.getSimpleName()
- };
-
- private static final String APPLY = Apply.class.getSimpleName();
- private static final String CAST = Cast.class.getSimpleName();
- private static final String COLLECTION = Collection.class.getSimpleName();
- private static final String IF = If.class.getSimpleName();
- private static final String IS_OF = IsOf.class.getSimpleName();
- private static final String LABELED_ELEMENT = LabeledElement.class.getSimpleName();
- private static final String NULL = Null.class.getSimpleName();
- private static final String RECORD = Record.class.getSimpleName();
- private static final String URL_REF = UrlRef.class.getSimpleName();
-
- private AbstractElementOrAttributeExpression getElementOrAttributeExpression(final String simpleClassName)
- throws JsonParseException {
-
- try {
- @SuppressWarnings("unchecked")
- Class<? extends AbstractElementOrAttributeExpression> elOrAttrClass =
- (Class<? extends AbstractElementOrAttributeExpression>) ClassUtils.getClass(
- getClass().getPackage().getName() + "." + simpleClassName + "Impl");
- return elOrAttrClass.newInstance();
- } catch (Exception e) {
- throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e);
- }
- }
-
- private AbstractAnnotationExpression parseConstOrEnumExpression(final JsonParser jp) throws IOException {
- AbstractAnnotationExpression result;
- if (isAnnotationConstExprConstruct(jp)) {
- result = parseAnnotationConstExprConstruct(jp);
- } else {
- result = jp.readValueAs(AbstractDynamicAnnotationExpression.class);
- }
- jp.nextToken();
-
- return result;
- }
-
- @Override
- protected AbstractDynamicAnnotationExpression doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
-
- AbstractDynamicAnnotationExpression expression = null;
-
- if ("Not".equals(jp.getCurrentName())) {
- final NotImpl not = new NotImpl();
-
- jp.nextToken();
- //Search for field name
- while (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
- jp.nextToken();
- }
- not.setExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- //Search for end object
- while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals("Not")) {
- jp.nextToken();
- }
-
- expression = not;
- } else if (TwoParamsOpDynamicAnnotationExpression.Type.fromString(jp.getCurrentName()) != null) {
- final TwoParamsOpDynamicAnnotationExpressionImpl dynExprDoubleParamOp =
- new TwoParamsOpDynamicAnnotationExpressionImpl();
- dynExprDoubleParamOp.setType(TwoParamsOpDynamicAnnotationExpression.Type.fromString(jp.getCurrentName()));
-
- jp.nextToken();
- //Search for field name
- while (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
- jp.nextToken();
- }
- dynExprDoubleParamOp.setLeftExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- dynExprDoubleParamOp.setRightExpression(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- //Search for expression
- while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals(dynExprDoubleParamOp
- .getType().name())) {
- jp.nextToken();
- }
-
- expression = dynExprDoubleParamOp;
- } else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) {
- final AbstractElementOrAttributeExpression elOrAttr = getElementOrAttributeExpression(jp.getCurrentName());
- elOrAttr.setValue(jp.nextTextValue());
- expression = elOrAttr;
- } else if (APPLY.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(ApplyImpl.class);
- } else if (CAST.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(CastImpl.class);
- } else if (COLLECTION.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(CollectionImpl.class);
- } else if (IF.equals(jp.getCurrentName())) {
- jp.nextToken();
- jp.nextToken();
-
- final IfImpl ifImpl = new IfImpl();
- ifImpl.setGuard(parseConstOrEnumExpression(jp));
- ifImpl.setThen(parseConstOrEnumExpression(jp));
- ifImpl.setElse(parseConstOrEnumExpression(jp));
-
- expression = ifImpl;
- } else if (IS_OF.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(IsOfImpl.class);
- } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(LabeledElementImpl.class);
- } else if (NULL.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(NullImpl.class);
- } else if (RECORD.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(RecordImpl.class);
- } else if (URL_REF.equals(jp.getCurrentName())) {
- jp.nextToken();
- expression = jp.readValueAs(UrlRefImpl.class);
- }
-
- return expression;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.java
deleted file mode 100644
index 8237fca..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElementOrAttributeExpression.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.client.core.edm.xml.annotation;
-
-/**
- * Groups dynamic expressions that may be provided using element notation or attribute notation.
- */
-abstract class AbstractElementOrAttributeExpression extends AbstractDynamicAnnotationExpression {
-
- private static final long serialVersionUID = 1588336268773032932L;
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java
deleted file mode 100644
index 86a7503..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPathImpl.java
+++ /dev/null
@@ -1,27 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath;
-
-public class AnnotationPathImpl extends AbstractElementOrAttributeExpression implements AnnotationPath {
-
- private static final long serialVersionUID = 5360735207353494466L;
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java
deleted file mode 100644
index a2733cc..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyImpl.java
+++ /dev/null
@@ -1,82 +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.client.core.edm.xml.annotation;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = ApplyImpl.ApplyDeserializer.class)
-public class ApplyImpl extends AbstractAnnotatableDynamicAnnotationExpression implements Apply {
-
- private static final long serialVersionUID = 4358398303405059879L;
-
- private String function;
-
- private final List<AnnotationExpression> parameters = new ArrayList<AnnotationExpression>();
-
- @Override
- public String getFunction() {
- return function;
- }
-
- public void setFunction(final String function) {
- this.function = function;
- }
-
- @Override
- public List<AnnotationExpression> getParameters() {
- return parameters;
- }
-
- static class ApplyDeserializer extends AbstractEdmDeserializer<ApplyImpl> {
-
- @Override
- protected ApplyImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final ApplyImpl apply = new ApplyImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Function".equals(jp.getCurrentName())) {
- apply.setFunction(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- apply.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else if (isAnnotationConstExprConstruct(jp)) {
- apply.getParameters().add(parseAnnotationConstExprConstruct(jp));
- } else {
- apply.getParameters().add(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
-
- return apply;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java
deleted file mode 100644
index 8e8f6e3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastImpl.java
+++ /dev/null
@@ -1,139 +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.client.core.edm.xml.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.annotation.Cast;
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = CastImpl.CastDeserializer.class)
-public class CastImpl extends AbstractAnnotatableDynamicAnnotationExpression implements Cast {
-
- private static final long serialVersionUID = 3312415984116005313L;
-
- private String type;
-
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- private SRID srid;
-
- private DynamicAnnotationExpression value;
-
- @Override
- public String getType() {
- return type;
- }
-
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- }
-
- @Override
- public Integer getPrecision() {
- return precision;
- }
-
- public void setPrecision(final Integer precision) {
- this.precision = precision;
- }
-
- @Override
- public Integer getScale() {
- return scale;
- }
-
- public void setScale(final Integer scale) {
- this.scale = scale;
- }
-
- @Override
- public SRID getSrid() {
- return srid;
- }
-
- public void setSrid(final SRID srid) {
- this.srid = srid;
- }
-
- @Override
- public DynamicAnnotationExpression getValue() {
- return value;
- }
-
- public void setValue(final DynamicAnnotationExpression value) {
- this.value = value;
- }
-
- static class CastDeserializer extends AbstractEdmDeserializer<CastImpl> {
-
- @Override
- protected CastImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final CastImpl cast = new CastImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Type".equals(jp.getCurrentName())) {
- cast.setType(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- cast.getAnnotations().add(jp.readValueAs(AnnotationImpl.class));
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- final String maxLenght = jp.nextTextValue();
- cast.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
- } else if ("Precision".equals(jp.getCurrentName())) {
- cast.setPrecision(Integer.valueOf(jp.nextTextValue()));
- } else if ("Scale".equals(jp.getCurrentName())) {
- final String scale = jp.nextTextValue();
- cast.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
- } else if ("SRID".equals(jp.getCurrentName())) {
- final String srid = jp.nextTextValue();
- if (srid != null) {
- cast.setSrid(SRID.valueOf(srid));
- }
- } else {
- cast.setValue(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
- return cast;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java
new file mode 100644
index 0000000..1787708
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientAnnotationPath.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationPath;
+
+public class ClientAnnotationPath extends AbstractClientElementOrAttributeExpression implements AnnotationPath {
+
+ private static final long serialVersionUID = 5360735207353494466L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.java
new file mode 100644
index 0000000..c731036
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientApply.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.client.core.edm.xml.annotation;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.Apply;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientApply.ApplyDeserializer.class)
+public class ClientApply extends AbstractClientAnnotatableDynamicAnnotationExpression implements Apply {
+
+ private static final long serialVersionUID = 4358398303405059879L;
+
+ private String function;
+
+ private final List<AnnotationExpression> parameters = new ArrayList<AnnotationExpression>();
+
+ @Override
+ public String getFunction() {
+ return function;
+ }
+
+ public void setFunction(final String function) {
+ this.function = function;
+ }
+
+ @Override
+ public List<AnnotationExpression> getParameters() {
+ return parameters;
+ }
+
+ static class ApplyDeserializer extends AbstractClientEdmDeserializer<ClientApply> {
+
+ @Override
+ protected ClientApply doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientApply apply = new ClientApply();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Function".equals(jp.getCurrentName())) {
+ apply.setFunction(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ apply.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ apply.getParameters().add(parseAnnotationConstExprConstruct(jp));
+ } else {
+ apply.getParameters().add(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+
+ return apply;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java
new file mode 100644
index 0000000..f8eb827
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCast.java
@@ -0,0 +1,139 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.annotation.Cast;
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientCast.CastDeserializer.class)
+public class ClientCast extends AbstractClientAnnotatableDynamicAnnotationExpression implements Cast {
+
+ private static final long serialVersionUID = 3312415984116005313L;
+
+ private String type;
+
+ private Integer maxLength;
+
+ private Integer precision;
+
+ private Integer scale;
+
+ private SRID srid;
+
+ private DynamicAnnotationExpression value;
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final Integer maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final Integer precision) {
+ this.precision = precision;
+ }
+
+ @Override
+ public Integer getScale() {
+ return scale;
+ }
+
+ public void setScale(final Integer scale) {
+ this.scale = scale;
+ }
+
+ @Override
+ public SRID getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final SRID srid) {
+ this.srid = srid;
+ }
+
+ @Override
+ public DynamicAnnotationExpression getValue() {
+ return value;
+ }
+
+ public void setValue(final DynamicAnnotationExpression value) {
+ this.value = value;
+ }
+
+ static class CastDeserializer extends AbstractClientEdmDeserializer<ClientCast> {
+
+ @Override
+ protected ClientCast doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientCast cast = new ClientCast();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ cast.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ cast.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ final String maxLenght = jp.nextTextValue();
+ cast.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ cast.setPrecision(Integer.valueOf(jp.nextTextValue()));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ cast.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ cast.setSrid(SRID.valueOf(srid));
+ }
+ } else {
+ cast.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+ return cast;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java
new file mode 100644
index 0000000..83419a3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientCollection.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientCollection.CollectionDeserializer.class)
+public class ClientCollection extends AbstractClientDynamicAnnotationExpression implements Collection {
+
+ private static final long serialVersionUID = -724749123749715643L;
+
+ private final List<AnnotationExpression> items = new ArrayList<AnnotationExpression>();
+
+ @Override
+ public List<AnnotationExpression> getItems() {
+ return items;
+ }
+
+ static class CollectionDeserializer extends AbstractClientEdmDeserializer<ClientCollection> {
+ @Override
+ protected ClientCollection doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientCollection collection = new ClientCollection();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ collection.getItems().add(parseAnnotationConstExprConstruct(jp));
+ } else {
+ collection.getItems().add(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+
+ return collection;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java
new file mode 100644
index 0000000..13d9e72
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientConstantAnnotationExpression.java
@@ -0,0 +1,52 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
+
+public class ClientConstantAnnotationExpression
+ extends AbstractClientAnnotationExpression implements ConstantAnnotationExpression {
+
+ private static final long serialVersionUID = 5618680702707972904L;
+
+ private Type type;
+
+ private String value;
+
+ @Override
+ public Type getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java
new file mode 100644
index 0000000..4795f14
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIf.java
@@ -0,0 +1,61 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.If;
+
+public class ClientIf extends AbstractClientAnnotatableDynamicAnnotationExpression implements If {
+
+ private static final long serialVersionUID = -8571383625077590656L;
+
+ private AnnotationExpression guard;
+
+ private AnnotationExpression _then;
+
+ private AnnotationExpression _else;
+
+ @Override
+ public AnnotationExpression getGuard() {
+ return guard;
+ }
+
+ public void setGuard(final AnnotationExpression guard) {
+ this.guard = guard;
+ }
+
+ @Override
+ public AnnotationExpression getThen() {
+ return _then;
+ }
+
+ public void setThen(final AnnotationExpression _then) {
+ this._then = _then;
+ }
+
+ @Override
+ public AnnotationExpression getElse() {
+ return _else;
+ }
+
+ public void setElse(final AnnotationExpression _else) {
+ this._else = _else;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java
new file mode 100644
index 0000000..ed13dbc
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientIsOf.java
@@ -0,0 +1,138 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.IsOf;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientIsOf.IsOfDeserializer.class)
+public class ClientIsOf extends AbstractClientAnnotatableDynamicAnnotationExpression implements IsOf {
+
+ private static final long serialVersionUID = -893355856129761174L;
+
+ private String type;
+
+ private Integer maxLength;
+
+ private Integer precision;
+
+ private Integer scale;
+
+ private SRID srid;
+
+ private DynamicAnnotationExpression value;
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final Integer maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final Integer precision) {
+ this.precision = precision;
+ }
+
+ @Override
+ public Integer getScale() {
+ return scale;
+ }
+
+ public void setScale(final Integer scale) {
+ this.scale = scale;
+ }
+
+ @Override
+ public SRID getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final SRID srid) {
+ this.srid = srid;
+ }
+
+ @Override
+ public DynamicAnnotationExpression getValue() {
+ return value;
+ }
+
+ public void setValue(final DynamicAnnotationExpression value) {
+ this.value = value;
+ }
+
+ static class IsOfDeserializer extends AbstractClientEdmDeserializer<ClientIsOf> {
+ @Override
+ protected ClientIsOf doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientIsOf isof = new ClientIsOf();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ isof.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ isof.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ final String maxLenght = jp.nextTextValue();
+ isof.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ isof.setPrecision(Integer.valueOf(jp.nextTextValue()));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ final String scale = jp.nextTextValue();
+ isof.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ final String srid = jp.nextTextValue();
+ if (srid != null) {
+ isof.setSrid(SRID.valueOf(srid));
+ }
+ } else {
+ isof.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+ return isof;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java
new file mode 100644
index 0000000..3273585
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElement.java
@@ -0,0 +1,81 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElement;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientLabeledElement.LabeledElementDeserializer.class)
+public class ClientLabeledElement
+ extends AbstractClientAnnotatableDynamicAnnotationExpression implements LabeledElement {
+
+ private static final long serialVersionUID = 4909387630253341824L;
+
+ private String name;
+
+ private DynamicAnnotationExpression value;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public DynamicAnnotationExpression getValue() {
+ return value;
+ }
+
+ public void setValue(final DynamicAnnotationExpression value) {
+ this.value = value;
+ }
+
+ static class LabeledElementDeserializer extends AbstractClientEdmDeserializer<ClientLabeledElement> {
+ @Override
+ protected ClientLabeledElement doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientLabeledElement element = new ClientLabeledElement();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Name".equals(jp.getCurrentName())) {
+ element.setName(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ element.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else {
+ element.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java
new file mode 100644
index 0000000..fd19270
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientLabeledElementReference.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.LabeledElementReference;
+
+public class ClientLabeledElementReference
+ extends AbstractClientElementOrAttributeExpression implements LabeledElementReference {
+
+ private static final long serialVersionUID = 7560525604021670529L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java
new file mode 100644
index 0000000..b7be32e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNavigationPropertyPath.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.NavigationPropertyPath;
+
+public class ClientNavigationPropertyPath extends AbstractClientElementOrAttributeExpression
+ implements NavigationPropertyPath {
+
+ private static final long serialVersionUID = 879840502446301312L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java
new file mode 100644
index 0000000..a85c052
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNot.java
@@ -0,0 +1,39 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.Not;
+
+public class ClientNot extends AbstractClientDynamicAnnotationExpression implements Not {
+
+ private static final long serialVersionUID = -437788415922966812L;
+
+ private DynamicAnnotationExpression expression;
+
+ @Override
+ public DynamicAnnotationExpression getExpression() {
+ return expression;
+ }
+
+ public void setExpression(final DynamicAnnotationExpression expression) {
+ this.expression = expression;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java
new file mode 100644
index 0000000..d8d5de1
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientNull.java
@@ -0,0 +1,53 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.Null;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientNull.NullDeserializer.class)
+public class ClientNull extends AbstractClientAnnotatableDynamicAnnotationExpression implements Null {
+
+ private static final long serialVersionUID = -3148516847180393142L;
+
+ static class NullDeserializer extends AbstractClientEdmDeserializer<ClientNull> {
+ @Override
+ protected ClientNull doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientNull _null = new ClientNull();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Annotation".equals(jp.getCurrentName())) {
+ _null.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ }
+ }
+ }
+ return _null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java
new file mode 100644
index 0000000..6dd5518
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPath.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.Path;
+
+public class ClientPath extends AbstractClientElementOrAttributeExpression implements Path {
+
+ private static final long serialVersionUID = 6020168217561402545L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java
new file mode 100644
index 0000000..e4804fe
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyPath.java
@@ -0,0 +1,27 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.PropertyPath;
+
+public class ClientPropertyPath extends AbstractClientElementOrAttributeExpression implements PropertyPath {
+
+ private static final long serialVersionUID = -9133862135834738470L;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.java
new file mode 100644
index 0000000..97ff40a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientPropertyValue.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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientPropertyValue.PropertyValueDeserializer.class)
+public class ClientPropertyValue extends AbstractClientAnnotatableDynamicAnnotationExpression implements PropertyValue {
+
+ private static final long serialVersionUID = -8437649215282645228L;
+
+ private String property;
+
+ private AnnotationExpression value;
+
+ @Override
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ @Override
+ public AnnotationExpression getValue() {
+ return value;
+ }
+
+ public void setValue(final AnnotationExpression value) {
+ this.value = value;
+ }
+
+ static class PropertyValueDeserializer extends AbstractClientEdmDeserializer<ClientPropertyValue> {
+ @Override
+ protected ClientPropertyValue doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientPropertyValue propValue = new ClientPropertyValue();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Property".equals(jp.getCurrentName())) {
+ propValue.setProperty(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ propValue.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ propValue.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ propValue.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+ return propValue;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java
new file mode 100644
index 0000000..744e061
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientRecord.java
@@ -0,0 +1,78 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.client.core.edm.xml.ClientAnnotation;
+import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
+import org.apache.olingo.commons.api.edm.provider.annotation.Record;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = ClientRecord.RecordDeserializer.class)
+public class ClientRecord extends AbstractClientAnnotatableDynamicAnnotationExpression implements Record {
+
+ private static final long serialVersionUID = 4275271751615410709L;
+
+ private String type;
+
+ private final List<PropertyValue> propertyValues = new ArrayList<PropertyValue>();
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public List<PropertyValue> getPropertyValues() {
+ return propertyValues;
+ }
+
+ static class RecordDeserializer extends AbstractClientEdmDeserializer<ClientRecord> {
+ @Override
+ protected ClientRecord doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientRecord record = new ClientRecord();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ record.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ record.getAnnotations().add(jp.readValueAs(ClientAnnotation.class));
+ } else {
+ record.getPropertyValues().add(jp.readValueAs(ClientPropertyValue.class));
+ }
+ }
+ }
+ return record;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java
new file mode 100644
index 0000000..2c371b6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientTwoParamsOpDynamicAnnotationExpression.java
@@ -0,0 +1,62 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.TwoParamsOpDynamicAnnotationExpression;
+
+public class ClientTwoParamsOpDynamicAnnotationExpression
+ extends AbstractClientDynamicAnnotationExpression implements TwoParamsOpDynamicAnnotationExpression {
+
+ private static final long serialVersionUID = 6241842185452451946L;
+
+ private Type type;
+
+ private DynamicAnnotationExpression left;
+
+ private DynamicAnnotationExpression right;
+
+ @Override
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ @Override
+ public DynamicAnnotationExpression getLeftExpression() {
+ return left;
+ }
+
+ public void setLeftExpression(final DynamicAnnotationExpression left) {
+ this.left = left;
+ }
+
+ @Override
+ public DynamicAnnotationExpression getRightExpression() {
+ return right;
+ }
+
+ public void setRightExpression(final DynamicAnnotationExpression right) {
+ this.right = right;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java
new file mode 100644
index 0000000..82d6d38
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ClientUrlRef.java
@@ -0,0 +1,66 @@
+/*
+ * 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.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import org.apache.olingo.client.core.edm.xml.AbstractClientEdmDeserializer;
+import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
+import org.apache.olingo.commons.api.edm.provider.annotation.UrlRef;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.io.IOException;
+
+@JsonDeserialize(using = ClientUrlRef.UrlRefDeserializer.class)
+public class ClientUrlRef extends AbstractClientDynamicAnnotationExpression implements UrlRef {
+
+ private static final long serialVersionUID = -7693224811739000440L;
+
+ private AnnotationExpression value;
+
+ @Override
+ public AnnotationExpression getValue() {
+ return value;
+ }
+
+ public void setValue(final AnnotationExpression value) {
+ this.value = value;
+ }
+
+ static class UrlRefDeserializer extends AbstractClientEdmDeserializer<ClientUrlRef> {
+ @Override
+ protected ClientUrlRef doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException {
+ final ClientUrlRef urlref = new ClientUrlRef();
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ urlref.setValue(parseAnnotationConstExprConstruct(jp));
+ } else {
+ urlref.setValue(jp.readValueAs(AbstractClientDynamicAnnotationExpression.class));
+ }
+ }
+ }
+ return urlref;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java
deleted file mode 100644
index 243d0a3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionImpl.java
+++ /dev/null
@@ -1,65 +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.client.core.edm.xml.annotation;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import org.apache.olingo.client.core.edm.xml.AbstractEdmDeserializer;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.Collection;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = CollectionImpl.CollectionDeserializer.class)
-public class CollectionImpl extends AbstractDynamicAnnotationExpression implements Collection {
-
- private static final long serialVersionUID = -724749123749715643L;
-
- private final List<AnnotationExpression> items = new ArrayList<AnnotationExpression>();
-
- @Override
- public List<AnnotationExpression> getItems() {
- return items;
- }
-
- static class CollectionDeserializer extends AbstractEdmDeserializer<CollectionImpl> {
- @Override
- protected CollectionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException {
- final CollectionImpl collection = new CollectionImpl();
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if (isAnnotationConstExprConstruct(jp)) {
- collection.getItems().add(parseAnnotationConstExprConstruct(jp));
- } else {
- collection.getItems().add(jp.readValueAs(AbstractDynamicAnnotationExpression.class));
- }
- }
- }
-
- return collection;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java
deleted file mode 100644
index 5e1cc93..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstantAnnotationExpressionImpl.java
+++ /dev/null
@@ -1,52 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.ConstantAnnotationExpression;
-
-public class ConstantAnnotationExpressionImpl
- extends AbstractAnnotationExpression implements ConstantAnnotationExpression {
-
- private static final long serialVersionUID = 5618680702707972904L;
-
- private Type type;
-
- private String value;
-
- @Override
- public Type getType() {
- return type;
- }
-
- @Override
- public void setType(final Type type) {
- this.type = type;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- @Override
- public void setValue(final String value) {
- this.value = value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/754e23ab/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java
deleted file mode 100644
index e6dd688..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IfImpl.java
+++ /dev/null
@@ -1,61 +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.client.core.edm.xml.annotation;
-
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.If;
-
-public class IfImpl extends AbstractAnnotatableDynamicAnnotationExpression implements If {
-
- private static final long serialVersionUID = -8571383625077590656L;
-
- private AnnotationExpression guard;
-
- private AnnotationExpression _then;
-
- private AnnotationExpression _else;
-
- @Override
- public AnnotationExpression getGuard() {
- return guard;
- }
-
- public void setGuard(final AnnotationExpression guard) {
- this.guard = guard;
- }
-
- @Override
- public AnnotationExpression getThen() {
- return _then;
- }
-
- public void setThen(final AnnotationExpression _then) {
- this._then = _then;
- }
-
- @Override
- public AnnotationExpression getElse() {
- return _else;
- }
-
- public void setElse(final AnnotationExpression _else) {
- this._else = _else;
- }
-
-}
[02/11] olingo-odata4 git commit: [OLINGO-564] Removed 'provider'
package level
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java
deleted file mode 100644
index 4e2cab6..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEnumTypeImpl.java
+++ /dev/null
@@ -1,268 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmMember;
-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.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.EnumMember;
-import org.apache.olingo.commons.api.edm.provider.EnumType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class EdmEnumTypeImpl extends EdmTypeImpl implements EdmEnumType {
-
- private static final Set<EdmPrimitiveTypeKind> VALID_UNDERLYING_TYPES = new HashSet<EdmPrimitiveTypeKind>();
- static {
- VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Byte);
- VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.SByte);
- VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int16);
- VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int32);
- VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int64);
- }
-
- private final EdmPrimitiveType underlyingType;
- private final EnumType enumType;
- private final String uriPrefix;
- private final String uriSuffix;
- private List<String> memberNames;
- private LinkedHashMap<String, EdmMember> membersMap;
-
- public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) {
- super(edm, enumName, EdmTypeKind.ENUM, enumType);
-
- if (enumType.getUnderlyingType() == null) {
- underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
- } else {
- EdmPrimitiveTypeKind underlyingTypeKind = EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType());
-
- if (!VALID_UNDERLYING_TYPES.contains(underlyingTypeKind)) {
- throw new EdmException("Not allowed as underlying type: " + underlyingTypeKind);
- }
- underlyingType = EdmPrimitiveTypeFactory.getInstance(underlyingTypeKind);
- }
-
- this.enumType = enumType;
- this.uriPrefix = enumName.getFullQualifiedNameAsString() + '\'';
- this.uriSuffix = "'";
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- return underlyingType;
- }
-
- @Override
- public EdmMember getMember(final String name) {
- if (membersMap == null) {
- createEdmMembers();
- }
- return membersMap.get(name);
- }
-
- @Override
- public List<String> getMemberNames() {
- if (memberNames == null) {
- createEdmMembers();
- }
- return Collections.unmodifiableList(memberNames);
- }
-
- private void createEdmMembers() {
- final LinkedHashMap<String, EdmMember> membersMapLocal = new LinkedHashMap<String, EdmMember>();
- final List<String> memberNamesLocal = new ArrayList<String>();
- if (enumType.getMembers() != null) {
- for (final EnumMember member : enumType.getMembers()) {
- membersMapLocal.put(member.getName(), new EdmMemberImpl(edm, getFullQualifiedName(), member));
- memberNamesLocal.add(member.getName());
- }
-
- membersMap = membersMapLocal;
- memberNames = memberNamesLocal;
- }
- }
-
- @Override
- public boolean isCompatible(final EdmPrimitiveType primitiveType) {
- return equals(primitiveType);
- }
-
- @Override
- public Class<?> getDefaultType() {
- return getUnderlyingType().getDefaultType();
- }
-
- @Override
- public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale, final Boolean isUnicode) {
-
- try {
- valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, getDefaultType());
- return true;
- } catch (final EdmPrimitiveTypeException e) {
- return false;
- }
- }
-
- private Long parseEnumValue(final String value) throws EdmPrimitiveTypeException {
- Long result = null;
- for (final String memberValue : value.split(",", isFlags() ? -1 : 1)) {
- Long memberValueLong = null;
- for (final EdmMember member : getMembers()) {
- if (member.getName().equals(memberValue) || member.getValue().equals(memberValue)) {
- memberValueLong = Long.decode(member.getValue());
- }
- }
- if (memberValueLong == null) {
- throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content.");
- }
- result = result == null ? memberValueLong : result | memberValueLong;
- }
- return result;
- }
-
- @Override
- public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
- throws EdmPrimitiveTypeException {
-
- if (value == null) {
- if (isNullable != null && !isNullable) {
- throw new EdmPrimitiveTypeException("The literal 'null' is not allowed.");
- }
- return null;
- }
-
- try {
- return EdmInt64.convertNumber(parseEnumValue(value), returnType);
- } catch (final IllegalArgumentException e) {
- throw new EdmPrimitiveTypeException("The literal '" + value
- + "' cannot be converted to value type " + returnType + ".", e);
- } catch (final ClassCastException e) {
- throw new EdmPrimitiveTypeException("The value type " + returnType + " is not supported.", e);
- }
- }
-
- private String constructEnumValue(final long value)
- throws EdmPrimitiveTypeException {
- long remaining = value;
- final StringBuilder result = new StringBuilder();
-
- final boolean flags = isFlags();
- for (final EdmMember member : getMembers()) {
- final long memberValue = Long.parseLong(member.getValue());
- if (flags) {
- if ((memberValue & remaining) == memberValue) {
- if (result.length() > 0) {
- result.append(',');
- }
- result.append(member.getName());
- remaining ^= memberValue;
- }
- } else {
- if (value == memberValue) {
- return member.getName();
- }
- }
- }
-
- if (remaining != 0) {
- throw new EdmPrimitiveTypeException("The value '" + value + "' is not valid.");
- }
- return result.toString();
- }
-
- private Collection<EdmMember> getMembers() {
- if(membersMap == null){
- createEdmMembers();
- }
- return membersMap.values();
- }
-
- @Override
- public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
-
- if (value == null) {
- if (isNullable != null && !isNullable) {
- throw new EdmPrimitiveTypeException("The value NULL is not allowed.");
- }
- return null;
- }
- if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long) {
- return constructEnumValue(((Number) value).longValue());
- } else {
- throw new EdmPrimitiveTypeException("The value type " + value.getClass() + " is not supported.");
- }
- }
-
- @Override
- public String toUriLiteral(final String literal) {
- return literal == null ? null
- : uriPrefix.isEmpty() && uriSuffix.isEmpty() ? literal : uriPrefix + literal + uriSuffix;
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- if (literal == null) {
- return null;
- } else if (uriPrefix.isEmpty() && uriSuffix.isEmpty()) {
- return literal;
- } else if (literal.length() >= uriPrefix.length() + uriSuffix.length()
- && literal.startsWith(uriPrefix) && literal.endsWith(uriSuffix)) {
- return literal.substring(uriPrefix.length(), literal.length() - uriSuffix.length());
- } else {
- throw new EdmPrimitiveTypeException("The literal '" + literal + "' has illegal content.");
- }
- }
-
- @Override
- public boolean isFlags() {
- return enumType.isFlags();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.EnumType;
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return null;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return getFullQualifiedName();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
deleted file mode 100644
index fa21fb6..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImpl.java
+++ /dev/null
@@ -1,52 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.Function;
-
-public class EdmFunctionImpl extends AbstractEdmOperation implements EdmFunction {
-
- private final Function function;
-
- public EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
- super(edm, name, function, EdmTypeKind.FUNCTION);
- this.function = function;
- }
-
- @Override
- public boolean isComposable() {
- return function.isComposable();
- }
-
- @Override
- public EdmReturnType getReturnType() {
- final EdmReturnType returnType = super.getReturnType();
- if (returnType == null) {
- throw new EdmException("ReturnType for a function must not be null");
- }
- return returnType;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
deleted file mode 100644
index b2e2397..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmFunctionImportImpl.java
+++ /dev/null
@@ -1,63 +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.provider;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.FunctionImport;
-
-public class EdmFunctionImportImpl extends AbstractEdmOperationImport implements EdmFunctionImport {
-
- private final FunctionImport functionImport;
-
- public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final FunctionImport functionImport) {
- super(edm, container, functionImport);
- this.functionImport = functionImport;
- }
-
- @Override
- public FullQualifiedName getFunctionFqn() {
- return functionImport.getFunctionFQN();
- }
-
- @Override
- public EdmFunction getUnboundFunction(final List<String> parameterNames) {
- return edm.getUnboundFunction(getFunctionFqn(), parameterNames);
- }
-
- @Override
- public List<EdmFunction> getUnboundFunctions() {
- return edm.getUnboundFunctions(getFunctionFqn());
- }
-
- @Override
- public boolean isIncludeInServiceDocument() {
- return functionImport.isIncludeInServiceDocument();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.FunctionImport;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
deleted file mode 100644
index 1122f74..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmKeyPropertyRefImpl.java
+++ /dev/null
@@ -1,83 +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.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-
-public class EdmKeyPropertyRefImpl implements EdmKeyPropertyRef {
-
- private final PropertyRef ref;
- private EdmEntityType edmEntityType;
- private EdmProperty property;
-
- public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef ref) {
- this.edmEntityType = edmEntityType;
- this.ref = ref;
- }
-
- @Override
- public String getName() {
- return ref.getName();
- }
-
- @Override
- public String getAlias() {
- return ref.getAlias();
- }
-
- @Override
- public EdmProperty getProperty() {
- if (property == null) {
- if (getAlias() == null) {
- property = edmEntityType.getStructuralProperty(getName());
- if (property == null) {
- throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
- + getName());
- }
- } else {
- if (getName() == null || getName().isEmpty()) {
- throw new EdmException("Alias but no path specified for propertyRef");
- }
- final String[] splitPath = getName().split("/");
- EdmStructuredType structType = edmEntityType;
- for (int i = 0; i < splitPath.length - 1; i++) {
- final EdmProperty _property = structType.getStructuralProperty(splitPath[i]);
- if (_property == null) {
- throw new EdmException("Invalid property ref specified. Can´t find property with name: " + splitPath[i]
- + " at type: " + structType.getNamespace() + "." + structType.getName());
- }
- structType = (EdmStructuredType) _property.getType();
- }
- property = structType.getStructuralProperty(splitPath[splitPath.length - 1]);
- if (property == null) {
- throw new EdmException("Invalid property ref specified. Can´t find property with name: "
- + splitPath[splitPath.length - 1] + " at type: " + structType.getNamespace() + "."
- + structType.getName());
- }
- }
- }
-
- return property;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
deleted file mode 100644
index b3a6f1e..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmMemberImpl.java
+++ /dev/null
@@ -1,56 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmMember;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.EnumMember;
-
-public class EdmMemberImpl extends AbstractEdmNamed implements EdmMember {
-
- private final FullQualifiedName enumFQN;
- private final EnumMember member;
-
- public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final EnumMember member) {
- super(edm, member.getName(), member);
- this.enumFQN = enumFQN;
- this.member = member;
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.Member;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return enumFQN;
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return getName();
- }
-
- @Override
- public String getValue() {
- return member.getValue();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyBindingImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyBindingImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyBindingImpl.java
deleted file mode 100644
index ac534b2..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyBindingImpl.java
+++ /dev/null
@@ -1,43 +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.provider;
-
-import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
-
-public class EdmNavigationPropertyBindingImpl implements EdmNavigationPropertyBinding {
-
- private final String path;
- private final String target;
-
- public EdmNavigationPropertyBindingImpl(final String path, final String target) {
- this.path = path;
- this.target = target;
- }
-
- @Override
- public String getPath() {
- return path;
- }
-
- @Override
- public String getTarget() {
- return target;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
deleted file mode 100644
index d6a56bf..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmNavigationPropertyImpl.java
+++ /dev/null
@@ -1,142 +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.provider;
-
-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.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
-
-public class EdmNavigationPropertyImpl extends AbstractEdmNamed implements EdmElement, EdmNavigationProperty {
-
- private final FullQualifiedName structuredTypeName;
- private final NavigationProperty navigationProperty;
- private List<EdmReferentialConstraint> referentialConstraints;
- private EdmEntityType typeImpl;
- private EdmNavigationProperty partnerNavigationProperty;
-
- public EdmNavigationPropertyImpl(
- final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
- super(edm, navigationProperty.getName(), navigationProperty);
- this.structuredTypeName = structuredTypeName;
- this.navigationProperty = navigationProperty;
- }
-
- @Override
- public boolean isCollection() {
- return navigationProperty.isCollection();
- }
-
- @Override
- public boolean isNullable() {
- return navigationProperty.isNullable();
- }
-
- @Override
- public boolean containsTarget() {
- return navigationProperty.isContainsTarget();
- }
-
- @Override
- public EdmEntityType getType() {
- if (typeImpl == null) {
- typeImpl = edm.getEntityType(navigationProperty.getTypeFQN());
- if (typeImpl == null) {
- throw new EdmException("Cannot find type with name: " + navigationProperty.getTypeFQN());
- }
- }
- return typeImpl;
- }
-
- @Override
- public EdmNavigationProperty getPartner() {
- if (partnerNavigationProperty == null) {
- String partner = navigationProperty.getPartner();
- if (partner != null) {
- EdmStructuredType type = getType();
- EdmNavigationProperty property = null;
- final String[] split = partner.split("/");
- for (String element : split) {
- property = type.getNavigationProperty(element);
- if (property == null) {
- throw new EdmException("Cannot find navigation property with name: " + element
- + " at type " + type.getName());
- }
- type = property.getType();
- }
- partnerNavigationProperty = property;
- }
- }
- return partnerNavigationProperty;
- }
-
- @Override
- public String getReferencingPropertyName(final String referencedPropertyName) {
- final List<ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
- if (referentialConstraints != null) {
- for (ReferentialConstraint constraint : referentialConstraints) {
- if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
- return constraint.getProperty();
- }
- }
- }
- return null;
- }
-
- @Override
- public List<EdmReferentialConstraint> getReferentialConstraints() {
- if (referentialConstraints == null) {
- final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints();
- final List<EdmReferentialConstraint> referentialConstraintsLocal = new ArrayList<EdmReferentialConstraint>();
- if (providerConstraints != null) {
- for (ReferentialConstraint constraint : providerConstraints) {
- referentialConstraintsLocal.add(new EdmReferentialConstraintImpl(edm, constraint));
- }
- }
-
- referentialConstraints = referentialConstraintsLocal;
- }
- return Collections.unmodifiableList(referentialConstraints);
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.NavigationProperty;
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return getName();
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return structuredTypeName;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
deleted file mode 100644
index 0973185..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmParameterImpl.java
+++ /dev/null
@@ -1,88 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmMapping;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.Parameter;
-
-public class EdmParameterImpl extends AbstractEdmNamed implements EdmParameter, EdmElement {
-
- private final Parameter parameter;
- private final EdmTypeInfo typeInfo;
- private EdmType typeImpl;
-
- public EdmParameterImpl(final Edm edm, final Parameter parameter) {
- super(edm, parameter.getName(), parameter);
- this.parameter = parameter;
- this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
- }
-
- @Override
- public boolean isCollection() {
- return parameter.isCollection();
- }
-
- @Override
- public EdmMapping getMapping() {
- return parameter.getMapping();
- }
-
- @Override
- public boolean isNullable() {
- return parameter.isNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return parameter.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return parameter.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return parameter.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return parameter.getSrid();
- }
-
- @Override
- public EdmType getType() {
- if (typeImpl == null) {
- typeImpl = typeInfo.getType();
- if (typeImpl == null) {
- throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
- }
- }
-
- return typeImpl;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
deleted file mode 100644
index 14c3faf..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmPropertyImpl.java
+++ /dev/null
@@ -1,127 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmMapping;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.Property;
-
-public class EdmPropertyImpl extends AbstractEdmNamed implements EdmProperty, EdmElement {
-
- private final FullQualifiedName structuredTypeName;
- private final Property property;
- private final EdmTypeInfo typeInfo;
- private EdmType propertyType;
-
- public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) {
- super(edm, property.getName(), property);
-
- this.structuredTypeName = structuredTypeName;
- this.property = property;
- typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build();
- }
-
- @Override
- public EdmType getType() {
- if (propertyType == null) {
- propertyType = typeInfo.getType();
- if (propertyType == null) {
- throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
- }
- }
-
- return propertyType;
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public EdmMapping getMapping() {
- return property.getMapping();
- }
-
- @Override
- public String getMimeType() {
- return property.getMimeType();
- }
-
- @Override
- public boolean isNullable() {
- return property.isNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return property.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return property.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return property.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return property.getSrid();
- }
-
- @Override
- public boolean isUnicode() {
- return property.isUnicode();
- }
-
- @Override
- public String getDefaultValue() {
- return property.getDefaultValue();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.Property;
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return getName();
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return structuredTypeName;
- }
-
- @Override
- public boolean isPrimitive() {
- return typeInfo.isPrimitiveType();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
deleted file mode 100644
index 5a11a7b..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmProviderImpl.java
+++ /dev/null
@@ -1,378 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-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.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Action;
-import org.apache.olingo.commons.api.edm.provider.AliasInfo;
-import org.apache.olingo.commons.api.edm.provider.Annotatable;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-import org.apache.olingo.commons.api.edm.provider.Annotations;
-import org.apache.olingo.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
-import org.apache.olingo.commons.api.edm.provider.EntityType;
-import org.apache.olingo.commons.api.edm.provider.EnumType;
-import org.apache.olingo.commons.api.edm.provider.Function;
-import org.apache.olingo.commons.api.edm.provider.Parameter;
-import org.apache.olingo.commons.api.edm.provider.Schema;
-import org.apache.olingo.commons.api.edm.provider.Term;
-import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.core.edm.AbstractEdm;
-
-public class EdmProviderImpl extends AbstractEdm {
-
- private final EdmProvider provider;
- private final Map<FullQualifiedName, List<Action>> actionsMap =
- Collections.synchronizedMap(new HashMap<FullQualifiedName, List<Action>>());
- private final Map<FullQualifiedName, List<Function>> functionsMap =
- Collections.synchronizedMap(new HashMap<FullQualifiedName, List<Function>>());
-
- public EdmProviderImpl(final EdmProvider provider) {
- this.provider = provider;
- }
-
- @Override
- public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
- try {
- EntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
- if (entityContainerInfo != null) {
- return new EdmEntityContainerImpl(this, provider, entityContainerInfo);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmEnumType createEnumType(final FullQualifiedName enumName) {
- try {
- EnumType enumType = provider.getEnumType(enumName);
- if (enumType != null) {
- return new EdmEnumTypeImpl(this, enumName, enumType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
- try {
- TypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
- if (typeDefinition != null) {
- return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
- try {
- EntityType entityType = provider.getEntityType(entityTypeName);
- if (entityType != null) {
- return new EdmEntityTypeImpl(this, entityTypeName, entityType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
- try {
- final ComplexType complexType = provider.getComplexType(complexTypeName);
- if (complexType != null) {
- return new EdmComplexTypeImpl(this, complexTypeName, complexType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmAction createBoundAction(final FullQualifiedName actionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
-
- try {
- List<Action> actions = actionsMap.get(actionName);
- if (actions == null) {
- actions = provider.getActions(actionName);
- if (actions == null) {
- return null;
- } else {
- actionsMap.put(actionName, actions);
- }
- }
- // Search for bound action where binding parameter matches
- for (Action action : actions) {
- if (action.isBound()) {
- final List<Parameter> parameters = action.getParameters();
- final Parameter parameter = parameters.get(0);
- if (bindingParameterTypeName.equals(parameter.getTypeFQN())
- && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
-
- return new EdmActionImpl(this, actionName, action);
- }
-
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmFunction createBoundFunction(final FullQualifiedName functionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
- final List<String> parameterNames) {
-
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions == null) {
- return null;
- } else {
- functionsMap.put(functionName, functions);
- }
- }
- final List<String> parameterNamesCopy =
- parameterNames == null ? Collections.<String> emptyList() : parameterNames;
- for (Function function : functions) {
- if (function.isBound()) {
- List<Parameter> providerParameters = function.getParameters();
- if (providerParameters == null || providerParameters.size() == 0) {
- throw new EdmException("No parameter specified for bound function: " + functionName);
- }
- final Parameter bindingParameter = providerParameters.get(0);
- if (bindingParameterTypeName.equals(bindingParameter.getTypeFQN())
- && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
-
- if (parameterNamesCopy.size() == providerParameters.size() - 1) {
- final List<String> providerParameterNames = new ArrayList<String>();
- for (int i = 1; i < providerParameters.size(); i++) {
- providerParameterNames.add(providerParameters.get(i).getName());
- }
- if (parameterNamesCopy.containsAll(providerParameterNames)) {
- return new EdmFunctionImpl(this, functionName, function);
- }
- }
- }
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected Map<String, String> createAliasToNamespaceInfo() {
- final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
- try {
- final List<AliasInfo> aliasInfos = provider.getAliasInfos();
- if (aliasInfos != null) {
- for (AliasInfo info : aliasInfos) {
- aliasToNamespaceInfos.put(info.getAlias(), info.getNamespace());
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- return aliasToNamespaceInfos;
- }
-
- @Override
- protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
- try {
- List<Action> actions = actionsMap.get(actionName);
- if (actions == null) {
- actions = provider.getActions(actionName);
- if (actions == null) {
- return null;
- } else {
- actionsMap.put(actionName, actions);
- }
- }
- // Search for first unbound action
- for (Action action : actions) {
- if (!action.isBound()) {
- return new EdmActionImpl(this, actionName, action);
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) {
- List<EdmFunction> result = new ArrayList<EdmFunction>();
-
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions != null) {
- functionsMap.put(functionName, functions);
- }
- }
- if (functions != null) {
- for (Function function : functions) {
- if (!function.isBound()) {
- result.add(new EdmFunctionImpl(this, functionName, function));
- }
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return result;
- }
-
- @Override
- protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions == null) {
- return null;
- } else {
- functionsMap.put(functionName, functions);
- }
- }
-
- final List<String> parameterNamesCopy =
- parameterNames == null ? Collections.<String> emptyList() : parameterNames;
- for (Function function : functions) {
- if (!function.isBound()) {
- List<Parameter> providerParameters = function.getParameters();
- if (providerParameters == null) {
- providerParameters = Collections.emptyList();
- }
- if (parameterNamesCopy.size() == providerParameters.size()) {
- final List<String> functionParameterNames = new ArrayList<String>();
- for (Parameter parameter : providerParameters) {
- functionParameterNames.add(parameter.getName());
- }
-
- if (parameterNamesCopy.containsAll(functionParameterNames)) {
- return new EdmFunctionImpl(this, functionName, function);
- }
- }
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected Map<String, EdmSchema> createSchemas() {
- try {
- final Map<String, EdmSchema> providerSchemas = new LinkedHashMap<String, EdmSchema>();
- for (Schema schema : provider.getSchemas()) {
- providerSchemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
- }
- return providerSchemas;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected EdmTerm createTerm(final FullQualifiedName termName) {
- try {
- Term providerTerm = provider.getTerm(termName);
- if (providerTerm != null) {
- return new EdmTermImpl(this, termName.getNamespace(), providerTerm);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- //TODO: Check Provider annotations implementation
- @Override
- protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) {
- try {
- EdmSchema schema = getSchema(targetName.getNamespace());
- Annotations providerGroup = provider.getAnnotationsGroup(targetName);
- if (providerGroup != null) {
- return new EdmAnnotationsImpl(this, schema, providerGroup);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected List<EdmAnnotation> createAnnotations(final FullQualifiedName annotatedName) {
- try {
- Annotatable providerAnnotatable = provider.getAnnoatatable(annotatedName);
- if (providerAnnotatable != null && providerAnnotatable.getAnnotations() != null) {
- List<EdmAnnotation> result = new ArrayList<EdmAnnotation>();
- for(Annotation annotation : providerAnnotatable.getAnnotations()){
- //Load Term
- getTerm(new FullQualifiedName(annotation.getTerm()));
- result.add(new EdmAnnotationImpl(this, annotation));
- }
- return result;
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java
deleted file mode 100644
index ac38d20..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReferentialConstraintImpl.java
+++ /dev/null
@@ -1,43 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
-import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
-
-public class EdmReferentialConstraintImpl extends AbstractEdmAnnotatable implements EdmReferentialConstraint {
-
- private final ReferentialConstraint constraint;
-
- public EdmReferentialConstraintImpl(final Edm edm, final ReferentialConstraint constraint) {
- super(edm, constraint);
- this.constraint = constraint;
- }
-
- @Override
- public String getPropertyName() {
- return constraint.getProperty();
- }
-
- @Override
- public String getReferencedPropertyName() {
- return constraint.getReferencedProperty();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
deleted file mode 100644
index 7c0c006..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmReturnTypeImpl.java
+++ /dev/null
@@ -1,80 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.ReturnType;
-
-public class EdmReturnTypeImpl implements EdmReturnType {
-
- private final ReturnType returnType;
- private final EdmTypeInfo typeInfo;
- private EdmType typeImpl;
-
- public EdmReturnTypeImpl(final Edm edm, final ReturnType returnType) {
- this.returnType = returnType;
- this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(returnType.getType()).build();
- }
-
- @Override
- public boolean isCollection() {
- return returnType.isCollection();
- }
-
- @Override
- public boolean isNullable() {
- return returnType.isNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return returnType.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return returnType.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return returnType.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return returnType.getSrid();
- }
-
- @Override
- public EdmType getType() {
- if (typeImpl == null) {
- typeImpl = typeInfo.getType();
- if (typeImpl == null) {
- throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
- }
- }
-
- return typeImpl;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java
deleted file mode 100644
index 4d994f6..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSchemaImpl.java
+++ /dev/null
@@ -1,304 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Action;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-import org.apache.olingo.commons.api.edm.provider.Annotations;
-import org.apache.olingo.commons.api.edm.provider.ComplexType;
-import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.commons.api.edm.provider.EntityType;
-import org.apache.olingo.commons.api.edm.provider.EnumType;
-import org.apache.olingo.commons.api.edm.provider.Function;
-import org.apache.olingo.commons.api.edm.provider.Schema;
-import org.apache.olingo.commons.api.edm.provider.Term;
-import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-
-public class EdmSchemaImpl implements EdmSchema {
-
- private final Schema schema;
- private final EdmProviderImpl edm;
- private final EdmProvider provider;
-
- protected final String namespace;
- private final String alias;
- private List<EdmEnumType> enumTypes;
- private List<EdmEntityType> entityTypes;
- private List<EdmComplexType> complexTypes;
- private List<EdmAction> actions;
- private List<EdmFunction> functions;
- private List<EdmTypeDefinition> typeDefinitions;
- private List<EdmTerm> terms;
- private List<EdmAnnotations> annotationGroups;
- private List<EdmAnnotation> annotations;
- private EdmEntityContainer entityContainer;
-
- public EdmSchemaImpl(final EdmProviderImpl edm, final EdmProvider provider, final Schema schema) {
- this.edm = edm;
- this.provider = provider;
- this.schema = schema;
- this.namespace = schema.getNamespace();
- this.alias = schema.getAlias();
-
- if (alias != null) {
- edm.cacheAliasNamespaceInfo(alias, namespace);
- }
-
- enumTypes = createEnumTypes();
- typeDefinitions = createTypeDefinitions();
- entityTypes = createEntityTypes();
- complexTypes = createComplexTypes();
- actions = createActions();
- functions = createFunctions();
- entityContainer = createEntityContainer();
- annotationGroups = createAnnotationGroups();
- annotations = createAnnotations();
- terms = createTerms();
- }
-
- @Override
- public List<EdmEnumType> getEnumTypes() {
- return Collections.unmodifiableList(enumTypes);
- }
-
- @Override
- public List<EdmEntityType> getEntityTypes() {
- return Collections.unmodifiableList(entityTypes);
- }
-
- @Override
- public List<EdmComplexType> getComplexTypes() {
- return Collections.unmodifiableList(complexTypes);
- }
-
- @Override
- public List<EdmAction> getActions() {
- return Collections.unmodifiableList(actions);
- }
-
- @Override
- public List<EdmFunction> getFunctions() {
- return Collections.unmodifiableList(functions);
- }
-
- @Override
- public List<EdmTypeDefinition> getTypeDefinitions() {
- return Collections.unmodifiableList(typeDefinitions);
- }
-
- @Override
- public List<EdmTerm> getTerms() {
- return Collections.unmodifiableList(terms);
- }
-
- @Override
- public List<EdmAnnotations> getAnnotationGroups() {
- return Collections.unmodifiableList(annotationGroups);
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- return Collections.unmodifiableList(annotations);
- }
-
- @Override
- public EdmEntityContainer getEntityContainer() {
- return entityContainer;
- }
-
- @Override
- public String getNamespace() {
- return namespace;
- }
-
- @Override
- public String getAlias() {
- return alias;
- }
-
- protected EdmEntityContainer createEntityContainer() {
- if (schema.getEntityContainer() != null) {
- FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName());
- EdmEntityContainer impl = new EdmEntityContainerImpl(edm, provider, containerFQN, schema.getEntityContainer());
- edm.cacheEntityContainer(containerFQN, impl);
- edm.cacheEntityContainer(null, impl);
- return impl;
- }
- return null;
- }
-
- protected List<EdmTypeDefinition> createTypeDefinitions() {
- final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
- final List<TypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
- if (providerTypeDefinitions != null) {
- for (TypeDefinition def : providerTypeDefinitions) {
- FullQualifiedName typeDefName = new FullQualifiedName(namespace, def.getName());
- EdmTypeDefinitionImpl typeDefImpl = new EdmTypeDefinitionImpl(edm, typeDefName, def);
- typeDefinitions.add(typeDefImpl);
- edm.cacheTypeDefinition(typeDefName, typeDefImpl);
- }
- }
- return typeDefinitions;
- }
-
- protected List<EdmEnumType> createEnumTypes() {
- final List<EdmEnumType> enumTypes = new ArrayList<EdmEnumType>();
- final List<EnumType> providerEnumTypes = schema.getEnumTypes();
- if (providerEnumTypes != null) {
- for (EnumType enumType : providerEnumTypes) {
- FullQualifiedName enumName = new FullQualifiedName(namespace, enumType.getName());
- EdmEnumType enumTypeImpl = new EdmEnumTypeImpl(edm, enumName, enumType);
- enumTypes.add(enumTypeImpl);
- edm.cacheEnumType(enumName, enumTypeImpl);
- }
- }
- return enumTypes;
- }
-
- protected List<EdmEntityType> createEntityTypes() {
- final List<EdmEntityType> entityTypes = new ArrayList<EdmEntityType>();
- final List<EntityType> providerEntityTypes = schema.getEntityTypes();
- if (providerEntityTypes != null) {
- for (EntityType entityType : providerEntityTypes) {
- FullQualifiedName entityTypeName = new FullQualifiedName(namespace, entityType.getName());
- EdmEntityTypeImpl entityTypeImpl = new EdmEntityTypeImpl(edm, entityTypeName, entityType);
- entityTypes.add(entityTypeImpl);
- edm.cacheEntityType(entityTypeName, entityTypeImpl);
- }
- }
- return entityTypes;
- }
-
- protected List<EdmComplexType> createComplexTypes() {
- final List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>();
- final List<ComplexType> providerComplexTypes = schema.getComplexTypes();
- if (providerComplexTypes != null) {
- for (ComplexType complexType : providerComplexTypes) {
- FullQualifiedName comlexTypeName = new FullQualifiedName(namespace, complexType.getName());
- EdmComplexTypeImpl complexTypeImpl = new EdmComplexTypeImpl(edm, comlexTypeName, complexType);
- complexTypes.add(complexTypeImpl);
- edm.cacheComplexType(comlexTypeName, complexTypeImpl);
- }
- }
- return complexTypes;
- }
-
- protected List<EdmAction> createActions() {
- final List<EdmAction> actions = new ArrayList<EdmAction>();
- final List<Action> providerActions = schema.getActions();
- if (providerActions != null) {
- for (Action action : providerActions) {
- FullQualifiedName actionName = new FullQualifiedName(namespace, action.getName());
- EdmActionImpl edmActionImpl = new EdmActionImpl(edm, actionName, action);
- actions.add(edmActionImpl);
- edm.cacheAction(actionName, edmActionImpl);
- }
- }
- return actions;
- }
-
- protected List<EdmFunction> createFunctions() {
- final List<EdmFunction> functions = new ArrayList<EdmFunction>();
- final List<Function> providerFunctions = schema.getFunctions();
- if (providerFunctions != null) {
- for (Function function : providerFunctions) {
- FullQualifiedName functionName = new FullQualifiedName(namespace, function.getName());
- EdmFunctionImpl functionImpl = new EdmFunctionImpl(edm, functionName, function);
- functions.add(functionImpl);
- edm.cacheFunction(functionName, functionImpl);
- }
- }
- return functions;
- }
-
- protected List<EdmTerm> createTerms() {
- final List<EdmTerm> terms = new ArrayList<EdmTerm>();
- final List<Term> providerTerms = schema.getTerms();
- if (providerTerms != null) {
- for (Term term : providerTerms) {
- FullQualifiedName termName = new FullQualifiedName(namespace, term.getName());
- EdmTermImpl termImpl = new EdmTermImpl(edm, getNamespace(), term);
- terms.add(termImpl);
- edm.cacheTerm(termName, termImpl);
- }
- }
- return terms;
- }
-
- protected List<EdmAnnotations> createAnnotationGroups() {
- final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
- final List<Annotations> providerAnnotations =
- schema.getAnnotationGroups();
- if (providerAnnotations != null) {
- for (Annotations annotationGroup : providerAnnotations) {
- FullQualifiedName annotationsGroupName;
- if (annotationGroup.getTarget().contains(".")) {
- annotationsGroupName = new FullQualifiedName(annotationGroup.getTarget());
- } else {
- annotationsGroupName = new FullQualifiedName(namespace, annotationGroup.getTarget());
- }
- EdmAnnotationsImpl annotationsImpl = new EdmAnnotationsImpl(edm, this, annotationGroup);
- annotationGroups.add(annotationsImpl);
- edm.cacheAnnotationGroup(annotationsGroupName, annotationsImpl);
- }
- }
- return annotationGroups;
- }
-
- protected List<EdmAnnotation> createAnnotations() {
- final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
- final List<Annotation> providerAnnotations =
- schema.getAnnotations();
- if (providerAnnotations != null) {
- for (Annotation annotation : providerAnnotations) {
- EdmAnnotationImpl annotationImpl = new EdmAnnotationImpl(edm, annotation);
- annotations.add(annotationImpl);
- }
- }
- return annotations;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- EdmAnnotation result = null;
- for (EdmAnnotation annotation : getAnnotations()) {
- if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
- result = annotation;
- }
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
deleted file mode 100644
index 764a6c6..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmSingletonImpl.java
+++ /dev/null
@@ -1,36 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.provider.Singleton;
-
-public class EdmSingletonImpl extends AbstractEdmBindingTarget implements EdmSingleton {
-
- public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final Singleton singleton) {
- super(edm, container, singleton);
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.Singleton;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
deleted file mode 100644
index f500ec2..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTermImpl.java
+++ /dev/null
@@ -1,148 +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.provider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang3.ClassUtils;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.Term;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
-
- private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
- private final Term term;
- private final FullQualifiedName fqn;
- private final EdmTypeInfo typeInfo;
- private EdmType termType;
- private EdmTerm baseTerm;
- private List<Class<?>> appliesTo;
-
- public EdmTermImpl(final Edm edm, final String namespace, final Term term) {
- super(edm, term.getName(), term);
-
- this.term = term;
- this.fqn = new FullQualifiedName(namespace, term.getName());
- this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
- }
-
- @Override
- public FullQualifiedName getFullQualifiedName() {
- return fqn;
- }
-
- @Override
- public EdmType getType() {
- if (termType == null) {
- termType = typeInfo.isPrimitiveType()
- ? EdmPrimitiveTypeFactory.getInstance(typeInfo.getPrimitiveTypeKind())
- : typeInfo.isTypeDefinition()
- ? typeInfo.getTypeDefinition()
- : typeInfo.isEnumType()
- ? typeInfo.getEnumType()
- : typeInfo.isComplexType()
- ? typeInfo.getComplexType()
- : null;
- if (termType == null) {
- throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
- }
- }
-
- return termType;
- }
-
- @Override
- public EdmTerm getBaseTerm() {
- if (baseTerm == null && term.getBaseTerm() != null) {
- baseTerm = edm.getTerm(new FullQualifiedName(term.getBaseTerm()));
- }
- return baseTerm;
- }
-
- @Override
- public List<Class<?>> getAppliesTo() {
- if (appliesTo == null) {
- final List<Class<?>> appliesToLocal = new ArrayList<Class<?>>();
- for (String element : term.getAppliesTo()) {
- try {
- appliesToLocal.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element));
- } catch (ClassNotFoundException e) {
- LOG.error("Could not load Edm class for {}", element, e);
- }
- }
-
- appliesTo = appliesToLocal;
- }
- return appliesTo;
- }
-
- @Override
- public Boolean isNullable() {
- return term.isNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return term.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return term.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return term.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return term.getSrid();
- }
-
- @Override
- public String getDefaultValue() {
- return term.getDefaultValue();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.Term;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return getFullQualifiedName();
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
deleted file mode 100644
index 9c6155f..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java
+++ /dev/null
@@ -1,163 +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.provider;
-
-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.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class EdmTypeDefinitionImpl extends AbstractEdmNamed implements EdmTypeDefinition {
-
- private TypeDefinition typeDefinition;
- private FullQualifiedName typeDefinitionName;
- private EdmPrimitiveType edmPrimitiveTypeInstance;
-
- public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
- super(edm, typeDefinitionName.getName(), typeDefinition);
- this.typeDefinitionName = typeDefinitionName;
- this.typeDefinition = typeDefinition;
- }
-
- @Override
- public FullQualifiedName getFullQualifiedName() {
- return typeDefinitionName;
- }
-
- @Override
- public String getNamespace() {
- return typeDefinitionName.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return EdmTypeKind.DEFINITION;
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- if(edmPrimitiveTypeInstance == null){
- try {
- if (typeDefinition.getUnderlyingType() == null) {
- throw new EdmException("Underlying Type for type definition: "
- + typeDefinitionName.getFullQualifiedNameAsString() + " must not be null.");
- }
- this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance(
- EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType()));
- } catch (IllegalArgumentException e) {
- throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
- }
- }
- return edmPrimitiveTypeInstance;
- }
-
- @Override
- public Integer getMaxLength() {
- return typeDefinition.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return typeDefinition.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return typeDefinition.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return typeDefinition.getSrid();
- }
-
- @Override
- public Boolean isUnicode() {
- return typeDefinition.isUnicode();
- }
-
- @Override
- public boolean isCompatible(final EdmPrimitiveType primitiveType) {
- return getUnderlyingType().isCompatible(primitiveType);
- }
-
- @Override
- public Class<?> getDefaultType() {
- return getUnderlyingType().getDefaultType();
- }
-
- @Override
- public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) {
-
- return getUnderlyingType().validate(value, isNullable, maxLength, precision, scale, isUnicode);
- }
-
- @Override
- public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
-
- return getUnderlyingType().
- valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, returnType);
- }
-
- @Override
- public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale,
- final Boolean isUnicode) throws EdmPrimitiveTypeException {
-
- return getUnderlyingType().valueToString(value, isNullable, maxLength, precision, scale, isUnicode);
- }
-
- @Override
- public String toUriLiteral(final String literal) {
- return getUnderlyingType().toUriLiteral(literal);
- }
-
- @Override
- public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
- return getUnderlyingType().fromUriLiteral(literal);
- }
-
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.TypeDefinition;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return getFullQualifiedName();
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return getName();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.java
deleted file mode 100644
index ff3cd65..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeImpl.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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.Annotatable;
-
-public class EdmTypeImpl extends AbstractEdmNamed implements EdmType {
-
- protected final FullQualifiedName typeName;
- protected final EdmTypeKind kind;
-
- public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind,
- final Annotatable annotatable) {
- super(edm, typeName.getName(), annotatable);
- this.typeName = typeName;
- this.kind = kind;
- }
-
- @Override
- public FullQualifiedName getFullQualifiedName() {
- return typeName;
- }
-
- @Override
- public String getNamespace() {
- return typeName.getNamespace();
- }
-
- @Override
- public EdmTypeKind getKind() {
- return kind;
- }
-}
[04/11] olingo-odata4 git commit: [OLINGO-564] Removed 'provider'
package level
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
new file mode 100644
index 0000000..e6fefca
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
@@ -0,0 +1,146 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+import org.apache.olingo.commons.api.edm.provider.PropertyRef;
+
+public class EdmEntityTypeImpl extends AbstractEdmStructuredType implements EdmEntityType {
+
+ private EntityType entityType;
+ private boolean baseTypeChecked = false;
+ private final boolean hasStream;
+ protected EdmEntityType entityBaseType;
+ private final List<String> keyPredicateNames = Collections.synchronizedList(new ArrayList<String>());
+ private final Map<String, EdmKeyPropertyRef> keyPropertyRefs =
+ Collections.synchronizedMap(new LinkedHashMap<String, EdmKeyPropertyRef>());
+ private List<EdmKeyPropertyRef> keyPropertyRefsList;
+
+ public EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
+ super(edm, name, EdmTypeKind.ENTITY, entityType);
+ this.entityType = entityType;
+ hasStream = entityType.hasStream();
+ }
+
+ @Override
+ protected void checkBaseType() {
+ if (!baseTypeChecked) {
+ if (baseTypeName != null) {
+ baseType = buildBaseType(baseTypeName);
+ entityBaseType = (EdmEntityType) baseType;
+ }
+ if (baseType == null
+ || (baseType.isAbstract() && ((EdmEntityType) baseType).getKeyPropertyRefs().size() == 0)) {
+ final List<PropertyRef> key = entityType.getKey();
+ if (key != null) {
+ final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
+ for (PropertyRef ref : key) {
+ edmKey.add(new EdmKeyPropertyRefImpl(this, ref));
+ }
+ setEdmKeyPropertyRef(edmKey);
+ }
+ }
+ baseTypeChecked = true;
+ }
+ }
+
+ protected void setEdmKeyPropertyRef(final List<EdmKeyPropertyRef> edmKey) {
+ for (EdmKeyPropertyRef ref : edmKey) {
+ if (ref.getAlias() == null) {
+ keyPredicateNames.add(ref.getName());
+ keyPropertyRefs.put(ref.getName(), ref);
+ } else {
+ keyPredicateNames.add(ref.getAlias());
+ keyPropertyRefs.put(ref.getAlias(), ref);
+ }
+ }
+ }
+
+ @Override
+ protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
+ EdmEntityType baseType = null;
+ if (baseTypeName != null) {
+ baseType = edm.getEntityType(baseTypeName);
+ if (baseType == null) {
+ throw new EdmException("Cannot find base type with name: " + baseTypeName + " for entity type: " + getName());
+ }
+ }
+ return baseType;
+ }
+
+ @Override
+ public EdmEntityType getBaseType() {
+ checkBaseType();
+ return entityBaseType;
+ }
+
+ @Override
+ public List<String> getKeyPredicateNames() {
+ checkBaseType();
+ if (keyPredicateNames.isEmpty() && baseType != null) {
+ return entityBaseType.getKeyPredicateNames();
+ }
+ return Collections.unmodifiableList(keyPredicateNames);
+ }
+
+ @Override
+ public List<EdmKeyPropertyRef> getKeyPropertyRefs() {
+ checkBaseType();
+ if (keyPropertyRefsList == null) {
+ keyPropertyRefsList = new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
+ }
+ if (keyPropertyRefsList.isEmpty() && entityBaseType != null) {
+ return entityBaseType.getKeyPropertyRefs();
+ }
+ return Collections.unmodifiableList(keyPropertyRefsList);
+ }
+
+ @Override
+ public EdmKeyPropertyRef getKeyPropertyRef(final String keyPredicateName) {
+ checkBaseType();
+ final EdmKeyPropertyRef edmKeyPropertyRef = keyPropertyRefs.get(keyPredicateName);
+ if (edmKeyPropertyRef == null && entityBaseType != null) {
+ return entityBaseType.getKeyPropertyRef(keyPredicateName);
+ }
+ return edmKeyPropertyRef;
+ }
+
+ @Override
+ public boolean hasStream() {
+ return hasStream;
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.EntityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java
new file mode 100644
index 0000000..95866fd
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEnumTypeImpl.java
@@ -0,0 +1,268 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmMember;
+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.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.EnumMember;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class EdmEnumTypeImpl extends EdmTypeImpl implements EdmEnumType {
+
+ private static final Set<EdmPrimitiveTypeKind> VALID_UNDERLYING_TYPES = new HashSet<EdmPrimitiveTypeKind>();
+ static {
+ VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Byte);
+ VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.SByte);
+ VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int16);
+ VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int32);
+ VALID_UNDERLYING_TYPES.add(EdmPrimitiveTypeKind.Int64);
+ }
+
+ private final EdmPrimitiveType underlyingType;
+ private final EnumType enumType;
+ private final String uriPrefix;
+ private final String uriSuffix;
+ private List<String> memberNames;
+ private LinkedHashMap<String, EdmMember> membersMap;
+
+ public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) {
+ super(edm, enumName, EdmTypeKind.ENUM, enumType);
+
+ if (enumType.getUnderlyingType() == null) {
+ underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
+ } else {
+ EdmPrimitiveTypeKind underlyingTypeKind = EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType());
+
+ if (!VALID_UNDERLYING_TYPES.contains(underlyingTypeKind)) {
+ throw new EdmException("Not allowed as underlying type: " + underlyingTypeKind);
+ }
+ underlyingType = EdmPrimitiveTypeFactory.getInstance(underlyingTypeKind);
+ }
+
+ this.enumType = enumType;
+ this.uriPrefix = enumName.getFullQualifiedNameAsString() + '\'';
+ this.uriSuffix = "'";
+ }
+
+ @Override
+ public EdmPrimitiveType getUnderlyingType() {
+ return underlyingType;
+ }
+
+ @Override
+ public EdmMember getMember(final String name) {
+ if (membersMap == null) {
+ createEdmMembers();
+ }
+ return membersMap.get(name);
+ }
+
+ @Override
+ public List<String> getMemberNames() {
+ if (memberNames == null) {
+ createEdmMembers();
+ }
+ return Collections.unmodifiableList(memberNames);
+ }
+
+ private void createEdmMembers() {
+ final LinkedHashMap<String, EdmMember> membersMapLocal = new LinkedHashMap<String, EdmMember>();
+ final List<String> memberNamesLocal = new ArrayList<String>();
+ if (enumType.getMembers() != null) {
+ for (final EnumMember member : enumType.getMembers()) {
+ membersMapLocal.put(member.getName(), new EdmMemberImpl(edm, getFullQualifiedName(), member));
+ memberNamesLocal.add(member.getName());
+ }
+
+ membersMap = membersMapLocal;
+ memberNames = memberNamesLocal;
+ }
+ }
+
+ @Override
+ public boolean isCompatible(final EdmPrimitiveType primitiveType) {
+ return equals(primitiveType);
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return getUnderlyingType().getDefaultType();
+ }
+
+ @Override
+ public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) {
+
+ try {
+ valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, getDefaultType());
+ return true;
+ } catch (final EdmPrimitiveTypeException e) {
+ return false;
+ }
+ }
+
+ private Long parseEnumValue(final String value) throws EdmPrimitiveTypeException {
+ Long result = null;
+ for (final String memberValue : value.split(",", isFlags() ? -1 : 1)) {
+ Long memberValueLong = null;
+ for (final EdmMember member : getMembers()) {
+ if (member.getName().equals(memberValue) || member.getValue().equals(memberValue)) {
+ memberValueLong = Long.decode(member.getValue());
+ }
+ }
+ if (memberValueLong == null) {
+ throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content.");
+ }
+ result = result == null ? memberValueLong : result | memberValueLong;
+ }
+ return result;
+ }
+
+ @Override
+ public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
+ throws EdmPrimitiveTypeException {
+
+ if (value == null) {
+ if (isNullable != null && !isNullable) {
+ throw new EdmPrimitiveTypeException("The literal 'null' is not allowed.");
+ }
+ return null;
+ }
+
+ try {
+ return EdmInt64.convertNumber(parseEnumValue(value), returnType);
+ } catch (final IllegalArgumentException e) {
+ throw new EdmPrimitiveTypeException("The literal '" + value
+ + "' cannot be converted to value type " + returnType + ".", e);
+ } catch (final ClassCastException e) {
+ throw new EdmPrimitiveTypeException("The value type " + returnType + " is not supported.", e);
+ }
+ }
+
+ private String constructEnumValue(final long value)
+ throws EdmPrimitiveTypeException {
+ long remaining = value;
+ final StringBuilder result = new StringBuilder();
+
+ final boolean flags = isFlags();
+ for (final EdmMember member : getMembers()) {
+ final long memberValue = Long.parseLong(member.getValue());
+ if (flags) {
+ if ((memberValue & remaining) == memberValue) {
+ if (result.length() > 0) {
+ result.append(',');
+ }
+ result.append(member.getName());
+ remaining ^= memberValue;
+ }
+ } else {
+ if (value == memberValue) {
+ return member.getName();
+ }
+ }
+ }
+
+ if (remaining != 0) {
+ throw new EdmPrimitiveTypeException("The value '" + value + "' is not valid.");
+ }
+ return result.toString();
+ }
+
+ private Collection<EdmMember> getMembers() {
+ if(membersMap == null){
+ createEdmMembers();
+ }
+ return membersMap.values();
+ }
+
+ @Override
+ public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value == null) {
+ if (isNullable != null && !isNullable) {
+ throw new EdmPrimitiveTypeException("The value NULL is not allowed.");
+ }
+ return null;
+ }
+ if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long) {
+ return constructEnumValue(((Number) value).longValue());
+ } else {
+ throw new EdmPrimitiveTypeException("The value type " + value.getClass() + " is not supported.");
+ }
+ }
+
+ @Override
+ public String toUriLiteral(final String literal) {
+ return literal == null ? null
+ : uriPrefix.isEmpty() && uriSuffix.isEmpty() ? literal : uriPrefix + literal + uriSuffix;
+ }
+
+ @Override
+ public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
+ if (literal == null) {
+ return null;
+ } else if (uriPrefix.isEmpty() && uriSuffix.isEmpty()) {
+ return literal;
+ } else if (literal.length() >= uriPrefix.length() + uriSuffix.length()
+ && literal.startsWith(uriPrefix) && literal.endsWith(uriSuffix)) {
+ return literal.substring(uriPrefix.length(), literal.length() - uriSuffix.length());
+ } else {
+ throw new EdmPrimitiveTypeException("The literal '" + literal + "' has illegal content.");
+ }
+ }
+
+ @Override
+ public boolean isFlags() {
+ return enumType.isFlags();
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.EnumType;
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return null;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return getFullQualifiedName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImpl.java
new file mode 100644
index 0000000..01d20ea
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImpl.java
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Function;
+
+public class EdmFunctionImpl extends AbstractEdmOperation implements EdmFunction {
+
+ private final Function function;
+
+ public EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
+ super(edm, name, function, EdmTypeKind.FUNCTION);
+ this.function = function;
+ }
+
+ @Override
+ public boolean isComposable() {
+ return function.isComposable();
+ }
+
+ @Override
+ public EdmReturnType getReturnType() {
+ final EdmReturnType returnType = super.getReturnType();
+ if (returnType == null) {
+ throw new EdmException("ReturnType for a function must not be null");
+ }
+ return returnType;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImportImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImportImpl.java
new file mode 100644
index 0000000..ea9037d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmFunctionImportImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm;
+
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.FunctionImport;
+
+public class EdmFunctionImportImpl extends AbstractEdmOperationImport implements EdmFunctionImport {
+
+ private final FunctionImport functionImport;
+
+ public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final FunctionImport functionImport) {
+ super(edm, container, functionImport);
+ this.functionImport = functionImport;
+ }
+
+ @Override
+ public FullQualifiedName getFunctionFqn() {
+ return functionImport.getFunctionFQN();
+ }
+
+ @Override
+ public EdmFunction getUnboundFunction(final List<String> parameterNames) {
+ return edm.getUnboundFunction(getFunctionFqn(), parameterNames);
+ }
+
+ @Override
+ public List<EdmFunction> getUnboundFunctions() {
+ return edm.getUnboundFunctions(getFunctionFqn());
+ }
+
+ @Override
+ public boolean isIncludeInServiceDocument() {
+ return functionImport.isIncludeInServiceDocument();
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.FunctionImport;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmKeyPropertyRefImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmKeyPropertyRefImpl.java
new file mode 100644
index 0000000..0f69deb
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmKeyPropertyRefImpl.java
@@ -0,0 +1,83 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.provider.PropertyRef;
+
+public class EdmKeyPropertyRefImpl implements EdmKeyPropertyRef {
+
+ private final PropertyRef ref;
+ private EdmEntityType edmEntityType;
+ private EdmProperty property;
+
+ public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef ref) {
+ this.edmEntityType = edmEntityType;
+ this.ref = ref;
+ }
+
+ @Override
+ public String getName() {
+ return ref.getName();
+ }
+
+ @Override
+ public String getAlias() {
+ return ref.getAlias();
+ }
+
+ @Override
+ public EdmProperty getProperty() {
+ if (property == null) {
+ if (getAlias() == null) {
+ property = edmEntityType.getStructuralProperty(getName());
+ if (property == null) {
+ throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
+ + getName());
+ }
+ } else {
+ if (getName() == null || getName().isEmpty()) {
+ throw new EdmException("Alias but no path specified for propertyRef");
+ }
+ final String[] splitPath = getName().split("/");
+ EdmStructuredType structType = edmEntityType;
+ for (int i = 0; i < splitPath.length - 1; i++) {
+ final EdmProperty _property = structType.getStructuralProperty(splitPath[i]);
+ if (_property == null) {
+ throw new EdmException("Invalid property ref specified. Can´t find property with name: " + splitPath[i]
+ + " at type: " + structType.getNamespace() + "." + structType.getName());
+ }
+ structType = (EdmStructuredType) _property.getType();
+ }
+ property = structType.getStructuralProperty(splitPath[splitPath.length - 1]);
+ if (property == null) {
+ throw new EdmException("Invalid property ref specified. Can´t find property with name: "
+ + splitPath[splitPath.length - 1] + " at type: " + structType.getNamespace() + "."
+ + structType.getName());
+ }
+ }
+ }
+
+ return property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmMemberImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmMemberImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmMemberImpl.java
new file mode 100644
index 0000000..362dd72
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmMemberImpl.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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmMember;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.EnumMember;
+
+public class EdmMemberImpl extends AbstractEdmNamed implements EdmMember {
+
+ private final FullQualifiedName enumFQN;
+ private final EnumMember member;
+
+ public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final EnumMember member) {
+ super(edm, member.getName(), member);
+ this.enumFQN = enumFQN;
+ this.member = member;
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.Member;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return enumFQN;
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return getName();
+ }
+
+ @Override
+ public String getValue() {
+ return member.getValue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java
new file mode 100644
index 0000000..5815a6c
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+
+public class EdmNavigationPropertyBindingImpl implements EdmNavigationPropertyBinding {
+
+ private final String path;
+ private final String target;
+
+ public EdmNavigationPropertyBindingImpl(final String path, final String target) {
+ this.path = path;
+ this.target = target;
+ }
+
+ @Override
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public String getTarget() {
+ return target;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyImpl.java
new file mode 100644
index 0000000..71f0a57
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyImpl.java
@@ -0,0 +1,142 @@
+/*
+ * 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;
+
+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.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
+
+public class EdmNavigationPropertyImpl extends AbstractEdmNamed implements EdmElement, EdmNavigationProperty {
+
+ private final FullQualifiedName structuredTypeName;
+ private final NavigationProperty navigationProperty;
+ private List<EdmReferentialConstraint> referentialConstraints;
+ private EdmEntityType typeImpl;
+ private EdmNavigationProperty partnerNavigationProperty;
+
+ public EdmNavigationPropertyImpl(
+ final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
+ super(edm, navigationProperty.getName(), navigationProperty);
+ this.structuredTypeName = structuredTypeName;
+ this.navigationProperty = navigationProperty;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return navigationProperty.isCollection();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return navigationProperty.isNullable();
+ }
+
+ @Override
+ public boolean containsTarget() {
+ return navigationProperty.isContainsTarget();
+ }
+
+ @Override
+ public EdmEntityType getType() {
+ if (typeImpl == null) {
+ typeImpl = edm.getEntityType(navigationProperty.getTypeFQN());
+ if (typeImpl == null) {
+ throw new EdmException("Cannot find type with name: " + navigationProperty.getTypeFQN());
+ }
+ }
+ return typeImpl;
+ }
+
+ @Override
+ public EdmNavigationProperty getPartner() {
+ if (partnerNavigationProperty == null) {
+ String partner = navigationProperty.getPartner();
+ if (partner != null) {
+ EdmStructuredType type = getType();
+ EdmNavigationProperty property = null;
+ final String[] split = partner.split("/");
+ for (String element : split) {
+ property = type.getNavigationProperty(element);
+ if (property == null) {
+ throw new EdmException("Cannot find navigation property with name: " + element
+ + " at type " + type.getName());
+ }
+ type = property.getType();
+ }
+ partnerNavigationProperty = property;
+ }
+ }
+ return partnerNavigationProperty;
+ }
+
+ @Override
+ public String getReferencingPropertyName(final String referencedPropertyName) {
+ final List<ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
+ if (referentialConstraints != null) {
+ for (ReferentialConstraint constraint : referentialConstraints) {
+ if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
+ return constraint.getProperty();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public List<EdmReferentialConstraint> getReferentialConstraints() {
+ if (referentialConstraints == null) {
+ final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints();
+ final List<EdmReferentialConstraint> referentialConstraintsLocal = new ArrayList<EdmReferentialConstraint>();
+ if (providerConstraints != null) {
+ for (ReferentialConstraint constraint : providerConstraints) {
+ referentialConstraintsLocal.add(new EdmReferentialConstraintImpl(edm, constraint));
+ }
+ }
+
+ referentialConstraints = referentialConstraintsLocal;
+ }
+ return Collections.unmodifiableList(referentialConstraints);
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.NavigationProperty;
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return getName();
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return structuredTypeName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmParameterImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmParameterImpl.java
new file mode 100644
index 0000000..e32bc6f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmParameterImpl.java
@@ -0,0 +1,88 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmMapping;
+import org.apache.olingo.commons.api.edm.EdmParameter;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+
+public class EdmParameterImpl extends AbstractEdmNamed implements EdmParameter, EdmElement {
+
+ private final Parameter parameter;
+ private final EdmTypeInfo typeInfo;
+ private EdmType typeImpl;
+
+ public EdmParameterImpl(final Edm edm, final Parameter parameter) {
+ super(edm, parameter.getName(), parameter);
+ this.parameter = parameter;
+ this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(parameter.getType()).build();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return parameter.isCollection();
+ }
+
+ @Override
+ public EdmMapping getMapping() {
+ return parameter.getMapping();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return parameter.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return parameter.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return parameter.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return parameter.getScale();
+ }
+
+ @Override
+ public SRID getSrid() {
+ return parameter.getSrid();
+ }
+
+ @Override
+ public EdmType getType() {
+ if (typeImpl == null) {
+ typeImpl = typeInfo.getType();
+ if (typeImpl == null) {
+ throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
+ }
+ }
+
+ return typeImpl;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmPropertyImpl.java
new file mode 100644
index 0000000..494744b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmPropertyImpl.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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmMapping;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Property;
+
+public class EdmPropertyImpl extends AbstractEdmNamed implements EdmProperty, EdmElement {
+
+ private final FullQualifiedName structuredTypeName;
+ private final Property property;
+ private final EdmTypeInfo typeInfo;
+ private EdmType propertyType;
+
+ public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) {
+ super(edm, property.getName(), property);
+
+ this.structuredTypeName = structuredTypeName;
+ this.property = property;
+ typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build();
+ }
+
+ @Override
+ public EdmType getType() {
+ if (propertyType == null) {
+ propertyType = typeInfo.getType();
+ if (propertyType == null) {
+ throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
+ }
+ }
+
+ return propertyType;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return property.isCollection();
+ }
+
+ @Override
+ public EdmMapping getMapping() {
+ return property.getMapping();
+ }
+
+ @Override
+ public String getMimeType() {
+ return property.getMimeType();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return property.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return property.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return property.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return property.getScale();
+ }
+
+ @Override
+ public SRID getSrid() {
+ return property.getSrid();
+ }
+
+ @Override
+ public boolean isUnicode() {
+ return property.isUnicode();
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return property.getDefaultValue();
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.Property;
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return getName();
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return structuredTypeName;
+ }
+
+ @Override
+ public boolean isPrimitive() {
+ return typeInfo.isPrimitiveType();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
new file mode 100644
index 0000000..62efd32
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
@@ -0,0 +1,377 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+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.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.Action;
+import org.apache.olingo.commons.api.edm.provider.AliasInfo;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.api.edm.provider.Annotations;
+import org.apache.olingo.commons.api.edm.provider.ComplexType;
+import org.apache.olingo.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+import org.apache.olingo.commons.api.edm.provider.Function;
+import org.apache.olingo.commons.api.edm.provider.Parameter;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+import org.apache.olingo.commons.api.edm.provider.Term;
+import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
+
+public class EdmProviderImpl extends AbstractEdm {
+
+ private final EdmProvider provider;
+ private final Map<FullQualifiedName, List<Action>> actionsMap =
+ Collections.synchronizedMap(new HashMap<FullQualifiedName, List<Action>>());
+ private final Map<FullQualifiedName, List<Function>> functionsMap =
+ Collections.synchronizedMap(new HashMap<FullQualifiedName, List<Function>>());
+
+ public EdmProviderImpl(final EdmProvider provider) {
+ this.provider = provider;
+ }
+
+ @Override
+ public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
+ try {
+ EntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
+ if (entityContainerInfo != null) {
+ return new EdmEntityContainerImpl(this, provider, entityContainerInfo);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ public EdmEnumType createEnumType(final FullQualifiedName enumName) {
+ try {
+ EnumType enumType = provider.getEnumType(enumName);
+ if (enumType != null) {
+ return new EdmEnumTypeImpl(this, enumName, enumType);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
+ try {
+ TypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
+ if (typeDefinition != null) {
+ return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
+ try {
+ EntityType entityType = provider.getEntityType(entityTypeName);
+ if (entityType != null) {
+ return new EdmEntityTypeImpl(this, entityTypeName, entityType);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
+ try {
+ final ComplexType complexType = provider.getComplexType(complexTypeName);
+ if (complexType != null) {
+ return new EdmComplexTypeImpl(this, complexTypeName, complexType);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ public EdmAction createBoundAction(final FullQualifiedName actionName,
+ final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
+
+ try {
+ List<Action> actions = actionsMap.get(actionName);
+ if (actions == null) {
+ actions = provider.getActions(actionName);
+ if (actions == null) {
+ return null;
+ } else {
+ actionsMap.put(actionName, actions);
+ }
+ }
+ // Search for bound action where binding parameter matches
+ for (Action action : actions) {
+ if (action.isBound()) {
+ final List<Parameter> parameters = action.getParameters();
+ final Parameter parameter = parameters.get(0);
+ if (bindingParameterTypeName.equals(parameter.getTypeFQN())
+ && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
+
+ return new EdmActionImpl(this, actionName, action);
+ }
+
+ }
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ public EdmFunction createBoundFunction(final FullQualifiedName functionName,
+ final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
+ final List<String> parameterNames) {
+
+ try {
+ List<Function> functions = functionsMap.get(functionName);
+ if (functions == null) {
+ functions = provider.getFunctions(functionName);
+ if (functions == null) {
+ return null;
+ } else {
+ functionsMap.put(functionName, functions);
+ }
+ }
+ final List<String> parameterNamesCopy =
+ parameterNames == null ? Collections.<String> emptyList() : parameterNames;
+ for (Function function : functions) {
+ if (function.isBound()) {
+ List<Parameter> providerParameters = function.getParameters();
+ if (providerParameters == null || providerParameters.size() == 0) {
+ throw new EdmException("No parameter specified for bound function: " + functionName);
+ }
+ final Parameter bindingParameter = providerParameters.get(0);
+ if (bindingParameterTypeName.equals(bindingParameter.getTypeFQN())
+ && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
+
+ if (parameterNamesCopy.size() == providerParameters.size() - 1) {
+ final List<String> providerParameterNames = new ArrayList<String>();
+ for (int i = 1; i < providerParameters.size(); i++) {
+ providerParameterNames.add(providerParameters.get(i).getName());
+ }
+ if (parameterNamesCopy.containsAll(providerParameterNames)) {
+ return new EdmFunctionImpl(this, functionName, function);
+ }
+ }
+ }
+ }
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ protected Map<String, String> createAliasToNamespaceInfo() {
+ final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
+ try {
+ final List<AliasInfo> aliasInfos = provider.getAliasInfos();
+ if (aliasInfos != null) {
+ for (AliasInfo info : aliasInfos) {
+ aliasToNamespaceInfos.put(info.getAlias(), info.getNamespace());
+ }
+ }
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ return aliasToNamespaceInfos;
+ }
+
+ @Override
+ protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
+ try {
+ List<Action> actions = actionsMap.get(actionName);
+ if (actions == null) {
+ actions = provider.getActions(actionName);
+ if (actions == null) {
+ return null;
+ } else {
+ actionsMap.put(actionName, actions);
+ }
+ }
+ // Search for first unbound action
+ for (Action action : actions) {
+ if (!action.isBound()) {
+ return new EdmActionImpl(this, actionName, action);
+ }
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) {
+ List<EdmFunction> result = new ArrayList<EdmFunction>();
+
+ try {
+ List<Function> functions = functionsMap.get(functionName);
+ if (functions == null) {
+ functions = provider.getFunctions(functionName);
+ if (functions != null) {
+ functionsMap.put(functionName, functions);
+ }
+ }
+ if (functions != null) {
+ for (Function function : functions) {
+ if (!function.isBound()) {
+ result.add(new EdmFunctionImpl(this, functionName, function));
+ }
+ }
+ }
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
+ try {
+ List<Function> functions = functionsMap.get(functionName);
+ if (functions == null) {
+ functions = provider.getFunctions(functionName);
+ if (functions == null) {
+ return null;
+ } else {
+ functionsMap.put(functionName, functions);
+ }
+ }
+
+ final List<String> parameterNamesCopy =
+ parameterNames == null ? Collections.<String> emptyList() : parameterNames;
+ for (Function function : functions) {
+ if (!function.isBound()) {
+ List<Parameter> providerParameters = function.getParameters();
+ if (providerParameters == null) {
+ providerParameters = Collections.emptyList();
+ }
+ if (parameterNamesCopy.size() == providerParameters.size()) {
+ final List<String> functionParameterNames = new ArrayList<String>();
+ for (Parameter parameter : providerParameters) {
+ functionParameterNames.add(parameter.getName());
+ }
+
+ if (parameterNamesCopy.containsAll(functionParameterNames)) {
+ return new EdmFunctionImpl(this, functionName, function);
+ }
+ }
+ }
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ protected Map<String, EdmSchema> createSchemas() {
+ try {
+ final Map<String, EdmSchema> providerSchemas = new LinkedHashMap<String, EdmSchema>();
+ for (Schema schema : provider.getSchemas()) {
+ providerSchemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
+ }
+ return providerSchemas;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ protected EdmTerm createTerm(final FullQualifiedName termName) {
+ try {
+ Term providerTerm = provider.getTerm(termName);
+ if (providerTerm != null) {
+ return new EdmTermImpl(this, termName.getNamespace(), providerTerm);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ //TODO: Check Provider annotations implementation
+ @Override
+ protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) {
+ try {
+ EdmSchema schema = getSchema(targetName.getNamespace());
+ Annotations providerGroup = provider.getAnnotationsGroup(targetName);
+ if (providerGroup != null) {
+ return new EdmAnnotationsImpl(this, schema, providerGroup);
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+
+ @Override
+ protected List<EdmAnnotation> createAnnotations(final FullQualifiedName annotatedName) {
+ try {
+ Annotatable providerAnnotatable = provider.getAnnoatatable(annotatedName);
+ if (providerAnnotatable != null && providerAnnotatable.getAnnotations() != null) {
+ List<EdmAnnotation> result = new ArrayList<EdmAnnotation>();
+ for(Annotation annotation : providerAnnotatable.getAnnotations()){
+ //Load Term
+ getTerm(new FullQualifiedName(annotation.getTerm()));
+ result.add(new EdmAnnotationImpl(this, annotation));
+ }
+ return result;
+ }
+ return null;
+ } catch (ODataException e) {
+ throw new EdmException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java
new file mode 100644
index 0000000..e0e8f85
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
+import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint;
+
+public class EdmReferentialConstraintImpl extends AbstractEdmAnnotatable implements EdmReferentialConstraint {
+
+ private final ReferentialConstraint constraint;
+
+ public EdmReferentialConstraintImpl(final Edm edm, final ReferentialConstraint constraint) {
+ super(edm, constraint);
+ this.constraint = constraint;
+ }
+
+ @Override
+ public String getPropertyName() {
+ return constraint.getProperty();
+ }
+
+ @Override
+ public String getReferencedPropertyName() {
+ return constraint.getReferencedProperty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReturnTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReturnTypeImpl.java
new file mode 100644
index 0000000..04f6f90
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReturnTypeImpl.java
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmReturnType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.ReturnType;
+
+public class EdmReturnTypeImpl implements EdmReturnType {
+
+ private final ReturnType returnType;
+ private final EdmTypeInfo typeInfo;
+ private EdmType typeImpl;
+
+ public EdmReturnTypeImpl(final Edm edm, final ReturnType returnType) {
+ this.returnType = returnType;
+ this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(returnType.getType()).build();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return returnType.isCollection();
+ }
+
+ @Override
+ public boolean isNullable() {
+ return returnType.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return returnType.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return returnType.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return returnType.getScale();
+ }
+
+ @Override
+ public SRID getSrid() {
+ return returnType.getSrid();
+ }
+
+ @Override
+ public EdmType getType() {
+ if (typeImpl == null) {
+ typeImpl = typeInfo.getType();
+ if (typeImpl == null) {
+ throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
+ }
+ }
+
+ return typeImpl;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java
new file mode 100644
index 0000000..5521b92
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java
@@ -0,0 +1,304 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmAnnotation;
+import org.apache.olingo.commons.api.edm.EdmAnnotations;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.Action;
+import org.apache.olingo.commons.api.edm.provider.Annotation;
+import org.apache.olingo.commons.api.edm.provider.Annotations;
+import org.apache.olingo.commons.api.edm.provider.ComplexType;
+import org.apache.olingo.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.commons.api.edm.provider.EntityType;
+import org.apache.olingo.commons.api.edm.provider.EnumType;
+import org.apache.olingo.commons.api.edm.provider.Function;
+import org.apache.olingo.commons.api.edm.provider.Schema;
+import org.apache.olingo.commons.api.edm.provider.Term;
+import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
+
+public class EdmSchemaImpl implements EdmSchema {
+
+ private final Schema schema;
+ private final EdmProviderImpl edm;
+ private final EdmProvider provider;
+
+ protected final String namespace;
+ private final String alias;
+ private List<EdmEnumType> enumTypes;
+ private List<EdmEntityType> entityTypes;
+ private List<EdmComplexType> complexTypes;
+ private List<EdmAction> actions;
+ private List<EdmFunction> functions;
+ private List<EdmTypeDefinition> typeDefinitions;
+ private List<EdmTerm> terms;
+ private List<EdmAnnotations> annotationGroups;
+ private List<EdmAnnotation> annotations;
+ private EdmEntityContainer entityContainer;
+
+ public EdmSchemaImpl(final EdmProviderImpl edm, final EdmProvider provider, final Schema schema) {
+ this.edm = edm;
+ this.provider = provider;
+ this.schema = schema;
+ this.namespace = schema.getNamespace();
+ this.alias = schema.getAlias();
+
+ if (alias != null) {
+ edm.cacheAliasNamespaceInfo(alias, namespace);
+ }
+
+ enumTypes = createEnumTypes();
+ typeDefinitions = createTypeDefinitions();
+ entityTypes = createEntityTypes();
+ complexTypes = createComplexTypes();
+ actions = createActions();
+ functions = createFunctions();
+ entityContainer = createEntityContainer();
+ annotationGroups = createAnnotationGroups();
+ annotations = createAnnotations();
+ terms = createTerms();
+ }
+
+ @Override
+ public List<EdmEnumType> getEnumTypes() {
+ return Collections.unmodifiableList(enumTypes);
+ }
+
+ @Override
+ public List<EdmEntityType> getEntityTypes() {
+ return Collections.unmodifiableList(entityTypes);
+ }
+
+ @Override
+ public List<EdmComplexType> getComplexTypes() {
+ return Collections.unmodifiableList(complexTypes);
+ }
+
+ @Override
+ public List<EdmAction> getActions() {
+ return Collections.unmodifiableList(actions);
+ }
+
+ @Override
+ public List<EdmFunction> getFunctions() {
+ return Collections.unmodifiableList(functions);
+ }
+
+ @Override
+ public List<EdmTypeDefinition> getTypeDefinitions() {
+ return Collections.unmodifiableList(typeDefinitions);
+ }
+
+ @Override
+ public List<EdmTerm> getTerms() {
+ return Collections.unmodifiableList(terms);
+ }
+
+ @Override
+ public List<EdmAnnotations> getAnnotationGroups() {
+ return Collections.unmodifiableList(annotationGroups);
+ }
+
+ @Override
+ public List<EdmAnnotation> getAnnotations() {
+ return Collections.unmodifiableList(annotations);
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return entityContainer;
+ }
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+
+ protected EdmEntityContainer createEntityContainer() {
+ if (schema.getEntityContainer() != null) {
+ FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName());
+ EdmEntityContainer impl = new EdmEntityContainerImpl(edm, provider, containerFQN, schema.getEntityContainer());
+ edm.cacheEntityContainer(containerFQN, impl);
+ edm.cacheEntityContainer(null, impl);
+ return impl;
+ }
+ return null;
+ }
+
+ protected List<EdmTypeDefinition> createTypeDefinitions() {
+ final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
+ final List<TypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
+ if (providerTypeDefinitions != null) {
+ for (TypeDefinition def : providerTypeDefinitions) {
+ FullQualifiedName typeDefName = new FullQualifiedName(namespace, def.getName());
+ EdmTypeDefinitionImpl typeDefImpl = new EdmTypeDefinitionImpl(edm, typeDefName, def);
+ typeDefinitions.add(typeDefImpl);
+ edm.cacheTypeDefinition(typeDefName, typeDefImpl);
+ }
+ }
+ return typeDefinitions;
+ }
+
+ protected List<EdmEnumType> createEnumTypes() {
+ final List<EdmEnumType> enumTypes = new ArrayList<EdmEnumType>();
+ final List<EnumType> providerEnumTypes = schema.getEnumTypes();
+ if (providerEnumTypes != null) {
+ for (EnumType enumType : providerEnumTypes) {
+ FullQualifiedName enumName = new FullQualifiedName(namespace, enumType.getName());
+ EdmEnumType enumTypeImpl = new EdmEnumTypeImpl(edm, enumName, enumType);
+ enumTypes.add(enumTypeImpl);
+ edm.cacheEnumType(enumName, enumTypeImpl);
+ }
+ }
+ return enumTypes;
+ }
+
+ protected List<EdmEntityType> createEntityTypes() {
+ final List<EdmEntityType> entityTypes = new ArrayList<EdmEntityType>();
+ final List<EntityType> providerEntityTypes = schema.getEntityTypes();
+ if (providerEntityTypes != null) {
+ for (EntityType entityType : providerEntityTypes) {
+ FullQualifiedName entityTypeName = new FullQualifiedName(namespace, entityType.getName());
+ EdmEntityTypeImpl entityTypeImpl = new EdmEntityTypeImpl(edm, entityTypeName, entityType);
+ entityTypes.add(entityTypeImpl);
+ edm.cacheEntityType(entityTypeName, entityTypeImpl);
+ }
+ }
+ return entityTypes;
+ }
+
+ protected List<EdmComplexType> createComplexTypes() {
+ final List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>();
+ final List<ComplexType> providerComplexTypes = schema.getComplexTypes();
+ if (providerComplexTypes != null) {
+ for (ComplexType complexType : providerComplexTypes) {
+ FullQualifiedName comlexTypeName = new FullQualifiedName(namespace, complexType.getName());
+ EdmComplexTypeImpl complexTypeImpl = new EdmComplexTypeImpl(edm, comlexTypeName, complexType);
+ complexTypes.add(complexTypeImpl);
+ edm.cacheComplexType(comlexTypeName, complexTypeImpl);
+ }
+ }
+ return complexTypes;
+ }
+
+ protected List<EdmAction> createActions() {
+ final List<EdmAction> actions = new ArrayList<EdmAction>();
+ final List<Action> providerActions = schema.getActions();
+ if (providerActions != null) {
+ for (Action action : providerActions) {
+ FullQualifiedName actionName = new FullQualifiedName(namespace, action.getName());
+ EdmActionImpl edmActionImpl = new EdmActionImpl(edm, actionName, action);
+ actions.add(edmActionImpl);
+ edm.cacheAction(actionName, edmActionImpl);
+ }
+ }
+ return actions;
+ }
+
+ protected List<EdmFunction> createFunctions() {
+ final List<EdmFunction> functions = new ArrayList<EdmFunction>();
+ final List<Function> providerFunctions = schema.getFunctions();
+ if (providerFunctions != null) {
+ for (Function function : providerFunctions) {
+ FullQualifiedName functionName = new FullQualifiedName(namespace, function.getName());
+ EdmFunctionImpl functionImpl = new EdmFunctionImpl(edm, functionName, function);
+ functions.add(functionImpl);
+ edm.cacheFunction(functionName, functionImpl);
+ }
+ }
+ return functions;
+ }
+
+ protected List<EdmTerm> createTerms() {
+ final List<EdmTerm> terms = new ArrayList<EdmTerm>();
+ final List<Term> providerTerms = schema.getTerms();
+ if (providerTerms != null) {
+ for (Term term : providerTerms) {
+ FullQualifiedName termName = new FullQualifiedName(namespace, term.getName());
+ EdmTermImpl termImpl = new EdmTermImpl(edm, getNamespace(), term);
+ terms.add(termImpl);
+ edm.cacheTerm(termName, termImpl);
+ }
+ }
+ return terms;
+ }
+
+ protected List<EdmAnnotations> createAnnotationGroups() {
+ final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
+ final List<Annotations> providerAnnotations =
+ schema.getAnnotationGroups();
+ if (providerAnnotations != null) {
+ for (Annotations annotationGroup : providerAnnotations) {
+ FullQualifiedName annotationsGroupName;
+ if (annotationGroup.getTarget().contains(".")) {
+ annotationsGroupName = new FullQualifiedName(annotationGroup.getTarget());
+ } else {
+ annotationsGroupName = new FullQualifiedName(namespace, annotationGroup.getTarget());
+ }
+ EdmAnnotationsImpl annotationsImpl = new EdmAnnotationsImpl(edm, this, annotationGroup);
+ annotationGroups.add(annotationsImpl);
+ edm.cacheAnnotationGroup(annotationsGroupName, annotationsImpl);
+ }
+ }
+ return annotationGroups;
+ }
+
+ protected List<EdmAnnotation> createAnnotations() {
+ final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
+ final List<Annotation> providerAnnotations =
+ schema.getAnnotations();
+ if (providerAnnotations != null) {
+ for (Annotation annotation : providerAnnotations) {
+ EdmAnnotationImpl annotationImpl = new EdmAnnotationImpl(edm, annotation);
+ annotations.add(annotationImpl);
+ }
+ }
+ return annotations;
+ }
+
+ @Override
+ public EdmAnnotation getAnnotation(final EdmTerm term) {
+ EdmAnnotation result = null;
+ for (EdmAnnotation annotation : getAnnotations()) {
+ if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
+ result = annotation;
+ }
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSingletonImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSingletonImpl.java
new file mode 100644
index 0000000..afb900f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSingletonImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.edm;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.provider.Singleton;
+
+public class EdmSingletonImpl extends AbstractEdmBindingTarget implements EdmSingleton {
+
+ public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final Singleton singleton) {
+ super(edm, container, singleton);
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.Singleton;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.java
new file mode 100644
index 0000000..8d72c83
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTermImpl.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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmTerm;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.Term;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
+
+ private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
+ private final Term term;
+ private final FullQualifiedName fqn;
+ private final EdmTypeInfo typeInfo;
+ private EdmType termType;
+ private EdmTerm baseTerm;
+ private List<Class<?>> appliesTo;
+
+ public EdmTermImpl(final Edm edm, final String namespace, final Term term) {
+ super(edm, term.getName(), term);
+
+ this.term = term;
+ this.fqn = new FullQualifiedName(namespace, term.getName());
+ this.typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(term.getType()).build();
+ }
+
+ @Override
+ public FullQualifiedName getFullQualifiedName() {
+ return fqn;
+ }
+
+ @Override
+ public EdmType getType() {
+ if (termType == null) {
+ termType = typeInfo.isPrimitiveType()
+ ? EdmPrimitiveTypeFactory.getInstance(typeInfo.getPrimitiveTypeKind())
+ : typeInfo.isTypeDefinition()
+ ? typeInfo.getTypeDefinition()
+ : typeInfo.isEnumType()
+ ? typeInfo.getEnumType()
+ : typeInfo.isComplexType()
+ ? typeInfo.getComplexType()
+ : null;
+ if (termType == null) {
+ throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName());
+ }
+ }
+
+ return termType;
+ }
+
+ @Override
+ public EdmTerm getBaseTerm() {
+ if (baseTerm == null && term.getBaseTerm() != null) {
+ baseTerm = edm.getTerm(new FullQualifiedName(term.getBaseTerm()));
+ }
+ return baseTerm;
+ }
+
+ @Override
+ public List<Class<?>> getAppliesTo() {
+ if (appliesTo == null) {
+ final List<Class<?>> appliesToLocal = new ArrayList<Class<?>>();
+ for (String element : term.getAppliesTo()) {
+ try {
+ appliesToLocal.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element));
+ } catch (ClassNotFoundException e) {
+ LOG.error("Could not load Edm class for {}", element, e);
+ }
+ }
+
+ appliesTo = appliesToLocal;
+ }
+ return appliesTo;
+ }
+
+ @Override
+ public Boolean isNullable() {
+ return term.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return term.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return term.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return term.getScale();
+ }
+
+ @Override
+ public SRID getSrid() {
+ return term.getSrid();
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return term.getDefaultValue();
+ }
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.Term;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return getFullQualifiedName();
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeDefinitionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeDefinitionImpl.java
new file mode 100644
index 0000000..b42f6c6
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeDefinitionImpl.java
@@ -0,0 +1,163 @@
+/*
+ * 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;
+
+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.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.geo.SRID;
+import org.apache.olingo.commons.api.edm.provider.TypeDefinition;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class EdmTypeDefinitionImpl extends AbstractEdmNamed implements EdmTypeDefinition {
+
+ private TypeDefinition typeDefinition;
+ private FullQualifiedName typeDefinitionName;
+ private EdmPrimitiveType edmPrimitiveTypeInstance;
+
+ public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
+ final TypeDefinition typeDefinition) {
+ super(edm, typeDefinitionName.getName(), typeDefinition);
+ this.typeDefinitionName = typeDefinitionName;
+ this.typeDefinition = typeDefinition;
+ }
+
+ @Override
+ public FullQualifiedName getFullQualifiedName() {
+ return typeDefinitionName;
+ }
+
+ @Override
+ public String getNamespace() {
+ return typeDefinitionName.getNamespace();
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return EdmTypeKind.DEFINITION;
+ }
+
+ @Override
+ public EdmPrimitiveType getUnderlyingType() {
+ if(edmPrimitiveTypeInstance == null){
+ try {
+ if (typeDefinition.getUnderlyingType() == null) {
+ throw new EdmException("Underlying Type for type definition: "
+ + typeDefinitionName.getFullQualifiedNameAsString() + " must not be null.");
+ }
+ this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance(
+ EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType()));
+ } catch (IllegalArgumentException e) {
+ throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
+ }
+ }
+ return edmPrimitiveTypeInstance;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return typeDefinition.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return typeDefinition.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return typeDefinition.getScale();
+ }
+
+ @Override
+ public SRID getSrid() {
+ return typeDefinition.getSrid();
+ }
+
+ @Override
+ public Boolean isUnicode() {
+ return typeDefinition.isUnicode();
+ }
+
+ @Override
+ public boolean isCompatible(final EdmPrimitiveType primitiveType) {
+ return getUnderlyingType().isCompatible(primitiveType);
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return getUnderlyingType().getDefaultType();
+ }
+
+ @Override
+ public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale,
+ final Boolean isUnicode) {
+
+ return getUnderlyingType().validate(value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ @Override
+ public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale,
+ final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ return getUnderlyingType().
+ valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, returnType);
+ }
+
+ @Override
+ public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale,
+ final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ return getUnderlyingType().valueToString(value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ @Override
+ public String toUriLiteral(final String literal) {
+ return getUnderlyingType().toUriLiteral(literal);
+ }
+
+ @Override
+ public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
+ return getUnderlyingType().fromUriLiteral(literal);
+ }
+
+
+ @Override
+ public TargetType getAnnotationsTargetType() {
+ return TargetType.TypeDefinition;
+ }
+
+ @Override
+ public FullQualifiedName getAnnotationsTargetFQN() {
+ return getFullQualifiedName();
+ }
+
+ @Override
+ public String getAnnotationsTargetPath() {
+ return getName();
+ }
+}
[03/11] olingo-odata4 git commit: [OLINGO-564] Removed 'provider'
package level
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
new file mode 100644
index 0000000..630146b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.Annotatable;
+
+public class EdmTypeImpl extends AbstractEdmNamed implements EdmType {
+
+ protected final FullQualifiedName typeName;
+ protected final EdmTypeKind kind;
+
+ public EdmTypeImpl(final Edm edm, final FullQualifiedName typeName, final EdmTypeKind kind,
+ final Annotatable annotatable) {
+ super(edm, typeName.getName(), annotatable);
+ this.typeName = typeName;
+ this.kind = kind;
+ }
+
+ @Override
+ public FullQualifiedName getFullQualifiedName() {
+ return typeName;
+ }
+
+ @Override
+ public String getNamespace() {
+ return typeName.getNamespace();
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return kind;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
new file mode 100644
index 0000000..67008ab
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
@@ -0,0 +1,228 @@
+/*
+ * 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;
+
+import org.apache.commons.lang3.StringUtils;
+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.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+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.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class EdmTypeInfo {
+
+ public static class Builder {
+
+ private String typeExpression;
+ private String defaultNamespace;
+ private Edm edm;
+
+ public Builder setTypeExpression(final String typeExpression) {
+ this.typeExpression = typeExpression;
+ return this;
+ }
+
+ public Builder setDefaultNamespace(final String defaultNamespace) {
+ this.defaultNamespace = defaultNamespace;
+ return this;
+ }
+
+ public Builder setEdm(final Edm edm) {
+ this.edm = edm;
+ return this;
+ }
+
+ public EdmTypeInfo build() {
+ return new EdmTypeInfo(edm, typeExpression.indexOf('.') == -1 && StringUtils.isNotBlank(defaultNamespace)
+ ? defaultNamespace + "." + typeExpression
+ : typeExpression);
+ }
+ }
+
+ private final boolean collection;
+ private final FullQualifiedName fullQualifiedName;
+ private EdmPrimitiveTypeKind primitiveType;
+ private EdmTypeDefinition typeDefinition;
+ private EdmEnumType enumType;
+ private EdmComplexType complexType;
+ private EdmEntityType entityType;
+
+ private EdmTypeInfo(final Edm edm, final String typeExpression) {
+ String baseType;
+ final int collStartIdx = typeExpression.indexOf("Collection(");
+ final int collEndIdx = typeExpression.lastIndexOf(')');
+ if (collStartIdx == -1) {
+ baseType = typeExpression;
+ collection = false;
+ } else {
+ if (collEndIdx == -1) {
+ throw new IllegalArgumentException("Malformed type: " + typeExpression);
+ }
+
+ collection = true;
+ baseType = typeExpression.substring(collStartIdx + 11, collEndIdx);
+ }
+
+ baseType = baseType.replaceAll("^#", "");
+
+ final String typeName;
+ final String namespace;
+
+ final int lastDotIdx = baseType.lastIndexOf('.');
+ if (lastDotIdx == -1) {
+ namespace = EdmPrimitiveType.EDM_NAMESPACE;
+ typeName = baseType;
+ } else {
+ namespace = baseType.substring(0, lastDotIdx);
+ typeName = baseType.substring(lastDotIdx + 1);
+ }
+
+ if (StringUtils.isBlank(typeName)) {
+ throw new IllegalArgumentException("Null or empty type name in " + typeExpression);
+ }
+
+ fullQualifiedName = new FullQualifiedName(namespace, typeName);
+
+ try {
+ primitiveType = EdmPrimitiveTypeKind.valueOf(fullQualifiedName.getName());
+ } catch (final IllegalArgumentException e) {
+ primitiveType = null;
+ }
+ if (primitiveType == null && edm != null) {
+ typeDefinition = edm.getTypeDefinition(fullQualifiedName);
+ if (typeDefinition == null) {
+ enumType = edm.getEnumType(fullQualifiedName);
+ if (enumType == null) {
+ complexType = edm.getComplexType(fullQualifiedName);
+ if (complexType == null) {
+ entityType = edm.getEntityType(fullQualifiedName);
+ }
+ }
+ }
+ }
+ }
+
+ public String internal() {
+ final StringBuilder deserialize = new StringBuilder();
+
+ if (isCollection()) {
+ deserialize.append("Collection(");
+ }
+
+ deserialize.append(getFullQualifiedName().toString());
+
+ if (isCollection()) {
+ deserialize.append(")");
+ }
+
+ return deserialize.toString();
+ }
+
+ public String external() {
+ final StringBuilder serialize = new StringBuilder();
+
+ if (isCollection()) {
+ serialize.append('#');
+ serialize.append("Collection(");
+ }
+
+ if (isPrimitiveType()) {
+ serialize.append(getFullQualifiedName().getName());
+ }else{
+ serialize.append(getFullQualifiedName().toString());
+ }
+
+ if (isCollection()) {
+ serialize.append(")");
+ }
+
+ if (!isPrimitiveType() && !isCollection()) {
+ serialize.insert(0, '#');
+ }
+
+ return serialize.toString();
+ }
+
+ public boolean isCollection() {
+ return collection;
+ }
+
+ public FullQualifiedName getFullQualifiedName() {
+ return fullQualifiedName;
+ }
+
+ public boolean isPrimitiveType() {
+ return primitiveType != null;
+ }
+
+ public EdmPrimitiveTypeKind getPrimitiveTypeKind() {
+ return primitiveType;
+ }
+
+ public boolean isTypeDefinition() {
+ return typeDefinition != null;
+ }
+
+ public EdmTypeDefinition getTypeDefinition() {
+ return typeDefinition;
+ }
+
+ public boolean isEnumType() {
+ return enumType != null;
+ }
+
+ public EdmEnumType getEnumType() {
+ return enumType;
+ }
+
+ public boolean isComplexType() {
+ return complexType != null;
+ }
+
+ public EdmComplexType getComplexType() {
+ return complexType;
+ }
+
+ public boolean isEntityType() {
+ return entityType != null;
+ }
+
+ public EdmEntityType getEntityType() {
+ return entityType;
+ }
+
+ public EdmType getType() {
+ return isPrimitiveType()
+ ? EdmPrimitiveTypeFactory.getInstance(getPrimitiveTypeKind())
+ : isTypeDefinition()
+ ? getTypeDefinition()
+ : isEnumType()
+ ? getEnumType()
+ : isComplexType()
+ ? getComplexType()
+ : isEntityType()
+ ? getEntityType()
+ : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/Target.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/Target.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/Target.java
new file mode 100644
index 0000000..083ef6f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/Target.java
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+
+/**
+ * An Edm target element. It contains a target as a String name as well as the {@link FullQualifiedName} of the entity
+ * container it is contained in.
+ */
+public class Target {
+
+ private String targetName;
+ private FullQualifiedName entityContainer;
+
+ public Target(String target, EdmEntityContainer defaultContainer) {
+ final String[] bindingTargetParts = target.split("/");
+ if (bindingTargetParts.length == 1) {
+ entityContainer = defaultContainer.getFullQualifiedName();
+ targetName = bindingTargetParts[0];
+ } else {
+ entityContainer = new FullQualifiedName(bindingTargetParts[0]);
+ targetName = bindingTargetParts[1];
+ }
+ }
+
+ /**
+ * @return name of the target as a String
+ */
+ public String getTargetName() {
+ return targetName;
+ }
+
+ /**
+ * @return {@link FullQualifiedName} of the entity container this target is contained in.
+ */
+ public FullQualifiedName getEntityContainer() {
+ return entityContainer;
+ }
+
+ @Override
+ public String toString() {
+ if (entityContainer == null) {
+ return targetName;
+ }
+ return entityContainer.getFullQualifiedNameAsString() + "/" + targetName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/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 371a4a2..419adea 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
@@ -24,7 +24,7 @@ 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.geo.SRID;
import org.apache.olingo.commons.api.edm.provider.annotation.Cast;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class EdmCastImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmCast {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/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 a1005c0..03ae319 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
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.annotation.EdmDynamicAnnotationExpressi
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.IsOf;
-import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class EdmIsOfImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmIsOf {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/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 4aaf731..cd71c6c 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
@@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.edm.Edm;
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.core.edm.provider.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicAnnotationExpression implements EdmRecord {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmAnnotatable.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmAnnotatable.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmAnnotatable.java
deleted file mode 100644
index 0574a4e..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmAnnotatable.java
+++ /dev/null
@@ -1,69 +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.provider;
-
-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.Annotatable;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public abstract class AbstractEdmAnnotatable implements EdmAnnotatable {
-
- private final Annotatable annotatable;
- private List<EdmAnnotation> annotations;
- protected final Edm edm;
-
- public AbstractEdmAnnotatable(final Edm edm, final Annotatable annotatable) {
- this.edm = edm;
- this.annotatable = annotatable;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- EdmAnnotation result = null;
- for (EdmAnnotation annotation : getAnnotations()) {
- if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
- result = annotation;
- }
- }
-
- return result;
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- if (annotations == null) {
- final List<EdmAnnotation> annotationsLocal = new ArrayList<EdmAnnotation>();
- if (annotatable != null) {
- for (Annotation annotation : annotatable.getAnnotations()) {
- annotationsLocal.add(new EdmAnnotationImpl(edm, annotation));
- }
-
- annotations = Collections.unmodifiableList(annotationsLocal);
- }
- }
- return annotations;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmBindingTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmBindingTarget.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmBindingTarget.java
deleted file mode 100644
index 9ef4c74..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmBindingTarget.java
+++ /dev/null
@@ -1,133 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.BindingTarget;
-import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding;
-
-public abstract class AbstractEdmBindingTarget extends AbstractEdmNamed implements EdmBindingTarget {
-
- private final BindingTarget target;
- private final EdmEntityContainer container;
-
- private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
-
- public AbstractEdmBindingTarget(final Edm edm, final EdmEntityContainer container, final BindingTarget target) {
- super(edm, target.getName(), target);
- this.container = container;
- this.target = target;
- }
-
- @Override
- public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
- if (navigationPropertyBindings == null) {
- List<NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
- final List<EdmNavigationPropertyBinding> navigationPropertyBindingsLocal =
- new ArrayList<EdmNavigationPropertyBinding>();
- if (providerBindings != null) {
- for (NavigationPropertyBinding binding : providerBindings) {
- navigationPropertyBindingsLocal.add(new EdmNavigationPropertyBindingImpl(binding.getPath(),
- binding.getTarget()));
- }
- navigationPropertyBindings = Collections.unmodifiableList(navigationPropertyBindingsLocal);
- }
- }
- return navigationPropertyBindings;
- }
-
- @Override
- public EdmEntityContainer getEntityContainer() {
- return container;
- }
-
- @Override
- public EdmEntityType getEntityType() {
- final EdmEntityType entityType = edm.getEntityType(target.getTypeFQN());
- if (entityType == null) {
- throw new EdmException("Can´t find entity type: " + target.getTypeFQN() + " for entity set or singleton: "
- + getName());
- }
- return entityType;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return container.getFullQualifiedName();
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return getName();
- }
-
- @Override
- public EdmBindingTarget getRelatedBindingTarget(final String path) {
- if (path == null) {
- return null;
- }
- EdmBindingTarget bindingTarget = null;
- boolean found = false;
- for (final Iterator<EdmNavigationPropertyBinding> itor = getNavigationPropertyBindings().iterator(); itor.hasNext()
- && !found;) {
-
- final EdmNavigationPropertyBinding binding = itor.next();
- if(binding.getPath() == null || binding.getTarget() == null){
- throw new EdmException("Path or Target in navigation property binding must not be null!");
- }
- if (path.startsWith(binding.getPath())) {
- final Target edmTarget = new Target(binding.getTarget(), container);
-
- final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer());
- if (entityContainer == null) {
- throw new EdmException("Cannot find entity container with name: " + edmTarget.getEntityContainer());
- }
- try {
- bindingTarget = entityContainer.getEntitySet(edmTarget.getTargetName());
-
- if (bindingTarget == null) {
- throw new EdmException("Cannot find EntitySet " + edmTarget.getTargetName());
- }
- } catch (EdmException e) {
- // try with singletons ...
- bindingTarget = entityContainer.getSingleton(edmTarget.getTargetName());
-
- if (bindingTarget == null) {
- throw new EdmException("Cannot find Singleton " + edmTarget.getTargetName());
- }
- } finally {
- found = bindingTarget != null;
- }
- }
- }
-
- return bindingTarget;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmNamed.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmNamed.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmNamed.java
deleted file mode 100644
index 8835bc5..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmNamed.java
+++ /dev/null
@@ -1,38 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmNamed;
-import org.apache.olingo.commons.api.edm.provider.Annotatable;
-
-public abstract class AbstractEdmNamed extends AbstractEdmAnnotatable implements EdmNamed {
-
- private final String name;
-
- public AbstractEdmNamed(final Edm edm, final String name, final Annotatable annotatable) {
- super(edm, annotatable);
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperation.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperation.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperation.java
deleted file mode 100644
index c615376..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperation.java
+++ /dev/null
@@ -1,142 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmOperation;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.Operation;
-import org.apache.olingo.commons.api.edm.provider.Parameter;
-
-public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
-
- private final Operation operation;
- private Map<String, EdmParameter> parameters;
- private List<String> parameterNames;
- private EdmReturnType returnType;
-
- protected AbstractEdmOperation(final Edm edm, final FullQualifiedName name, final Operation operation,
- final EdmTypeKind kind) {
-
- super(edm, name, kind, operation);
- this.operation = operation;
- }
-
- @Override
- public EdmParameter getParameter(final String name) {
- if (parameters == null) {
- createParameters();
- }
- return parameters.get(name);
- }
-
- @Override
- public List<String> getParameterNames() {
- if (parameterNames == null) {
- createParameters();
- }
- return Collections.unmodifiableList(parameterNames);
- }
-
- private void createParameters() {
- if(parameters == null) {
- final Map<String, EdmParameter> parametersLocal = new LinkedHashMap<String, EdmParameter>();
- final List<Parameter> providerParameters = operation.getParameters();
- if (providerParameters != null) {
- final List<String> parameterNamesLocal = new ArrayList<String>(providerParameters.size());
- for (Parameter parameter : providerParameters) {
- parametersLocal.put(parameter.getName(), new EdmParameterImpl(edm, parameter));
- parameterNamesLocal.add(parameter.getName());
- }
-
- parameters = parametersLocal;
- parameterNames = parameterNamesLocal;
- } else {
- parameterNames = Collections.emptyList();
- }
- }
- }
-
- @Override
- public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
- EdmEntitySet returnedEntitySet = null;
- if (bindingParameterEntitySet != null && operation.getEntitySetPath() != null) {
- final EdmBindingTarget relatedBindingTarget =
- bindingParameterEntitySet.getRelatedBindingTarget(operation.getEntitySetPath());
- if (relatedBindingTarget == null) {
- throw new EdmException("Cannot find entity set with path: " + operation.getEntitySetPath());
- }
- if (relatedBindingTarget instanceof EdmEntitySet) {
- returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
- } else {
- throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName()
- + " must be an entity set");
- }
- }
- return returnedEntitySet;
- }
-
- @Override
- public EdmReturnType getReturnType() {
- if (returnType == null && operation.getReturnType() != null) {
- returnType = new EdmReturnTypeImpl(edm, operation.getReturnType());
- }
- return returnType;
- }
-
- @Override
- public boolean isBound() {
- return operation.isBound();
- }
-
- @Override
- public FullQualifiedName getBindingParameterTypeFqn() {
- if (isBound()) {
- Parameter bindingParameter = operation.getParameters().get(0);
- return bindingParameter.getTypeFQN();
- }
- return null;
- }
-
- @Override
- public Boolean isBindingParameterTypeCollection() {
- if (isBound()) {
- Parameter bindingParameter = operation.getParameters().get(0);
- return bindingParameter.isCollection();
- }
- return null;
- }
-
- @Override
- public String getEntitySetPath() {
- return operation.getEntitySetPath();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperationImport.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperationImport.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperationImport.java
deleted file mode 100644
index 27aa72b..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmOperationImport.java
+++ /dev/null
@@ -1,80 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmOperationImport;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.OperationImport;
-
-public abstract class AbstractEdmOperationImport extends AbstractEdmNamed implements EdmOperationImport {
-
- protected final EdmEntityContainer container;
- private final Target entitySet;
- private EdmEntitySet returnedEntitySet;
-
- public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container,
- final OperationImport operationImport) {
- super(edm, operationImport.getName(), operationImport);
- this.container = container;
- if (operationImport.getEntitySet() != null) {
- this.entitySet = new Target(operationImport.getEntitySet(), container);
- } else {
- this.entitySet = null;
- }
- }
-
- @Override
- public FullQualifiedName getFullQualifiedName() {
- return new FullQualifiedName(container.getNamespace(), getName());
- }
-
- @Override
- public EdmEntitySet getReturnedEntitySet() {
- if (entitySet != null && returnedEntitySet == null) {
- EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer());
- if (entityContainer == null) {
- throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer());
- }
- returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName());
- if (returnedEntitySet == null) {
- throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName());
- }
- }
- return returnedEntitySet;
- }
-
- @Override
- public EdmEntityContainer getEntityContainer() {
- return container;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return container.getFullQualifiedName();
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return getName();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmStructuredType.java
deleted file mode 100644
index 29d08ce..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/AbstractEdmStructuredType.java
+++ /dev/null
@@ -1,196 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.commons.api.edm.provider.StructuralType;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
-
- protected EdmStructuredType baseType;
- protected FullQualifiedName baseTypeName;
-
- private final StructuralType providerStructuredType;
-
- private List<String> propertyNames;
- private Map<String, EdmProperty> properties;
- private List<String> navigationPropertyNames;
- private Map<String, EdmNavigationProperty> navigationProperties;
-
- public AbstractEdmStructuredType(
- final Edm edm,
- final FullQualifiedName typeName,
- final EdmTypeKind kind,
- final StructuralType structuredType) {
-
- super(edm, typeName, kind, structuredType);
- this.baseTypeName = structuredType.getBaseTypeFQN();
- this.providerStructuredType = structuredType;
- }
-
- protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
-
- protected abstract void checkBaseType();
-
- @Override
- public List<String> getPropertyNames() {
- if (propertyNames == null) {
- final List<String> localPropertyNames = new ArrayList<String>();
- checkBaseType();
- if (baseType != null) {
- localPropertyNames.addAll(baseType.getPropertyNames());
- }
- localPropertyNames.addAll(getProperties().keySet());
- propertyNames = Collections.unmodifiableList(localPropertyNames);
- }
- return propertyNames;
- }
-
- @Override
- public List<String> getNavigationPropertyNames() {
- if (navigationPropertyNames == null) {
- final ArrayList<String> localNavigatinPropertyNames = new ArrayList<String>();
- checkBaseType();
- if (baseType != null) {
- localNavigatinPropertyNames.addAll(baseType.getNavigationPropertyNames());
- }
- localNavigatinPropertyNames.addAll(getNavigationProperties().keySet());
- navigationPropertyNames = Collections.unmodifiableList(localNavigatinPropertyNames);
- }
- return navigationPropertyNames;
- }
-
- @Override
- public EdmElement getProperty(final String name) {
- EdmElement property = getStructuralProperty(name);
- if (property == null) {
- property = getNavigationProperty(name);
- }
- return property;
- }
-
- @Override
- public EdmProperty getStructuralProperty(final String name) {
- EdmProperty property = null;
- checkBaseType();
- if (baseType != null) {
- property = baseType.getStructuralProperty(name);
- }
- if (property == null) {
- property = getProperties().get(name);
- }
- return property;
- }
-
- @Override
- public EdmNavigationProperty getNavigationProperty(final String name) {
- EdmNavigationProperty property = null;
- checkBaseType();
- if (baseType != null) {
- property = baseType.getNavigationProperty(name);
- }
- if (property == null) {
- property = getNavigationProperties().get(name);
- }
- return property;
- }
-
- @Override
- public boolean compatibleTo(final EdmType targetType) {
- EdmStructuredType sourceType = this;
- if (targetType == null) {
- throw new EdmException("Target type must not be null");
- }
- while (!sourceType.getName().equals(targetType.getName())
- || !sourceType.getNamespace().equals(targetType.getNamespace())) {
-
- sourceType = sourceType.getBaseType();
- if (sourceType == null) {
- return false;
- }
- }
-
- return true;
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return null;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return getFullQualifiedName();
- }
-
- public Map<String, EdmProperty> getProperties() {
- if (properties == null) {
- final Map<String, EdmProperty> localPorperties = new LinkedHashMap<String, EdmProperty>();
- final List<Property> structureTypeProperties = providerStructuredType.getProperties();
- for (Property property : structureTypeProperties) {
- localPorperties.put(property.getName(), new EdmPropertyImpl(edm, typeName, property));
- }
- properties = Collections.unmodifiableMap(localPorperties);
- }
- return properties;
- }
-
- public Map<String, EdmNavigationProperty> getNavigationProperties() {
- if (navigationProperties == null) {
- final Map<String, EdmNavigationProperty> localNavigationProperties =
- new LinkedHashMap<String, EdmNavigationProperty>();
- final List<NavigationProperty> structuredTypeNavigationProperties =
- providerStructuredType.getNavigationProperties();
-
- if (structuredTypeNavigationProperties != null) {
- for (NavigationProperty navigationProperty : structuredTypeNavigationProperties) {
- localNavigationProperties.put(navigationProperty.getName(),
- new EdmNavigationPropertyImpl(edm, typeName, navigationProperty));
- }
- }
-
- navigationProperties = Collections.unmodifiableMap(localNavigationProperties);
- }
- return navigationProperties;
- }
-
- public boolean isOpenType() {
- return providerStructuredType.isOpenType();
- }
-
- public boolean isAbstract() {
- return providerStructuredType.isAbstract();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImpl.java
deleted file mode 100644
index 32276c5..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImpl.java
+++ /dev/null
@@ -1,32 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.Action;
-
-public class EdmActionImpl extends AbstractEdmOperation implements EdmAction {
-
- public EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
- super(edm, name, action, EdmTypeKind.ACTION);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImportImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImportImpl.java
deleted file mode 100644
index 7d93e9a..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmActionImportImpl.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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.provider.ActionImport;
-
-public class EdmActionImportImpl extends AbstractEdmOperationImport implements EdmActionImport {
-
- private final ActionImport actionImport;
-
- public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final ActionImport actionImport) {
-
- super(edm, container, actionImport);
- this.actionImport = actionImport;
- }
-
- @Override
- public EdmAction getUnboundAction() {
- return edm.getUnboundAction(actionImport.getActionFQN());
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.ActionImport;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationImpl.java
deleted file mode 100644
index 07523e6..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationImpl.java
+++ /dev/null
@@ -1,225 +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.provider;
-
-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.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.Annotatable;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-import org.apache.olingo.commons.api.edm.provider.annotation.AnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.DynamicAnnotationExpression;
-import org.apache.olingo.commons.api.edm.provider.annotation.PropertyValue;
-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;
-
-public class EdmAnnotationImpl extends AbstractEdmAnnotatable implements EdmAnnotation {
-
- private final Annotation annotation;
- private EdmTerm term;
- private EdmAnnotationExpression expression;
-
- public EdmAnnotationImpl(final Edm edm, final Annotation annotation) {
- super(edm, annotation);
- this.annotation = annotation;
- }
-
- @Override
- public EdmTerm getTerm() {
- if (term == null) {
- term = edm.getTerm(new FullQualifiedName(annotation.getTerm()));
- }
- return term;
- }
-
- @Override
- public String getQualifier() {
- return annotation.getQualifier();
- }
-
- private EdmAnnotationExpression getExpression(final AnnotationExpression 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 DynamicAnnotationExpression exp) {
- EdmDynamicAnnotationExpression _expression = null;
-
- if (exp.isNot()) {
- _expression = new EdmNotImpl(getDynamicExpression(exp.asNot().getExpression()));
- } else if (exp.isTwoParamsOp()) {
- switch (exp.asTwoParamsOp().getType()) {
- case And:
- _expression = new EdmAndImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Or:
- _expression = new EdmOrImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Eq:
- _expression = new EdmEqImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Ne:
- _expression = new EdmNeImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Ge:
- _expression = new EdmGeImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Gt:
- _expression = new EdmGtImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Le:
- _expression = new EdmLeImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- break;
-
- case Lt:
- _expression = new EdmLtImpl(
- getDynamicExpression(exp.asTwoParamsOp().getLeftExpression()),
- getDynamicExpression(exp.asTwoParamsOp().getRightExpression()));
- 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 (AnnotationExpression 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 (AnnotationExpression 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()));
- } else if (exp.isLabeledElement()) {
- _expression = new EdmLabeledElementImpl(
- exp.asLabeledElement().getName(), getDynamicExpression(exp.asLabeledElement().getValue()));
- } 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 (PropertyValue 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 Annotatable) {
- for (Annotation _annotation : ((Annotatable) exp).getAnnotations()) {
- ((EdmAnnotatable) _expression).getAnnotations().add(new EdmAnnotationImpl(edm, _annotation));
- }
- }
-
- return _expression;
- }
-
- @Override
- public EdmAnnotationExpression getExpression() {
- if (expression == null) {
- expression = getExpression(annotation.getExpression());
- }
- return expression;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationsImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationsImpl.java
deleted file mode 100644
index d12010d..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmAnnotationsImpl.java
+++ /dev/null
@@ -1,151 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmAnnotationsTarget;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.Annotation;
-import org.apache.olingo.commons.api.edm.provider.Annotations;
-
-public class EdmAnnotationsImpl implements EdmAnnotations {
-
- private final Edm edm;
- private final EdmSchema schema;
- private final Annotations annotationGroup;
- private EdmAnnotationsTarget target;
- private List<EdmAnnotation> annotations;
-
- public EdmAnnotationsImpl(final Edm edm, final EdmSchema schema, final Annotations annotationGroup) {
- this.edm = edm;
- this.schema = schema;
- this.annotationGroup = annotationGroup;
- }
-
- private EdmAnnotationsTarget getTarget(final EdmStructuredType structured, final String path) {
- EdmAnnotationsTarget _target = null;
- if (structured != null) {
- _target = path == null
- ? structured
- : structured.getStructuralProperty(path);
- if (_target == null) {
- _target = structured.getNavigationProperty(path);
- }
- }
- return _target;
- }
-
- private EdmAnnotationsTarget getTarget(final EdmEnumType enumType, final String path) {
- EdmAnnotationsTarget _target = null;
- if (enumType != null) {
- _target = path == null
- ? enumType
- : enumType.getMember(path);
- }
- return _target;
- }
-
- @Override
- public EdmAnnotationsTarget getTarget() {
- if (target == null) {
- final String[] splitted = StringUtils.split(annotationGroup.getTarget(), '/');
- final FullQualifiedName base = new FullQualifiedName(splitted[0]);
- final String path = splitted.length > 1 ? splitted[1] : null;
-
- final EdmEntityContainer baseEntityContainer = schema.getEntityContainer();
-
- EdmAnnotationsTarget localTarget = baseEntityContainer == null ? null
- : baseEntityContainer.getActionImport(path);
- if (localTarget == null) {
- localTarget = getTarget(edm.getComplexType(base), path);
- if (localTarget == null) {
- if(baseEntityContainer != null && baseEntityContainer.getFullQualifiedName().equals(base)){
- localTarget = baseEntityContainer;
- }
- if (localTarget == null) {
- localTarget = baseEntityContainer == null ? null : baseEntityContainer.getEntitySet(path);
- if (localTarget == null) {
- localTarget = getTarget(edm.getEntityType(base), path);
- if (localTarget == null) {
- localTarget = getTarget(edm.getEnumType(base), path);
- if (localTarget == null) {
- localTarget = baseEntityContainer == null ? null : baseEntityContainer.getFunctionImport(path);
- if (localTarget == null) {
- localTarget = baseEntityContainer == null ? null : baseEntityContainer.getSingleton(path);
- if (localTarget == null) {
- localTarget = edm.getTerm(base);
- if (localTarget == null) {
- localTarget = edm.getTypeDefinition(base);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- target = localTarget;
- }
-
- return target;
- }
-
- @Override
- public String getQualifier() {
- return annotationGroup.getQualifier();
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- EdmAnnotation result = null;
- for (EdmAnnotation annotation : getAnnotations()) {
- if (term.getFullQualifiedName().equals(annotation.getTerm().getFullQualifiedName())) {
- result = annotation;
- }
- }
- return result;
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- if (annotations == null) {
- List<EdmAnnotation> annotationsLocal = new ArrayList<EdmAnnotation>();
- for (Annotation annotation : annotationGroup.getAnnotations()) {
- annotationsLocal.add(new EdmAnnotationImpl(edm, annotation));
- }
-
- annotations = Collections.unmodifiableList(annotationsLocal);
- }
- return annotations;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
deleted file mode 100644
index 7a14ae1..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
+++ /dev/null
@@ -1,65 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.ComplexType;
-
-public class EdmComplexTypeImpl extends AbstractEdmStructuredType implements EdmComplexType {
-
- public EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
- super(edm, name, EdmTypeKind.COMPLEX, complexType);
- }
-
- @Override
- protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
- EdmComplexType baseType = null;
- if (baseTypeName != null) {
- baseType = edm.getComplexType(baseTypeName);
- if (baseType == null) {
- throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: "
- + getName());
- }
- }
- return baseType;
- }
-
- @Override
- public EdmComplexType getBaseType() {
- checkBaseType();
- return (EdmComplexType) baseType;
- }
-
- @Override
- protected void checkBaseType() {
- if (baseTypeName != null && baseType == null) {
- baseType = buildBaseType(baseTypeName);
- }
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.ComplexType;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java
deleted file mode 100644
index 165b5cd..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityContainerImpl.java
+++ /dev/null
@@ -1,327 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.ActionImport;
-import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.commons.api.edm.provider.EntityContainer;
-import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo;
-import org.apache.olingo.commons.api.edm.provider.EntitySet;
-import org.apache.olingo.commons.api.edm.provider.FunctionImport;
-import org.apache.olingo.commons.api.edm.provider.Singleton;
-
-public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntityContainer {
-
- private final EdmProvider provider;
- private EntityContainer container;
-
- private final FullQualifiedName entityContainerName;
- private final FullQualifiedName parentContainerName;
-
- private List<EdmSingleton> singletons;
- private final Map<String, EdmSingleton> singletonCache = Collections.synchronizedMap(
- new LinkedHashMap<String, EdmSingleton>());
- private List<EdmEntitySet> entitySets;
- private final Map<String, EdmEntitySet> entitySetCache = Collections.synchronizedMap(
- new LinkedHashMap<String, EdmEntitySet>());
- private List<EdmActionImport> actionImports;
- private final Map<String, EdmActionImport> actionImportCache = Collections.synchronizedMap(
- new LinkedHashMap<String, EdmActionImport>());
- private List<EdmFunctionImport> functionImports;
- private final Map<String, EdmFunctionImport> functionImportCache = Collections.synchronizedMap(
- new LinkedHashMap<String, EdmFunctionImport>());
-
- public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
- final EntityContainerInfo entityContainerInfo) {
- super(edm, entityContainerInfo.getContainerName().getName(), null);
- this.provider = provider;
- this.entityContainerName = entityContainerInfo.getContainerName();
- this.parentContainerName = entityContainerInfo.getExtendsContainer();
- }
-
- public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
- final EntityContainer entityContainer) {
- super(edm, containerFQN.getName(), entityContainer);
- this.provider = provider;
- container = entityContainer;
- this.entityContainerName = containerFQN;
- this.parentContainerName = entityContainer.getExtendsContainerFQN();
- }
-
- @Override
- public String getNamespace() {
- return entityContainerName.getNamespace();
- }
-
- @Override
- public FullQualifiedName getFullQualifiedName() {
- return entityContainerName;
- }
-
- @Override
- public EdmSingleton getSingleton(final String singletonName) {
- EdmSingleton singleton = singletonCache.get(singletonName);
- if (singleton == null) {
- singleton = createSingleton(singletonName);
- if (singleton != null) {
- singletonCache.put(singletonName, singleton);
- }
- }
- return singleton;
- }
-
- @Override
- public EdmEntitySet getEntitySet(final String entitySetName) {
- EdmEntitySet entitySet = entitySetCache.get(entitySetName);
- if (entitySet == null) {
- entitySet = createEntitySet(entitySetName);
- if (entitySet != null) {
- entitySetCache.put(entitySetName, entitySet);
- }
- }
- return entitySet;
- }
-
- @Override
- public EdmActionImport getActionImport(final String actionImportName) {
- EdmActionImport actionImport = actionImportCache.get(actionImportName);
- if (actionImport == null) {
- actionImport = createActionImport(actionImportName);
- if (actionImport != null) {
- actionImportCache.put(actionImportName, actionImport);
- }
- }
- return actionImport;
- }
-
- @Override
- public EdmFunctionImport getFunctionImport(final String functionImportName) {
- EdmFunctionImport functionImport = functionImportCache.get(functionImportName);
- if (functionImport == null) {
- functionImport = createFunctionImport(functionImportName);
- if (functionImport != null) {
- functionImportCache.put(functionImportName, functionImport);
- }
- }
- return functionImport;
- }
-
- @Override
- public List<EdmEntitySet> getEntitySets() {
- if (entitySets == null) {
- loadAllEntitySets();
- }
- return Collections.unmodifiableList(entitySets);
- }
-
- @Override
- public List<EdmFunctionImport> getFunctionImports() {
- if (functionImports == null) {
- loadAllFunctionImports();
- }
- return Collections.unmodifiableList(functionImports);
- }
-
- @Override
- public List<EdmSingleton> getSingletons() {
- if (singletons == null) {
- loadAllSingletons();
- }
- return Collections.unmodifiableList(singletons);
- }
-
- @Override
- public List<EdmActionImport> getActionImports() {
- if (actionImports == null) {
- loadAllActionImports();
- }
- return Collections.unmodifiableList(actionImports);
- }
-
- @Override
- public FullQualifiedName getParentContainerName() {
- return parentContainerName;
- }
-
- protected EdmSingleton createSingleton(final String singletonName) {
- EdmSingleton singleton = null;
-
- try {
- final Singleton providerSingleton = provider.getSingleton(entityContainerName, singletonName);
- if (providerSingleton != null) {
- singleton = new EdmSingletonImpl(edm, this, providerSingleton);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return singleton;
- }
-
- protected EdmEntitySet createEntitySet(final String entitySetName) {
- EdmEntitySet entitySet = null;
-
- try {
- final EntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName);
- if (providerEntitySet != null) {
- entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return entitySet;
- }
-
- protected EdmActionImport createActionImport(final String actionImportName) {
- EdmActionImport actionImport = null;
-
- try {
- final ActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName);
- if (providerImport != null) {
- actionImport = new EdmActionImportImpl(edm, this, providerImport);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return actionImport;
- }
-
- protected EdmFunctionImport createFunctionImport(final String functionImportName) {
- EdmFunctionImport functionImport = null;
-
- try {
- final FunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName);
- if (providerImport != null) {
- functionImport = new EdmFunctionImportImpl(edm, this, providerImport);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return functionImport;
- }
-
- protected void loadAllEntitySets() {
- loadContainer();
- final List<EntitySet> providerEntitySets = container.getEntitySets();
- final List<EdmEntitySet> entitySetsLocal = new ArrayList<EdmEntitySet>();
-
- if (providerEntitySets != null) {
- for (EntitySet entitySet : providerEntitySets) {
- final EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
- entitySetCache.put(impl.getName(), impl);
- entitySetsLocal.add(impl);
- }
- entitySets = entitySetsLocal;
- }
- }
-
- protected void loadAllFunctionImports() {
- loadContainer();
- final List<FunctionImport> providerFunctionImports = container.getFunctionImports();
- final ArrayList<EdmFunctionImport> functionImportsLocal = new ArrayList<EdmFunctionImport>();
-
- if (providerFunctionImports != null) {
- for (FunctionImport functionImport : providerFunctionImports) {
- EdmFunctionImportImpl impl = new EdmFunctionImportImpl(edm, this, functionImport);
- functionImportCache.put(impl.getName(), impl);
- functionImportsLocal.add(impl);
- }
- functionImports = functionImportsLocal;
- }
- }
-
- protected void loadAllSingletons() {
- loadContainer();
- final List<Singleton> providerSingletons = container.getSingletons();
- final List<EdmSingleton> singletonsLocal = new ArrayList<EdmSingleton>();
-
- if (providerSingletons != null) {
- for (Singleton singleton : providerSingletons) {
- final EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
- singletonCache.put(singleton.getName(), impl);
- singletonsLocal.add(impl);
- }
- singletons = singletonsLocal;
- }
- }
-
- protected void loadAllActionImports() {
- loadContainer();
- final List<ActionImport> providerActionImports = container.getActionImports();
- final List<EdmActionImport> actionImportsLocal = new ArrayList<EdmActionImport>();
-
- if (providerActionImports != null) {
- for (ActionImport actionImport : providerActionImports) {
- final EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
- actionImportCache.put(actionImport.getName(), impl);
- actionImportsLocal.add(impl);
- }
- actionImports = actionImportsLocal;
- }
-
- }
-
- private void loadContainer() {
- if (container == null) {
- try {
- EntityContainer containerLocal = provider.getEntityContainer();
- if (containerLocal == null) {
- containerLocal = new EntityContainer().setName(getName());
- }
-
- container = containerLocal;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
- }
-
- @Override
- public String getAnnotationsTargetPath() {
- return null;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return getFullQualifiedName();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.EntityContainer;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java
deleted file mode 100644
index 867b82c..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntitySetImpl.java
+++ /dev/null
@@ -1,44 +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.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.provider.EntitySet;
-
-public class EdmEntitySetImpl extends AbstractEdmBindingTarget implements EdmEntitySet {
-
- private EntitySet entitySet;
-
- public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final EntitySet entitySet) {
- super(edm, container, entitySet);
- this.entitySet = entitySet;
- }
-
- @Override
- public boolean isIncludeInServiceDocument() {
- return entitySet.isIncludeInServiceDocument();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.EntitySet;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ac32d236/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
deleted file mode 100644
index 3040499..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
+++ /dev/null
@@ -1,146 +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.provider;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.provider.EntityType;
-import org.apache.olingo.commons.api.edm.provider.PropertyRef;
-
-public class EdmEntityTypeImpl extends AbstractEdmStructuredType implements EdmEntityType {
-
- private EntityType entityType;
- private boolean baseTypeChecked = false;
- private final boolean hasStream;
- protected EdmEntityType entityBaseType;
- private final List<String> keyPredicateNames = Collections.synchronizedList(new ArrayList<String>());
- private final Map<String, EdmKeyPropertyRef> keyPropertyRefs =
- Collections.synchronizedMap(new LinkedHashMap<String, EdmKeyPropertyRef>());
- private List<EdmKeyPropertyRef> keyPropertyRefsList;
-
- public EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
- super(edm, name, EdmTypeKind.ENTITY, entityType);
- this.entityType = entityType;
- hasStream = entityType.hasStream();
- }
-
- @Override
- protected void checkBaseType() {
- if (!baseTypeChecked) {
- if (baseTypeName != null) {
- baseType = buildBaseType(baseTypeName);
- entityBaseType = (EdmEntityType) baseType;
- }
- if (baseType == null
- || (baseType.isAbstract() && ((EdmEntityType) baseType).getKeyPropertyRefs().size() == 0)) {
- final List<PropertyRef> key = entityType.getKey();
- if (key != null) {
- final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
- for (PropertyRef ref : key) {
- edmKey.add(new EdmKeyPropertyRefImpl(this, ref));
- }
- setEdmKeyPropertyRef(edmKey);
- }
- }
- baseTypeChecked = true;
- }
- }
-
- protected void setEdmKeyPropertyRef(final List<EdmKeyPropertyRef> edmKey) {
- for (EdmKeyPropertyRef ref : edmKey) {
- if (ref.getAlias() == null) {
- keyPredicateNames.add(ref.getName());
- keyPropertyRefs.put(ref.getName(), ref);
- } else {
- keyPredicateNames.add(ref.getAlias());
- keyPropertyRefs.put(ref.getAlias(), ref);
- }
- }
- }
-
- @Override
- protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) {
- EdmEntityType baseType = null;
- if (baseTypeName != null) {
- baseType = edm.getEntityType(baseTypeName);
- if (baseType == null) {
- throw new EdmException("Cannot find base type with name: " + baseTypeName + " for entity type: " + getName());
- }
- }
- return baseType;
- }
-
- @Override
- public EdmEntityType getBaseType() {
- checkBaseType();
- return entityBaseType;
- }
-
- @Override
- public List<String> getKeyPredicateNames() {
- checkBaseType();
- if (keyPredicateNames.isEmpty() && baseType != null) {
- return entityBaseType.getKeyPredicateNames();
- }
- return Collections.unmodifiableList(keyPredicateNames);
- }
-
- @Override
- public List<EdmKeyPropertyRef> getKeyPropertyRefs() {
- checkBaseType();
- if (keyPropertyRefsList == null) {
- keyPropertyRefsList = new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values());
- }
- if (keyPropertyRefsList.isEmpty() && entityBaseType != null) {
- return entityBaseType.getKeyPropertyRefs();
- }
- return Collections.unmodifiableList(keyPropertyRefsList);
- }
-
- @Override
- public EdmKeyPropertyRef getKeyPropertyRef(final String keyPredicateName) {
- checkBaseType();
- final EdmKeyPropertyRef edmKeyPropertyRef = keyPropertyRefs.get(keyPredicateName);
- if (edmKeyPropertyRef == null && entityBaseType != null) {
- return entityBaseType.getKeyPropertyRef(keyPredicateName);
- }
- return edmKeyPropertyRef;
- }
-
- @Override
- public boolean hasStream() {
- return hasStream;
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.EntityType;
- }
-}