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/30 17:02:16 UTC
[03/50] [abbrv] olingo-odata4 git commit: [OLINGO-564] Renamed client
edm classes
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;
+ }
+}