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/28 22:16:15 UTC
[5/5] olingo-odata4 git commit: [OLINGO-564] Renamed 'ClientCsdl'
classes
[OLINGO-564] Renamed 'ClientCsdl' 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/53b10f6b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/53b10f6b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/53b10f6b
Branch: refs/heads/OLINGO-564
Commit: 53b10f6b7f700f2c9147148669965ec732ad3d28
Parents: 3c09909
Author: Michael Bolz <mi...@sap.com>
Authored: Tue Apr 28 22:14:13 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Tue Apr 28 22:14:13 2015 +0200
----------------------------------------------------------------------
.../olingo/ext/proxy/AbstractService.java | 4 +-
.../client/core/edm/ClientCsdlEdmProvider.java | 212 +++++++++++
.../client/core/edm/ClientCsdlXMLMetadata.java | 75 ++++
.../client/core/edm/ClientEdmProvider.java | 212 -----------
.../client/core/edm/ClientXMLMetadata.java | 75 ----
...tAnnotatableDynamicAnnotationExpression.java | 38 --
.../xml/AbstractClientAnnotationExpression.java | 49 ---
...lAnnotatableDynamicAnnotationExpression.java | 38 ++
.../AbstractClientCsdlAnnotationExpression.java | 49 +++
...ctClientCsdlDynamicAnnotationExpression.java | 356 +++++++++++++++++++
.../xml/AbstractClientCsdlEdmDeserializer.java | 60 ++++
...tClientCsdlElementOrAttributeExpression.java | 37 ++
...stractClientDynamicAnnotationExpression.java | 356 -------------------
.../edm/xml/AbstractClientEdmDeserializer.java | 60 ----
...tractClientElementOrAttributeExpression.java | 37 --
.../client/core/edm/xml/ClientAction.java | 68 ----
.../client/core/edm/xml/ClientActionImport.java | 58 ---
.../client/core/edm/xml/ClientAnnotation.java | 66 ----
.../core/edm/xml/ClientAnnotationPath.java | 27 --
.../client/core/edm/xml/ClientAnnotations.java | 62 ----
.../olingo/client/core/edm/xml/ClientApply.java | 80 -----
.../olingo/client/core/edm/xml/ClientCast.java | 137 -------
.../client/core/edm/xml/ClientCollection.java | 64 ----
.../client/core/edm/xml/ClientComplexType.java | 72 ----
.../xml/ClientConstantAnnotationExpression.java | 52 ---
.../client/core/edm/xml/ClientCsdlAction.java | 68 ++++
.../core/edm/xml/ClientCsdlActionImport.java | 58 +++
.../core/edm/xml/ClientCsdlAnnotation.java | 66 ++++
.../core/edm/xml/ClientCsdlAnnotationPath.java | 27 ++
.../core/edm/xml/ClientCsdlAnnotations.java | 62 ++++
.../client/core/edm/xml/ClientCsdlApply.java | 80 +++++
.../client/core/edm/xml/ClientCsdlCast.java | 137 +++++++
.../core/edm/xml/ClientCsdlCollection.java | 64 ++++
.../core/edm/xml/ClientCsdlComplexType.java | 72 ++++
.../ClientCsdlConstantAnnotationExpression.java | 52 +++
.../core/edm/xml/ClientCsdlDataServices.java | 93 +++++
.../client/core/edm/xml/ClientCsdlEdmx.java | 95 +++++
.../core/edm/xml/ClientCsdlEntityContainer.java | 72 ++++
.../core/edm/xml/ClientCsdlEntityKey.java | 63 ++++
.../core/edm/xml/ClientCsdlEntitySet.java | 65 ++++
.../core/edm/xml/ClientCsdlEntityType.java | 76 ++++
.../core/edm/xml/ClientCsdlEnumMember.java | 57 +++
.../client/core/edm/xml/ClientCsdlEnumType.java | 65 ++++
.../client/core/edm/xml/ClientCsdlFunction.java | 69 ++++
.../core/edm/xml/ClientCsdlFunctionImport.java | 64 ++++
.../client/core/edm/xml/ClientCsdlIf.java | 61 ++++
.../client/core/edm/xml/ClientCsdlInclude.java | 76 ++++
.../edm/xml/ClientCsdlIncludeAnnotations.java | 88 +++++
.../client/core/edm/xml/ClientCsdlIsOf.java | 136 +++++++
.../core/edm/xml/ClientCsdlLabeledElement.java | 79 ++++
.../xml/ClientCsdlLabeledElementReference.java | 28 ++
.../edm/xml/ClientCsdlNavigationProperty.java | 80 +++++
.../ClientCsdlNavigationPropertyBinding.java | 67 ++++
.../xml/ClientCsdlNavigationPropertyPath.java | 28 ++
.../client/core/edm/xml/ClientCsdlNot.java | 39 ++
.../client/core/edm/xml/ClientCsdlNull.java | 51 +++
.../client/core/edm/xml/ClientCsdlOnDelete.java | 54 +++
.../core/edm/xml/ClientCsdlParameter.java | 84 +++++
.../client/core/edm/xml/ClientCsdlPath.java | 27 ++
.../client/core/edm/xml/ClientCsdlProperty.java | 88 +++++
.../core/edm/xml/ClientCsdlPropertyPath.java | 27 ++
.../core/edm/xml/ClientCsdlPropertyRef.java | 54 +++
.../core/edm/xml/ClientCsdlPropertyValue.java | 81 +++++
.../client/core/edm/xml/ClientCsdlRecord.java | 76 ++++
.../core/edm/xml/ClientCsdlReference.java | 98 +++++
.../xml/ClientCsdlReferentialConstraint.java | 54 +++
.../core/edm/xml/ClientCsdlReturnType.java | 78 ++++
.../client/core/edm/xml/ClientCsdlSchema.java | 86 +++++
.../core/edm/xml/ClientCsdlSingleton.java | 62 ++++
.../client/core/edm/xml/ClientCsdlTerm.java | 83 +++++
...lTwoParamsOpDynamicAnnotationExpression.java | 62 ++++
.../core/edm/xml/ClientCsdlTypeDefinition.java | 74 ++++
.../client/core/edm/xml/ClientCsdlUrlRef.java | 65 ++++
.../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 ----
.../olingo/client/core/edm/xml/ClientIf.java | 61 ----
.../client/core/edm/xml/ClientInclude.java | 76 ----
.../core/edm/xml/ClientIncludeAnnotations.java | 88 -----
.../olingo/client/core/edm/xml/ClientIsOf.java | 136 -------
.../core/edm/xml/ClientLabeledElement.java | 79 ----
.../edm/xml/ClientLabeledElementReference.java | 28 --
.../core/edm/xml/ClientNavigationProperty.java | 80 -----
.../xml/ClientNavigationPropertyBinding.java | 67 ----
.../edm/xml/ClientNavigationPropertyPath.java | 28 --
.../olingo/client/core/edm/xml/ClientNot.java | 39 --
.../olingo/client/core/edm/xml/ClientNull.java | 51 ---
.../client/core/edm/xml/ClientOnDelete.java | 54 ---
.../client/core/edm/xml/ClientParameter.java | 84 -----
.../olingo/client/core/edm/xml/ClientPath.java | 27 --
.../client/core/edm/xml/ClientProperty.java | 88 -----
.../client/core/edm/xml/ClientPropertyPath.java | 27 --
.../client/core/edm/xml/ClientPropertyRef.java | 54 ---
.../core/edm/xml/ClientPropertyValue.java | 80 -----
.../client/core/edm/xml/ClientRecord.java | 76 ----
.../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 -----
...tTwoParamsOpDynamicAnnotationExpression.java | 62 ----
.../core/edm/xml/ClientTypeDefinition.java | 74 ----
.../client/core/edm/xml/ClientUrlRef.java | 65 ----
.../ClientODataDeserializerImpl.java | 6 +-
.../core/serialization/ODataReaderImpl.java | 4 +-
113 files changed, 4125 insertions(+), 4124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/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 8770286..f8506c2 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
@@ -30,7 +30,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.client.core.edm.ClientEdmProvider;
+import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider;
import org.apache.olingo.commons.api.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -86,7 +86,7 @@ public abstract class AbstractService<C extends EdmEnabledODataClient> {
}
final Edm edm;
if (metadata != null) {
- ClientEdmProvider provider = new ClientEdmProvider(metadata.getSchemaByNsOrAlias());
+ ClientCsdlEdmProvider provider = new ClientCsdlEdmProvider(metadata.getSchemaByNsOrAlias());
edm = new EdmProviderImpl(provider);
}else{
edm = null;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
new file mode 100644
index 0000000..28536ba
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
@@ -0,0 +1,212 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
+import org.apache.olingo.commons.api.edm.provider.CsdlAction;
+import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
+import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
+import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
+import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
+import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
+import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
+import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
+import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition;
+
+public class ClientCsdlEdmProvider extends CsdlAbstractEdmProvider {
+
+ private final Map<String, CsdlSchema> xmlSchemas;
+
+ public ClientCsdlEdmProvider(Map<String, CsdlSchema> xmlSchemas) {
+ this.xmlSchemas = xmlSchemas;
+ }
+
+ @Override
+ public CsdlEnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(enumTypeName.getNamespace());
+ if (schema != null) {
+ return schema.getEnumType(enumTypeName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlTypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(typeDefinitionName.getNamespace());
+ if (schema != null) {
+ return schema.getTypeDefinition(typeDefinitionName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(entityTypeName.getNamespace());
+ if (schema != null) {
+ return schema.getEntityType(entityTypeName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(complexTypeName.getNamespace());
+ if (schema != null) {
+ return schema.getComplexType(complexTypeName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(actionName.getNamespace());
+ if (schema != null) {
+ return schema.getActions(actionName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public List<CsdlFunction> getFunctions(final FullQualifiedName functionName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(functionName.getNamespace());
+ if (schema != null) {
+ return schema.getFunctions(functionName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlTerm getTerm(final FullQualifiedName termName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(termName.getNamespace());
+ if (schema != null) {
+ return schema.getTerm(termName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
+ throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
+ if (schema != null) {
+ return schema.getEntityContainer().getEntitySet(entitySetName);
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
+ throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
+ if (schema != null) {
+ return schema.getEntityContainer().getSingleton(singletonName);
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
+ throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
+ if (schema != null) {
+ return schema.getEntityContainer().getActionImport(actionImportName);
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlFunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
+ throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
+ if (schema != null) {
+ return schema.getEntityContainer().getFunctionImport(functionImportName);
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlEntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName)
+ throws ODataException {
+ for (CsdlSchema schema : xmlSchemas.values()) {
+ if (schema.getEntityContainer() != null) {
+ return new CsdlEntityContainerInfo().setContainerName(entityContainerName).setExtendsContainer(
+ schema.getEntityContainer().getExtendsContainerFQN());
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public List<CsdlAliasInfo> getAliasInfos() throws ODataException {
+ ArrayList<CsdlAliasInfo> aliasInfo = new ArrayList<CsdlAliasInfo>();
+ for (CsdlSchema schema : xmlSchemas.values()) {
+ if (schema.getAlias() != null) {
+ aliasInfo.add(new CsdlAliasInfo().setNamespace(schema.getNamespace()).setAlias(schema.getAlias()));
+ }
+ }
+ return aliasInfo;
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() throws ODataException {
+ return new ArrayList<CsdlSchema>(xmlSchemas.values());
+ }
+
+ @Override
+ public CsdlEntityContainer getEntityContainer() throws ODataException {
+ for (CsdlSchema schema : xmlSchemas.values()) {
+ if (schema.getEntityContainer() != null) {
+ return schema.getEntityContainer();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName) throws ODataException {
+ CsdlSchema schema = xmlSchemas.get(targetName.getNamespace());
+ if (schema != null) {
+ return schema.getAnnotationGroup(targetName.getName());
+ }
+ return null;
+ }
+
+ @Override
+ public CsdlAnnotatable getAnnoatatable(FullQualifiedName annotatedName) throws ODataException {
+ final CsdlSchema schema = xmlSchemas.get(annotatedName.getNamespace());
+ if (schema != null) {
+ return schema.getAnnotatables().get(annotatedName.getName());
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlXMLMetadata.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlXMLMetadata.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlXMLMetadata.java
new file mode 100644
index 0000000..b4f7743
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlXMLMetadata.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;
+
+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.CsdlAbstractEdmItem;
+import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
+
+/**
+ * Entry point for access information about EDM metadata.
+ */
+public class ClientCsdlXMLMetadata extends CsdlAbstractEdmItem implements XMLMetadata {
+
+ private static final long serialVersionUID = 6025723060298454901L;
+ protected final Edmx edmx;
+
+ public ClientCsdlXMLMetadata(final Edmx edmx) {
+ this.edmx = edmx;
+ }
+
+ @Override
+ public List<CsdlSchema> getSchemas() {
+ return this.edmx.getDataServices().getSchemas();
+ }
+
+ @Override
+ public CsdlSchema getSchema(final int index) {
+ return getSchemas().get(index);
+ }
+
+ @Override
+ public CsdlSchema getSchema(final String key) {
+ return getSchemaByNsOrAlias().get(key);
+ }
+
+ @Override
+ public Map<String, CsdlSchema> getSchemaByNsOrAlias() {
+ final Map<String, CsdlSchema> schemaByNsOrAlias = new HashMap<String, CsdlSchema>();
+ for (CsdlSchema 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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientEdmProvider.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientEdmProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientEdmProvider.java
deleted file mode 100644
index 6284ade..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientEdmProvider.java
+++ /dev/null
@@ -1,212 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
-import org.apache.olingo.commons.api.edm.provider.CsdlAction;
-import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
-import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
-import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
-import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
-import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
-import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
-import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
-import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
-import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
-import org.apache.olingo.commons.api.edm.provider.CsdlTypeDefinition;
-
-public class ClientEdmProvider extends CsdlAbstractEdmProvider {
-
- private final Map<String, CsdlSchema> xmlSchemas;
-
- public ClientEdmProvider(Map<String, CsdlSchema> xmlSchemas) {
- this.xmlSchemas = xmlSchemas;
- }
-
- @Override
- public CsdlEnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(enumTypeName.getNamespace());
- if (schema != null) {
- return schema.getEnumType(enumTypeName.getName());
- }
- return null;
- }
-
- @Override
- public CsdlTypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(typeDefinitionName.getNamespace());
- if (schema != null) {
- return schema.getTypeDefinition(typeDefinitionName.getName());
- }
- return null;
- }
-
- @Override
- public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(entityTypeName.getNamespace());
- if (schema != null) {
- return schema.getEntityType(entityTypeName.getName());
- }
- return null;
- }
-
- @Override
- public CsdlComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(complexTypeName.getNamespace());
- if (schema != null) {
- return schema.getComplexType(complexTypeName.getName());
- }
- return null;
- }
-
- @Override
- public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(actionName.getNamespace());
- if (schema != null) {
- return schema.getActions(actionName.getName());
- }
- return null;
- }
-
- @Override
- public List<CsdlFunction> getFunctions(final FullQualifiedName functionName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(functionName.getNamespace());
- if (schema != null) {
- return schema.getFunctions(functionName.getName());
- }
- return null;
- }
-
- @Override
- public CsdlTerm getTerm(final FullQualifiedName termName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(termName.getNamespace());
- if (schema != null) {
- return schema.getTerm(termName.getName());
- }
- return null;
- }
-
- @Override
- public CsdlEntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
- if (schema != null) {
- return schema.getEntityContainer().getEntitySet(entitySetName);
- }
- return null;
- }
-
- @Override
- public CsdlSingleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
- throws ODataException {
- CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
- if (schema != null) {
- return schema.getEntityContainer().getSingleton(singletonName);
- }
- return null;
- }
-
- @Override
- public CsdlActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
- throws ODataException {
- CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
- if (schema != null) {
- return schema.getEntityContainer().getActionImport(actionImportName);
- }
- return null;
- }
-
- @Override
- public CsdlFunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
- throws ODataException {
- CsdlSchema schema = xmlSchemas.get(entityContainer.getNamespace());
- if (schema != null) {
- return schema.getEntityContainer().getFunctionImport(functionImportName);
- }
- return null;
- }
-
- @Override
- public CsdlEntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName)
- throws ODataException {
- for (CsdlSchema schema : xmlSchemas.values()) {
- if (schema.getEntityContainer() != null) {
- return new CsdlEntityContainerInfo().setContainerName(entityContainerName).setExtendsContainer(
- schema.getEntityContainer().getExtendsContainerFQN());
- }
- }
- return null;
- }
-
- @Override
- public List<CsdlAliasInfo> getAliasInfos() throws ODataException {
- ArrayList<CsdlAliasInfo> aliasInfo = new ArrayList<CsdlAliasInfo>();
- for (CsdlSchema schema : xmlSchemas.values()) {
- if (schema.getAlias() != null) {
- aliasInfo.add(new CsdlAliasInfo().setNamespace(schema.getNamespace()).setAlias(schema.getAlias()));
- }
- }
- return aliasInfo;
- }
-
- @Override
- public List<CsdlSchema> getSchemas() throws ODataException {
- return new ArrayList<CsdlSchema>(xmlSchemas.values());
- }
-
- @Override
- public CsdlEntityContainer getEntityContainer() throws ODataException {
- for (CsdlSchema schema : xmlSchemas.values()) {
- if (schema.getEntityContainer() != null) {
- return schema.getEntityContainer();
- }
- }
- return null;
- }
-
- @Override
- public CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName) throws ODataException {
- CsdlSchema schema = xmlSchemas.get(targetName.getNamespace());
- if (schema != null) {
- return schema.getAnnotationGroup(targetName.getName());
- }
- return null;
- }
-
- @Override
- public CsdlAnnotatable getAnnoatatable(FullQualifiedName annotatedName) throws ODataException {
- final CsdlSchema schema = xmlSchemas.get(annotatedName.getNamespace());
- if (schema != null) {
- return schema.getAnnotatables().get(annotatedName.getName());
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.java
deleted file mode 100644
index 96c07c2..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientXMLMetadata.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;
-
-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.CsdlAbstractEdmItem;
-import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
-
-/**
- * Entry point for access information about EDM metadata.
- */
-public class ClientXMLMetadata extends CsdlAbstractEdmItem implements XMLMetadata {
-
- private static final long serialVersionUID = 6025723060298454901L;
- protected final Edmx edmx;
-
- public ClientXMLMetadata(final Edmx edmx) {
- this.edmx = edmx;
- }
-
- @Override
- public List<CsdlSchema> getSchemas() {
- return this.edmx.getDataServices().getSchemas();
- }
-
- @Override
- public CsdlSchema getSchema(final int index) {
- return getSchemas().get(index);
- }
-
- @Override
- public CsdlSchema getSchema(final String key) {
- return getSchemaByNsOrAlias().get(key);
- }
-
- @Override
- public Map<String, CsdlSchema> getSchemaByNsOrAlias() {
- final Map<String, CsdlSchema> schemaByNsOrAlias = new HashMap<String, CsdlSchema>();
- for (CsdlSchema 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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.java
deleted file mode 100644
index 052c4c7..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotatableDynamicAnnotationExpression.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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
-
-abstract class AbstractClientAnnotatableDynamicAnnotationExpression
- extends AbstractClientDynamicAnnotationExpression implements CsdlAnnotatable {
-
- private static final long serialVersionUID = -450668773857358139L;
-
- private final List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>();
-
- @Override
- public List<CsdlAnnotation> getAnnotations() {
- return annotations;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.java
deleted file mode 100644
index bcdaf40..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientAnnotationExpression.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;
-
-import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmItem;
-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;
-
-abstract class AbstractClientAnnotationExpression extends CsdlAbstractEdmItem 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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.java
new file mode 100644
index 0000000..68e98ae
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotatableDynamicAnnotationExpression.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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotatable;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
+
+abstract class AbstractClientCsdlAnnotatableDynamicAnnotationExpression
+ extends AbstractClientCsdlDynamicAnnotationExpression implements CsdlAnnotatable {
+
+ private static final long serialVersionUID = -450668773857358139L;
+
+ private final List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>();
+
+ @Override
+ public List<CsdlAnnotation> getAnnotations() {
+ return annotations;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotationExpression.java
new file mode 100644
index 0000000..d362dfd
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlAnnotationExpression.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;
+
+import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmItem;
+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;
+
+abstract class AbstractClientCsdlAnnotationExpression extends CsdlAbstractEdmItem 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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java
new file mode 100644
index 0000000..229ef87
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlDynamicAnnotationExpression.java
@@ -0,0 +1,356 @@
+/*
+ * 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.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.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 = AbstractClientCsdlDynamicAnnotationExpression.DynamicAnnotationExpressionDeserializer.class)
+abstract class AbstractClientCsdlDynamicAnnotationExpression
+ extends AbstractClientCsdlAnnotationExpression 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 AbstractClientCsdlEdmDeserializer<AbstractClientCsdlDynamicAnnotationExpression> {
+
+ 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 AbstractClientCsdlElementOrAttributeExpression getElementOrAttributeExpression(final String simpleClassName)
+ throws JsonParseException {
+
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends AbstractClientCsdlElementOrAttributeExpression> elOrAttrClass =
+ (Class<? extends AbstractClientCsdlElementOrAttributeExpression>) ClassUtils.getClass(
+ getClass().getPackage().getName() + ".ClientCsdl" + simpleClassName);
+ return elOrAttrClass.newInstance();
+ } catch (Exception e) {
+ throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e);
+ }
+ }
+
+ private AbstractClientCsdlAnnotationExpression parseConstOrEnumExpression(final JsonParser jp) throws IOException {
+ AbstractClientCsdlAnnotationExpression result;
+ if (isAnnotationConstExprConstruct(jp)) {
+ result = parseAnnotationConstExprConstruct(jp);
+ } else {
+ result = jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.class);
+ }
+ jp.nextToken();
+
+ return result;
+ }
+
+ @Override
+ protected AbstractClientCsdlDynamicAnnotationExpression doDeserialize(final JsonParser jp,
+ final DeserializationContext ctxt) throws IOException {
+
+ AbstractClientCsdlDynamicAnnotationExpression expression = null;
+
+ if ("Not".equals(jp.getCurrentName())) {
+ final ClientCsdlNot not = new ClientCsdlNot();
+
+ jp.nextToken();
+ //Search for field name
+ while (jp.getCurrentToken() != JsonToken.FIELD_NAME) {
+ jp.nextToken();
+ }
+ not.setExpression(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.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 ClientCsdlTwoParamsOpDynamicAnnotationExpression dynExprDoubleParamOp =
+ new ClientCsdlTwoParamsOpDynamicAnnotationExpression();
+ 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(AbstractClientCsdlDynamicAnnotationExpression.class));
+ dynExprDoubleParamOp.setRightExpression(jp.readValueAs(AbstractClientCsdlDynamicAnnotationExpression.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 AbstractClientCsdlElementOrAttributeExpression elOrAttr =
+ getElementOrAttributeExpression(jp.getCurrentName());
+ elOrAttr.setValue(jp.nextTextValue());
+ expression = elOrAttr;
+ } else if (APPLY.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlApply.class);
+ } else if (CAST.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlCast.class);
+ } else if (COLLECTION.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlCollection.class);
+ } else if (IF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ jp.nextToken();
+
+ final ClientCsdlIf ifImpl = new ClientCsdlIf();
+ 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(ClientCsdlIsOf.class);
+ } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlLabeledElement.class);
+ } else if (NULL.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlNull.class);
+ } else if (RECORD.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlRecord.class);
+ } else if (URL_REF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ expression = jp.readValueAs(ClientCsdlUrlRef.class);
+ }
+
+ return expression;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
new file mode 100644
index 0000000..c96654c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlEdmDeserializer.java
@@ -0,0 +1,60 @@
+/*
+ * 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.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
+
+abstract class AbstractClientCsdlEdmDeserializer<T> extends JsonDeserializer<T> {
+
+ protected boolean isAnnotationConstExprConstruct(final JsonParser jp) throws IOException {
+ return ClientCsdlConstantAnnotationExpression.Type.fromString(jp.getCurrentName()) != null;
+ }
+
+ protected ClientCsdlConstantAnnotationExpression parseAnnotationConstExprConstruct(final JsonParser jp)
+ throws IOException {
+ final ClientCsdlConstantAnnotationExpression constExpr = new ClientCsdlConstantAnnotationExpression();
+ constExpr.setType(ClientCsdlConstantAnnotationExpression.Type.fromString(jp.getCurrentName()));
+ constExpr.setValue(jp.nextTextValue());
+ return constExpr;
+ }
+
+ protected ClientCsdlReturnType parseReturnType(final JsonParser jp, final String elementName) throws IOException {
+ final ClientCsdlReturnType returnType;
+ if (elementName.equals(((FromXmlParser) jp).getStaxReader().getLocalName())) {
+ returnType = new ClientCsdlReturnType();
+ returnType.setType(jp.nextTextValue());
+ } else {
+ jp.nextToken();
+ returnType = jp.readValueAs(ClientCsdlReturnType.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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.java
new file mode 100644
index 0000000..6c4c5cf
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientCsdlElementOrAttributeExpression.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;
+
+/**
+ * Groups dynamic expressions that may be provided using element notation or attribute notation.
+ */
+class AbstractClientCsdlElementOrAttributeExpression extends AbstractClientCsdlDynamicAnnotationExpression {
+
+ 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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.java
deleted file mode 100644
index 8e8440e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientDynamicAnnotationExpression.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;
-
-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.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)
-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/53b10f6b/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
deleted file mode 100644
index 5447de6..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientEdmDeserializer.java
+++ /dev/null
@@ -1,60 +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.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
-
-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/53b10f6b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.java
deleted file mode 100644
index 7bcbf90..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/AbstractClientElementOrAttributeExpression.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;
-
-/**
- * Groups dynamic expressions that may be provided using element notation or attribute notation.
- */
-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;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53b10f6b/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
deleted file mode 100644
index af274c5..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAction.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.CsdlAction;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ClientAction.ActionDeserializer.class)
-class ClientAction extends CsdlAction {
-
- 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/53b10f6b/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
deleted file mode 100644
index 2419332..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientActionImport.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.CsdlActionImport;
-
-import java.io.IOException;
-
-@JsonDeserialize(using = ClientActionImport.ActionImportDeserializer.class)
-class ClientActionImport extends CsdlActionImport {
-
- 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/53b10f6b/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
deleted file mode 100644
index a8a978a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ClientAnnotation.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 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.commons.api.edm.provider.CsdlAnnotation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(using = ClientAnnotation.AnnotationDeserializer.class)
-class ClientAnnotation extends CsdlAnnotation {
-
- private static final long serialVersionUID = 5464714417411058033L;
-
- static class AnnotationDeserializer extends AbstractClientEdmDeserializer<CsdlAnnotation> {
-
- @Override
- protected CsdlAnnotation 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;
- }
- }
-}