You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2014/03/16 05:26:15 UTC
[5/6] [OLINGO-191] change package name: part 2 of
1.edm.xml->edm.xml.shared, 2, edm.xml.v4->edm.xml
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..bdd6498
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferenceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.Annotation;
+import org.apache.olingo.client.api.edm.xml.v4.Include;
+import org.apache.olingo.client.api.edm.xml.v4.IncludeAnnotations;
+import org.apache.olingo.client.api.edm.xml.v4.Reference;
+import org.apache.olingo.client.core.edm.xml.shared.AbstractEdmItem;
+
+@JsonDeserialize(using = ReferenceDeserializer.class)
+public class ReferenceImpl extends AbstractEdmItem implements Reference {
+
+ private static final long serialVersionUID = -5600031479702563436L;
+
+ 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 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;
+ }
+
+ @Override
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..5e4242d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReferentialConstraintImpl.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint;
+
+public class ReferentialConstraintImpl extends AbstractAnnotatedEdmItem implements ReferentialConstraint {
+
+ private static final long serialVersionUID = -9182114558289778632L;
+
+ @JsonProperty(value = "Property", required = true)
+ private String property;
+
+ @JsonProperty(value = "ReferencedProperty", required = true)
+ private String referencedProperty;
+
+ @Override
+ public String getProperty() {
+ return property;
+ }
+
+ public void setProperty(final String property) {
+ this.property = property;
+ }
+
+ @Override
+ public String getReferencedProperty() {
+ return referencedProperty;
+ }
+
+ public void setReferencedProperty(final String referencedProperty) {
+ this.referencedProperty = referencedProperty;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeDeserializer.java
new file mode 100644
index 0000000..711cb5c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeDeserializer.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class ReturnTypeDeserializer extends AbstractEdmDeserializer<ReturnTypeImpl> {
+
+ @Override
+ protected ReturnTypeImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ 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())) {
+ returnType.setType(jp.nextTextValue());
+ } 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())) {
+ returnType.setSrid(jp.nextTextValue());
+ }
+ }
+ }
+
+ return returnType;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..c094aad
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/ReturnTypeImpl.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
+import org.apache.olingo.client.core.edm.xml.shared.AbstractEdmItem;
+
+@JsonDeserialize(using = ReturnTypeDeserializer.class)
+public class ReturnTypeImpl extends AbstractEdmItem implements ReturnType {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ private String type;
+
+ private boolean nullable = true;
+
+ private Integer maxLength;
+
+ private Integer precision;
+
+ private Integer scale;
+
+ private String srid;
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final Integer maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final Integer precision) {
+ this.precision = precision;
+ }
+
+ @Override
+ public Integer getScale() {
+ return scale;
+ }
+
+ public void setScale(final Integer scale) {
+ this.scale = scale;
+ }
+
+ @Override
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..db65e16
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SchemaImpl.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Collections;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.EnumType;
+import org.apache.olingo.client.api.edm.xml.v4.Action;
+import org.apache.olingo.client.api.edm.xml.v4.Annotation;
+import org.apache.olingo.client.api.edm.xml.v4.Annotations;
+import org.apache.olingo.client.api.edm.xml.v4.ComplexType;
+import org.apache.olingo.client.api.edm.xml.v4.EntityContainer;
+import org.apache.olingo.client.api.edm.xml.v4.EntityType;
+import org.apache.olingo.client.api.edm.xml.v4.Function;
+import org.apache.olingo.client.api.edm.xml.v4.Schema;
+import org.apache.olingo.client.api.edm.xml.v4.Term;
+import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
+import org.apache.olingo.client.core.edm.xml.shared.AbstractSchema;
+
+public class SchemaImpl extends AbstractSchema implements Schema {
+
+ private static final long serialVersionUID = 4453992249818796144L;
+
+ private final List<Action> actions = new ArrayList<Action>();
+
+ private final List<Annotations> annotationsList = new ArrayList<Annotations>();
+
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+ private final List<ComplexType> complexTypes = new ArrayList<ComplexType>();
+
+ private EntityContainer entityContainer;
+
+ private final List<EnumType> enumTypes = new ArrayList<EnumType>();
+
+ private final List<EntityType> entityTypes = new ArrayList<EntityType>();
+
+ private final List<Function> functions = new ArrayList<Function>();
+
+ private final List<Term> terms = new ArrayList<Term>();
+
+ private final List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
+
+ private Annotation annotation;
+
+ @Override
+ public List<Action> getActions() {
+ return actions;
+ }
+
+ @Override
+ public List<Action> getActions(final String name) {
+ return getAllByName(name, getActions());
+ }
+
+ @Override
+ public List<Annotations> getAnnotationsList() {
+ return annotationsList;
+ }
+
+ @Override
+ public Annotations getAnnotationsList(final String target) {
+ Annotations result = null;
+ for (Annotations annots : getAnnotationsList()) {
+ if (target.equals(annots.getTarget())) {
+ result = annots;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+ @Override
+ public List<Function> getFunctions() {
+ return functions;
+ }
+
+ @Override
+ public List<Function> getFunctions(final String name) {
+ return getAllByName(name, getFunctions());
+ }
+
+ @Override
+ public List<Term> getTerms() {
+ return terms;
+ }
+
+ @Override
+ public TypeDefinition getTypeDefinition(final String name) {
+ return getOneByName(name, getTypeDefinitions());
+ }
+
+ @Override
+ public List<TypeDefinition> getTypeDefinitions() {
+ return typeDefinitions;
+ }
+
+ @Override
+ public EntityContainer getEntityContainer() {
+ return entityContainer;
+ }
+
+ public void setEntityContainer(final EntityContainerImpl entityContainer) {
+ this.entityContainer = entityContainer;
+ }
+
+ @Override
+ public List<EntityContainer> getEntityContainers() {
+ return entityContainer == null
+ ? Collections.<EntityContainer>emptyList() : Collections.singletonList(entityContainer);
+ }
+
+ @Override
+ public EntityContainer getDefaultEntityContainer() {
+ return entityContainer;
+ }
+
+ @Override
+ public EntityContainer getEntityContainer(final String name) {
+ if (entityContainer != null && name.equals(entityContainer.getName())) {
+ return entityContainer;
+ }
+ return null;
+ }
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+
+ @Override
+ public List<EnumType> getEnumTypes() {
+ return enumTypes;
+ }
+
+ @Override
+ public ComplexType getComplexType(final String name) {
+ return (ComplexType) super.getComplexType(name);
+ }
+
+ @Override
+ public List<ComplexType> getComplexTypes() {
+ return complexTypes;
+ }
+
+ @Override
+ public EntityType getEntityType(final String name) {
+ return (EntityType) super.getEntityType(name);
+ }
+
+ @Override
+ public List<EntityType> getEntityTypes() {
+ return entityTypes;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonDeserializer.java
new file mode 100644
index 0000000..eb68142
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonDeserializer.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class SingletonDeserializer extends AbstractEdmDeserializer<SingletonImpl> {
+
+ @Override
+ protected SingletonImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ 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.setEntityType(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.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return singleton;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..9cf4278
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/SingletonImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.NavigationPropertyBinding;
+import org.apache.olingo.client.api.edm.xml.v4.Singleton;
+
+@JsonDeserialize(using = SingletonDeserializer.class)
+public class SingletonImpl extends AbstractAnnotatedEdmItem implements Singleton {
+
+ private static final long serialVersionUID = 941802518279658559L;
+
+ private String name;
+
+ private String entityType;
+
+ private final List<NavigationPropertyBinding> navigationPropertyBindings = new ArrayList<NavigationPropertyBinding>();
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getEntityType() {
+ return entityType;
+ }
+
+ public void setEntityType(final String entityType) {
+ this.entityType = entityType;
+ }
+
+ @Override
+ public List<NavigationPropertyBinding> getNavigationPropertyBindings() {
+ return navigationPropertyBindings;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermDeserializer.java
new file mode 100644
index 0000000..e59af0c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermDeserializer.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.edm.xml.v4.CSDLElement;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class TermDeserializer extends AbstractEdmDeserializer<TermImpl> {
+
+ @Override
+ protected TermImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ 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())) {
+ term.setSrid(jp.nextTextValue());
+ } else if ("AppliesTo".equals(jp.getCurrentName())) {
+ for (String split : StringUtils.split(jp.nextTextValue())) {
+ term.getAppliesTo().add(CSDLElement.valueOf(split));
+ }
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ term.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ }
+ }
+ }
+
+ return term;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..1858737
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TermImpl.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databind.annotation.JsonDeserialize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.CSDLElement;
+import org.apache.olingo.client.api.edm.xml.v4.Term;
+
+@JsonDeserialize(using = TermDeserializer.class)
+public class TermImpl extends AbstractAnnotatedEdmItem implements Term {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ private String name;
+
+ private String type;
+
+ private String baseTerm;
+
+ private String defaultValue;
+
+ private boolean nullable = true;
+
+ private Integer maxLength;
+
+ private Integer precision;
+
+ private Integer scale;
+
+ private String srid;
+
+ private final List<CSDLElement> appliesTo = new ArrayList<CSDLElement>();
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getBaseTerm() {
+ return baseTerm;
+ }
+
+ public void setBaseTerm(final String baseTerm) {
+ this.baseTerm = baseTerm;
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(final String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final Integer maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final Integer precision) {
+ this.precision = precision;
+ }
+
+ @Override
+ public Integer getScale() {
+ return scale;
+ }
+
+ public void setScale(final Integer scale) {
+ this.scale = scale;
+ }
+
+ @Override
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ @Override
+ public List<CSDLElement> getAppliesTo() {
+ return appliesTo;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionDeserializer.java
new file mode 100644
index 0000000..ae72691
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionDeserializer.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class TypeDefinitionDeserializer extends AbstractEdmDeserializer<TypeDefinitionImpl> {
+
+ @Override
+ protected TypeDefinitionImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ 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())) {
+ typeDefinition.setSrid(jp.nextTextValue());
+ } 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/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..45c8430
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/TypeDefinitionImpl.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databind.annotation.JsonDeserialize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.Annotation;
+import org.apache.olingo.client.api.edm.xml.v4.TypeDefinition;
+import org.apache.olingo.client.core.edm.xml.shared.AbstractEdmItem;
+
+@JsonDeserialize(using = TypeDefinitionDeserializer.class)
+public class TypeDefinitionImpl extends AbstractEdmItem implements TypeDefinition {
+
+ private static final long serialVersionUID = -5888231162358116515L;
+
+ private String name;
+
+ private String underlyingType;
+
+ private Integer maxLength;
+
+ private Integer precision;
+
+ private Integer scale;
+
+ private boolean unicode = true;
+
+ private String srid;
+
+ private final List<Annotation> annotations = new ArrayList<Annotation>();
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getUnderlyingType() {
+ return underlyingType;
+ }
+
+ public void setUnderlyingType(final String underlyingType) {
+ this.underlyingType = underlyingType;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final Integer maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final Integer precision) {
+ this.precision = precision;
+ }
+
+ @Override
+ public Integer getScale() {
+ return scale;
+ }
+
+ public void setScale(final Integer scale) {
+ this.scale = scale;
+ }
+
+ @Override
+ public boolean isUnicode() {
+ return unicode;
+ }
+
+ public void setUnicode(final boolean unicode) {
+ this.unicode = unicode;
+ }
+
+ @Override
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ @Override
+ public List<Annotation> getAnnotations() {
+ return annotations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/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
new file mode 100644
index 0000000..96cecb5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/XMLMetadataImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml;
+
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.Edmx;
+import org.apache.olingo.client.api.edm.xml.v4.Reference;
+import org.apache.olingo.client.api.edm.xml.v4.Schema;
+import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
+import org.apache.olingo.client.core.edm.xml.shared.AbstractXMLMetadata;
+
+public class XMLMetadataImpl extends AbstractXMLMetadata implements XMLMetadata {
+
+ private static final long serialVersionUID = -7765327879691528010L;
+
+ public XMLMetadataImpl(final EdmxImpl edmx) {
+ super(edmx);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<Schema> getSchemas() {
+ return (List<Schema>) super.getSchemas();
+ }
+
+ @Override
+ public Schema getSchema(final int index) {
+ return (Schema) super.getSchema(index);
+ }
+
+ @Override
+ public Schema getSchema(final String key) {
+ return (Schema) super.getSchema(key);
+ }
+
+ public List<Reference> getReferences() {
+ return ((Edmx) this.edmx).getReferences();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElOrAttrConstruct.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElOrAttrConstruct.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElOrAttrConstruct.java
new file mode 100644
index 0000000..aa836dc
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AbstractElOrAttrConstruct.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 AbstractElOrAttrConstruct extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = 5503275111425750339L;
+
+ 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/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotatedDynExprConstruct.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotatedDynExprConstruct.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotatedDynExprConstruct.java
new file mode 100644
index 0000000..e147b6b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotatedDynExprConstruct.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 org.apache.olingo.client.api.edm.xml.v4.AnnotatedEdmItem;
+import org.apache.olingo.client.api.edm.xml.v4.Annotation;
+
+abstract class AnnotatedDynExprConstruct extends DynExprConstructImpl implements AnnotatedEdmItem {
+
+ private static final long serialVersionUID = -8117155475397749038L;
+
+ private Annotation annotation;
+
+ @Override
+ public Annotation getAnnotation() {
+ return annotation;
+ }
+
+ public void setAnnotation(final Annotation annotation) {
+ this.annotation = annotation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPath.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPath.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPath.java
new file mode 100644
index 0000000..8377b5b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/AnnotationPath.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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;
+
+public class AnnotationPath extends AbstractElOrAttrConstruct {
+
+ private static final long serialVersionUID = 6198019768659098819L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Apply.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Apply.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Apply.java
new file mode 100644
index 0000000..a3962d8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Apply.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+@JsonDeserialize(using = ApplyDeserializer.class)
+public class Apply extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6198019768659098819L;
+
+ public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";
+
+ public static final String CANONICAL_FUNCTION_FILLURITEMPLATE = "odata.fillUriTemplate";
+
+ public static final String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
+
+ private String function;
+
+ private final List<ExprConstruct> parameters = new ArrayList<ExprConstruct>();
+
+ public String getFunction() {
+ return function;
+ }
+
+ public void setFunction(final String function) {
+ this.function = function;
+ }
+
+ public List<ExprConstruct> getParameters() {
+ return parameters;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyDeserializer.java
new file mode 100644
index 0000000..641c1a9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ApplyDeserializer.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class ApplyDeserializer extends AbstractEdmDeserializer<Apply> {
+
+ @Override
+ protected Apply doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Apply apply = new Apply();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Function".equals(jp.getCurrentName())) {
+ apply.setFunction(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ apply.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else if (isAnnotationConstExprConstruct(jp)) {
+ apply.getParameters().add(parseAnnotationConstExprConstruct(jp));
+ } else {
+ apply.getParameters().add(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return apply;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Cast.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Cast.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Cast.java
new file mode 100644
index 0000000..88471ed
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Cast.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.math.BigInteger;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = CastDeserializer.class)
+public class Cast extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = -7836626668653004926L;
+
+ private String type;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private String srid;
+
+ private DynExprConstruct value;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastDeserializer.java
new file mode 100644
index 0000000..03101af
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CastDeserializer.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class CastDeserializer extends AbstractEdmDeserializer<Cast> {
+
+ @Override
+ protected Cast doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Cast cast = new Cast();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ cast.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ cast.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ cast.setMaxLength(jp.nextTextValue());
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ cast.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ cast.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ cast.setSrid(jp.nextTextValue());
+ } else {
+ cast.setValue(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return cast;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Collection.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Collection.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Collection.java
new file mode 100644
index 0000000..2063aab
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/Collection.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+@JsonDeserialize(using = CollectionDeserializer.class)
+public class Collection extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = -4975881520695477686L;
+
+ private final List<ExprConstruct> items = new ArrayList<ExprConstruct>();
+
+ public List<ExprConstruct> getItems() {
+ return items;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionDeserializer.java
new file mode 100644
index 0000000..1940492
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/CollectionDeserializer.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class CollectionDeserializer extends AbstractEdmDeserializer<Collection> {
+
+ @Override
+ protected Collection doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final Collection collection = new Collection();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if (isAnnotationConstExprConstruct(jp)) {
+ collection.getItems().add(parseAnnotationConstExprConstruct(jp));
+ } else {
+ collection.getItems().add(jp.readValueAs( DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return collection;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstExprConstructImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstExprConstructImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstExprConstructImpl.java
new file mode 100644
index 0000000..ec8b711
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ConstExprConstructImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.client.api.edm.xml.v4.annotation.ConstExprConstruct;
+
+public class ConstExprConstructImpl extends ExprConstructImpl implements ConstExprConstruct {
+
+ private static final long serialVersionUID = 2250072064504668969L;
+
+ private Type type;
+
+ private String value;
+
+ @Override
+ public Type getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructDeserializer.java
new file mode 100644
index 0000000..c59a6aa
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructDeserializer.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.ClassUtils;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class DynExprConstructDeserializer extends AbstractEdmDeserializer<DynExprConstructImpl> {
+
+ private static final String[] EL_OR_ATTR = { AnnotationPath.class.getSimpleName(), Path.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 AbstractElOrAttrConstruct getElOrAttrInstance(final String simpleClassName) throws JsonParseException {
+ try {
+ @SuppressWarnings("unchecked")
+ Class<? extends AbstractElOrAttrConstruct> elOrAttrClass =
+ (Class<? extends AbstractElOrAttrConstruct>) ClassUtils.getClass(
+ getClass().getPackage().getName() + "." + simpleClassName);
+ return elOrAttrClass.newInstance();
+ } catch (Exception e) {
+ throw new JsonParseException("Could not instantiate " + simpleClassName, JsonLocation.NA, e);
+ }
+ }
+
+ private ExprConstructImpl parseConstOrEnumExprConstruct(final JsonParser jp) throws IOException {
+ ExprConstructImpl result;
+ if (isAnnotationConstExprConstruct(jp)) {
+ result = parseAnnotationConstExprConstruct(jp);
+ } else {
+ result = jp.readValueAs( DynExprConstructImpl.class);
+ }
+ jp.nextToken();
+
+ return result;
+ }
+
+ @Override
+ protected DynExprConstructImpl doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ DynExprConstructImpl construct = null;
+
+ if (DynExprSingleParamOp.Type.fromString(jp.getCurrentName()) != null) {
+ final DynExprSingleParamOp dynExprSingleParamOp = new DynExprSingleParamOp();
+ dynExprSingleParamOp.setType(DynExprSingleParamOp.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ jp.nextToken();
+ dynExprSingleParamOp.setExpression(jp.readValueAs( DynExprConstructImpl.class));
+
+ construct = dynExprSingleParamOp;
+ } else if (DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()) != null) {
+ final DynExprDoubleParamOp dynExprDoubleParamOp = new DynExprDoubleParamOp();
+ dynExprDoubleParamOp.setType(DynExprDoubleParamOp.Type.fromString(jp.getCurrentName()));
+
+ jp.nextToken();
+ jp.nextToken();
+ dynExprDoubleParamOp.setLeft(jp.readValueAs( DynExprConstructImpl.class));
+ dynExprDoubleParamOp.setRight(jp.readValueAs( DynExprConstructImpl.class));
+
+ construct = dynExprDoubleParamOp;
+ } else if (ArrayUtils.contains(EL_OR_ATTR, jp.getCurrentName())) {
+ final AbstractElOrAttrConstruct elOrAttr = getElOrAttrInstance(jp.getCurrentName());
+ elOrAttr.setValue(jp.nextTextValue());
+
+ construct = elOrAttr;
+ } else if (APPLY.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Apply.class);
+ } else if (CAST.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Cast.class);
+ } else if (COLLECTION.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Collection.class);
+ } else if (IF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ jp.nextToken();
+
+ final If _if = new If();
+ _if.setGuard(parseConstOrEnumExprConstruct(jp));
+ _if.setThen(parseConstOrEnumExprConstruct(jp));
+ _if.setElse(parseConstOrEnumExprConstruct(jp));
+
+ construct = _if;
+ } else if (IS_OF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( IsOf.class);
+ } else if (LABELED_ELEMENT.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( LabeledElement.class);
+ } else if (NULL.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Null.class);
+ } else if (RECORD.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( Record.class);
+ } else if (URL_REF.equals(jp.getCurrentName())) {
+ jp.nextToken();
+ construct = jp.readValueAs( UrlRef.class);
+ }
+
+ return construct;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructImpl.java
new file mode 100644
index 0000000..424aeaf
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprConstructImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = DynExprConstructDeserializer.class)
+public abstract class DynExprConstructImpl extends ExprConstructImpl implements DynExprConstruct {
+
+ private static final long serialVersionUID = -642012862023177349L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprDoubleParamOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprDoubleParamOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprDoubleParamOp.java
new file mode 100644
index 0000000..dfb1e00
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprDoubleParamOp.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+public class DynExprDoubleParamOp extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = -7974475975925167731L;
+
+ public static enum Type {
+
+ And,
+ Or;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ for (Type type : values()) {
+ if (value.equals(type.name())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+ }
+
+ private Type type;
+
+ private DynExprConstruct left;
+
+ private DynExprConstruct right;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public DynExprConstruct getLeft() {
+ return left;
+ }
+
+ public void setLeft(final DynExprConstruct left) {
+ this.left = left;
+ }
+
+ public DynExprConstruct getRight() {
+ return right;
+ }
+
+ public void setRight(final DynExprConstruct right) {
+ this.right = right;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprSingleParamOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprSingleParamOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprSingleParamOp.java
new file mode 100644
index 0000000..2ca4d76
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/DynExprSingleParamOp.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+public class DynExprSingleParamOp extends DynExprConstructImpl {
+
+ private static final long serialVersionUID = -7974475975925167731L;
+
+ public static enum Type {
+
+ Not,
+ Eq,
+ Ne,
+ Gt,
+ Ge,
+ Lt,
+ Le;
+
+ public static Type fromString(final String value) {
+ Type result = null;
+ for (Type type : values()) {
+ if (value.equals(type.name())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ }
+
+ private Type type;
+
+ private DynExprConstruct expression;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public DynExprConstruct getExpression() {
+ return expression;
+ }
+
+ public void setExpression(final DynExprConstruct expression) {
+ this.expression = expression;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ExprConstructImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ExprConstructImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ExprConstructImpl.java
new file mode 100644
index 0000000..6e13954
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/ExprConstructImpl.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+import org.apache.olingo.client.core.edm.xml.shared.AbstractEdmItem;
+
+public abstract class ExprConstructImpl extends AbstractEdmItem implements ExprConstruct {
+
+ private static final long serialVersionUID = 7108626008005050492L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/If.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/If.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/If.java
new file mode 100644
index 0000000..1b3539f
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/If.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.ExprConstruct;
+
+public class If extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6752952406406218936L;
+
+ private ExprConstruct guard;
+
+ private ExprConstruct _then;
+
+ private ExprConstruct _else;
+
+ public ExprConstruct getGuard() {
+ return guard;
+ }
+
+ public void setGuard(final ExprConstruct guard) {
+ this.guard = guard;
+ }
+
+ public ExprConstruct getThen() {
+ return _then;
+ }
+
+ public void setThen(final ExprConstruct _then) {
+ this._then = _then;
+ }
+
+ public ExprConstruct getElse() {
+ return _else;
+ }
+
+ public void setElse(final ExprConstruct _else) {
+ this._else = _else;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOf.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOf.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOf.java
new file mode 100644
index 0000000..8ea8072
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOf.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import java.math.BigInteger;
+
+import org.apache.olingo.client.api.edm.xml.v4.annotation.DynExprConstruct;
+
+@JsonDeserialize(using = IsOfDeserializer.class)
+public class IsOf extends AnnotatedDynExprConstruct {
+
+ private static final long serialVersionUID = 6958304670385303776L;
+
+ private String type;
+
+ private String maxLength;
+
+ private BigInteger precision;
+
+ private BigInteger scale;
+
+ private String srid;
+
+ private DynExprConstruct value;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public DynExprConstruct getValue() {
+ return value;
+ }
+
+ public void setValue(final DynExprConstruct value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/87c3bcb2/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfDeserializer.java
new file mode 100644
index 0000000..633e803
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/annotation/IsOfDeserializer.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.edm.xml.annotation;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+import org.apache.olingo.client.core.edm.xml.AnnotationImpl;
+import org.apache.olingo.client.core.op.impl.AbstractEdmDeserializer;
+
+public class IsOfDeserializer extends AbstractEdmDeserializer<IsOf> {
+
+ @Override
+ protected IsOf doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final IsOf isof = new IsOf();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Type".equals(jp.getCurrentName())) {
+ isof.setType(jp.nextTextValue());
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ isof.setAnnotation(jp.readValueAs(AnnotationImpl.class));
+ } else if ("MaxLength".equals(jp.getCurrentName())) {
+ isof.setMaxLength(jp.nextTextValue());
+ } else if ("Precision".equals(jp.getCurrentName())) {
+ isof.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("Scale".equals(jp.getCurrentName())) {
+ isof.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
+ } else if ("SRID".equals(jp.getCurrentName())) {
+ isof.setSrid(jp.nextTextValue());
+ } else {
+ isof.setValue(jp.readValueAs(DynExprConstructImpl.class));
+ }
+ }
+ }
+
+ return isof;
+ }
+
+}