You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/03/24 09:45:42 UTC
[5/9] [OLINGO-200] Moving Atom and JSON (de)serializer to commons
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
deleted file mode 100644
index 348015e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONEntrySerializer.java
+++ /dev/null
@@ -1,120 +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.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Link;
-import org.apache.olingo.client.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-
-/**
- * Writes out JSON string from an entry.
- */
-public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
-
- @Override
- protected void doSerialize(final JSONEntryImpl entry, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
-
- jgen.writeStartObject();
-
- if (entry.getMetadata() != null) {
- jgen.writeStringField(Constants.JSON_METADATA, entry.getMetadata().toASCIIString());
- }
- if (entry.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, entry.getId());
- }
-
- final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
-
- for (Link link : entry.getNavigationLinks()) {
- ODataLinkType type = null;
- try {
- type = ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
- } catch (IllegalArgumentException e) {
- // ignore
- }
-
- if (type == ODataLinkType.ENTITY_SET_NAVIGATION) {
- final List<String> uris;
- if (entitySetLinks.containsKey(link.getTitle())) {
- uris = entitySetLinks.get(link.getTitle());
- } else {
- uris = new ArrayList<String>();
- entitySetLinks.put(link.getTitle(), uris);
- }
- uris.add(link.getHref());
- } else {
- if (StringUtils.isNotBlank(link.getHref())) {
- jgen.writeStringField(link.getTitle() + Constants.JSON_BIND_LINK_SUFFIX, link.getHref());
- }
- }
-
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- } else if (link.getInlineFeed() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
- jgen.writeObject(subEntry);
- }
- jgen.writeEndArray();
- }
- }
- for (Map.Entry<String, List<String>> entitySetLink : entitySetLinks.entrySet()) {
- jgen.writeArrayFieldStart(entitySetLink.getKey() + Constants.JSON_BIND_LINK_SUFFIX);
- for (String uri : entitySetLink.getValue()) {
- jgen.writeString(uri);
- }
- jgen.writeEndArray();
- }
-
- for (Link link : entry.getMediaEditLinks()) {
- if (link.getTitle() == null) {
- jgen.writeStringField(Constants.JSON_MEDIAEDIT_LINK, link.getHref());
- }
-
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- }
- if (link.getInlineFeed() != null) {
- jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
- jgen.writeObject(subEntry);
- }
- jgen.writeEndArray();
- }
- }
-
- for (Property property : entry.getProperties()) {
- property(jgen, property, property.getName());
- }
-
- jgen.writeEndObject();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java
deleted file mode 100644
index a73fb05..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorBundle.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * This class represents a bundle for an OData error returned as JSON.
- */
-public class JSONErrorBundle extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -4784910226259754450L;
-
- @JsonProperty("odata.error")
- private JSONErrorImpl error;
-
- /**
- * Gets error.
- *
- * @return OData error object.
- */
- public JSONErrorImpl getError() {
- return error;
- }
-
- /**
- * Sets error.
- *
- * @param error OData error object.
- */
- public void setError(final JSONErrorImpl error) {
- this.error = error;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
deleted file mode 100644
index 5305695..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONErrorImpl.java
+++ /dev/null
@@ -1,237 +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.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class JSONErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- /**
- * Error message.
- */
- public static class Message extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- private String value;
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
-
- /**
- * Gets message.
- *
- * @return message.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets message.
- *
- * @param value message.
- */
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private String message;
-
- private String type;
-
- private String stacktrace;
-
- private InnerError internalexception;
-
- /**
- * Gets inner message.
- *
- * @return message.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets inner message.
- *
- * @param message message.
- */
- public void setMessage(final String message) {
- this.message = message;
- }
-
- /**
- * Gets type.
- *
- * @return type.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets type.
- *
- * @param type type.
- */
- public void setType(final String type) {
- this.type = type;
- }
-
- /**
- * Gets stack-trace.
- *
- * @return stack-trace.
- */
- public String getStacktrace() {
- return stacktrace;
- }
-
- /**
- * Sets stack-trace.
- *
- * @param stacktrace stack-trace.
- */
- public void setStacktrace(final String stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-
- private String code;
-
- @JsonProperty(value = "message")
- private Message message;
-
- @JsonProperty(value = "innererror", required = false)
- private InnerError innererror;
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java
deleted file mode 100644
index 3667fea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedDeserializer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import org.apache.olingo.client.api.Constants;
-
-/**
- * Reads JSON string into a feed.
- * <br/>
- * If metadata information is available, the corresponding entry fields and content will be populated.
- */
-public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl> {
-
- @Override
- protected JSONFeedImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
- if (!tree.has(Constants.JSON_VALUE)) {
- return null;
- }
-
- final JSONFeedImpl feed = new JSONFeedImpl();
-
- if (tree.hasNonNull(Constants.JSON_METADATA)) {
- feed.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
- }
- if (tree.hasNonNull(Constants.JSON_COUNT)) {
- feed.setCount(tree.get(Constants.JSON_COUNT).asInt());
- }
- if (tree.hasNonNull(Constants.JSON_NEXT_LINK)) {
- feed.setNext(URI.create(tree.get(Constants.JSON_NEXT_LINK).textValue()));
- }
-
- if (tree.hasNonNull(Constants.JSON_VALUE)) {
- for (final Iterator<JsonNode> itor = tree.get(Constants.JSON_VALUE).iterator(); itor.hasNext();) {
- feed.getEntries().add(itor.next().traverse(parser.getCodec()).readValueAs(JSONEntryImpl.class));
- }
- }
-
- return feed;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java
deleted file mode 100644
index 271ef3d..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedImpl.java
+++ /dev/null
@@ -1,113 +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.data;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.uri.SegmentType;
-
-/**
- * List of entries, represented via JSON.
- *
- * @see JSONEntry
- */
-@JsonDeserialize(using = JSONFeedDeserializer.class)
-@JsonSerialize(using = JSONFeedSerializer.class)
-public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
-
- private static final long serialVersionUID = -3576372289800799417L;
-
- private String id;
-
- private URI metadata;
-
- private Integer count;
-
- private final List<Entry> entries = new ArrayList<Entry>();
-
- private String next;
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (metadata != null) {
- final String metadataURI = getMetadata().toASCIIString();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
- }
-
- return baseURI;
- }
-
- /**
- * Gets the metadata URI.
- *
- * @return the metadata URI
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- @Override
- public Integer getCount() {
- return count;
- }
-
- @Override
- public void setCount(final Integer count) {
- this.count = count;
- }
-
- @Override
- public List<Entry> getEntries() {
- return entries;
- }
-
- @Override
- public void setNext(final URI next) {
- this.next = next.toASCIIString();
- }
-
- @Override
- public URI getNext() {
- return next == null ? null : URI.create(next);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java
deleted file mode 100644
index f89303e..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONFeedSerializer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import java.io.IOException;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Entry;
-
-public class JSONFeedSerializer extends AbstractJsonSerializer<JSONFeedImpl> {
-
- @Override
- protected void doSerialize(final JSONFeedImpl feed, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
-
- jgen.writeStartObject();
-
- if (feed.getMetadata() != null) {
- jgen.writeStringField(Constants.JSON_METADATA, feed.getMetadata().toASCIIString());
- }
- if (feed.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, feed.getId());
- }
- if (feed.getCount() != null) {
- jgen.writeNumberField(Constants.JSON_COUNT, feed.getCount());
- }
- if (feed.getNext() != null) {
- jgen.writeStringField(Constants.JSON_NEXT_LINK, feed.getNext().toASCIIString());
- }
-
- jgen.writeArrayFieldStart(Constants.JSON_VALUE);
- for (Entry entry : feed.getEntries()) {
- jgen.writeObject(entry);
- }
-
- jgen.writeEndArray();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
deleted file mode 100644
index c58ff66..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueDeserializer.java
+++ /dev/null
@@ -1,274 +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.data;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.GeoUtils;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class JSONGeoValueDeserializer {
-
- private final ODataServiceVersion version;
-
- public JSONGeoValueDeserializer(final ODataServiceVersion version) {
- this.version = version;
- }
-
- private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
- Point point = null;
-
- if (itor.hasNext()) {
- point = new Point(GeoUtils.getDimension(type), crs);
- try {
- point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- point.setY(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException("While deserializing point coordinates as double", e);
- }
- }
-
- return point;
- }
-
- private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- MultiPoint multiPoint = null;
-
- if (itor.hasNext()) {
- final List<Point> points = new ArrayList<Point>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, crs));
- }
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, points);
- } else {
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
- }
-
- return multiPoint;
- }
-
- private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- LineString lineString = null;
-
- if (itor.hasNext()) {
- final List<Point> points = new ArrayList<Point>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, crs));
- }
- lineString = new LineString(GeoUtils.getDimension(type), crs, points);
- } else {
- lineString = new LineString(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
- }
-
- return lineString;
- }
-
- private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- MultiLineString multiLineString = null;
-
- if (itor.hasNext()) {
- final List<LineString> lineStrings = new ArrayList<LineString>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mlsItor = itor.next().elements();
- lineStrings.add(lineString(mlsItor, type, crs));
- }
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
- } else {
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, Collections.<LineString>emptyList());
- }
-
- return multiLineString;
- }
-
- private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- List<Point> extPoints = null;
- if (itor.hasNext()) {
- final Iterator<JsonNode> extItor = itor.next().elements();
- if (extItor.hasNext()) {
- extPoints = new ArrayList<Point>();
- while (extItor.hasNext()) {
- final Iterator<JsonNode> mpItor = extItor.next().elements();
- extPoints.add(point(mpItor, type, crs));
- }
- }
- }
-
- List<Point> intPoints = null;
- if (itor.hasNext()) {
- final Iterator<JsonNode> intItor = itor.next().elements();
- if (intItor.hasNext()) {
- intPoints = new ArrayList<Point>();
- while (intItor.hasNext()) {
- final Iterator<JsonNode> mpItor = intItor.next().elements();
- intPoints.add(point(mpItor, type, crs));
- }
- }
- }
-
- return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
- }
-
- private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- MultiPolygon multiPolygon = null;
-
- if (itor.hasNext()) {
- final List<Polygon> polygons = new ArrayList<Polygon>();
- while (itor.hasNext()) {
- final Iterator<JsonNode> mpItor = itor.next().elements();
- polygons.add(polygon(mpItor, type, crs));
- }
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
- } else {
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, Collections.<Polygon>emptyList());
- }
-
- return multiPolygon;
- }
-
- private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
- GeospatialCollection collection = null;
-
- if (itor.hasNext()) {
- final List<Geospatial> geospatials = new ArrayList<Geospatial>();
-
- while (itor.hasNext()) {
- final JsonNode geo = itor.next();
- final String collItemType = geo.get(Constants.ATTR_TYPE).asText();
- final String callAsType;
- if (EdmPrimitiveTypeKind.GeographyCollection.name().equals(collItemType)
- || EdmPrimitiveTypeKind.GeometryCollection.name().equals(collItemType)) {
-
- callAsType = collItemType;
- } else {
- callAsType = (type == EdmPrimitiveTypeKind.GeographyCollection ? "Geography" : "Geometry")
- + collItemType;
- }
-
- geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
- }
-
- collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
- } else {
- collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, Collections.<Geospatial>emptyList());
- }
-
- return collection;
- }
-
- public Geospatial deserialize(final JsonNode node, final EdmTypeInfo typeInfo) {
- final EdmPrimitiveTypeKind actualType;
- if ((typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geography
- || typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Geometry)
- && node.has(Constants.ATTR_TYPE)) {
-
- String nodeType = node.get(Constants.ATTR_TYPE).asText();
- if (nodeType.startsWith("Geo")) {
- final int yIdx = nodeType.indexOf('y');
- nodeType = nodeType.substring(yIdx + 1);
- }
- actualType = EdmPrimitiveTypeKind.valueOfFQN(version, typeInfo.getFullQualifiedName().toString() + nodeType);
- } else {
- actualType = typeInfo.getPrimitiveTypeKind();
- }
-
- final Iterator<JsonNode> cooItor = node.has(Constants.JSON_COORDINATES)
- ? node.get(Constants.JSON_COORDINATES).elements()
- : Collections.<JsonNode>emptyList().iterator();
-
- String crs = null;
- if (node.has(Constants.JSON_CRS)) {
- crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1];
- }
-
- Geospatial value = null;
- switch (actualType) {
- case GeographyPoint:
- case GeometryPoint:
- value = point(cooItor, actualType, crs);
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- value = multipoint(cooItor, actualType, crs);
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- value = lineString(cooItor, actualType, crs);
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- value = multiLineString(cooItor, actualType, crs);
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- value = polygon(cooItor, actualType, crs);
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- value = multiPolygon(cooItor, actualType, crs);
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
- break;
-
- default:
- }
-
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
deleted file mode 100644
index 4794b01..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONGeoValueSerializer.java
+++ /dev/null
@@ -1,183 +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.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import java.io.IOException;
-import java.util.Iterator;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.ComposedGeospatial;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-
-class JSONGeoValueSerializer {
-
- private void crs(final JsonGenerator jgen, final String crs) throws IOException {
- jgen.writeObjectFieldStart(Constants.JSON_CRS);
- jgen.writeStringField(Constants.ATTR_TYPE, Constants.JSON_NAME);
- jgen.writeObjectFieldStart(Constants.PROPERTIES);
- jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + crs);
- jgen.writeEndObject();
- jgen.writeEndObject();
- }
-
- private void point(final JsonGenerator jgen, final Point point) throws IOException {
- try {
- jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getX(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- jgen.writeNumber(EdmDouble.getInstance().valueToString(point.getY(), null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null));
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException("While serializing point coordinates as double", e);
- }
- }
-
- private void multipoint(final JsonGenerator jgen, final MultiPoint multiPoint) throws IOException {
- for (final Iterator<Point> itor = multiPoint.iterator(); itor.hasNext();) {
- jgen.writeStartArray();
- point(jgen, itor.next());
- jgen.writeEndArray();
- }
- }
-
- private void lineString(final JsonGenerator jgen, final ComposedGeospatial<Point> lineString) throws IOException {
- for (final Iterator<Point> itor = lineString.iterator(); itor.hasNext();) {
- jgen.writeStartArray();
- point(jgen, itor.next());
- jgen.writeEndArray();
- }
- }
-
- private void multiLineString(final JsonGenerator jgen, final MultiLineString multiLineString) throws IOException {
- for (final Iterator<LineString> itor = multiLineString.iterator(); itor.hasNext();) {
- jgen.writeStartArray();
- lineString(jgen, itor.next());
- jgen.writeEndArray();
- }
- }
-
- private void polygon(final JsonGenerator jgen, final Polygon polygon) throws IOException {
- if (!polygon.getExterior().isEmpty()) {
- jgen.writeStartArray();
- lineString(jgen, polygon.getExterior());
- jgen.writeEndArray();
- }
- if (!polygon.getInterior().isEmpty()) {
- jgen.writeStartArray();
- lineString(jgen, polygon.getInterior());
- jgen.writeEndArray();
- }
- }
-
- private void multiPolygon(final JsonGenerator jgen, final MultiPolygon multiPolygon) throws IOException {
- for (final Iterator<Polygon> itor = multiPolygon.iterator(); itor.hasNext();) {
- final Polygon polygon = itor.next();
- jgen.writeStartArray();
- polygon(jgen, polygon);
- jgen.writeEndArray();
- }
- }
-
- private void collection(final JsonGenerator jgen, final GeospatialCollection collection) throws IOException {
- jgen.writeArrayFieldStart(Constants.JSON_GEOMETRIES);
- for (final Iterator<Geospatial> itor = collection.iterator(); itor.hasNext();) {
- jgen.writeStartObject();
- serialize(jgen, itor.next());
- jgen.writeEndObject();
- }
- jgen.writeEndArray();
- }
-
- public void serialize(final JsonGenerator jgen, final Geospatial value) throws IOException {
- if (value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeographyCollection)
- || value.getEdmPrimitiveTypeKind().equals(EdmPrimitiveTypeKind.GeometryCollection)) {
-
- jgen.writeStringField(Constants.ATTR_TYPE, EdmPrimitiveTypeKind.GeometryCollection.name());
- } else {
- final int yIdx = value.getEdmPrimitiveTypeKind().name().indexOf('y');
- final String itemType = value.getEdmPrimitiveTypeKind().name().substring(yIdx + 1);
- jgen.writeStringField(Constants.ATTR_TYPE, itemType);
- }
-
- switch (value.getEdmPrimitiveTypeKind()) {
- case GeographyPoint:
- case GeometryPoint:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- point(jgen, (Point) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiPoint:
- case GeometryMultiPoint:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multipoint(jgen, (MultiPoint) value);
- jgen.writeEndArray();
- break;
-
- case GeographyLineString:
- case GeometryLineString:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- lineString(jgen, (LineString) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiLineString:
- case GeometryMultiLineString:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multiLineString(jgen, (MultiLineString) value);
- jgen.writeEndArray();
- break;
-
- case GeographyPolygon:
- case GeometryPolygon:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- polygon(jgen, (Polygon) value);
- jgen.writeEndArray();
- break;
-
- case GeographyMultiPolygon:
- case GeometryMultiPolygon:
- jgen.writeArrayFieldStart(Constants.JSON_COORDINATES);
- multiPolygon(jgen, (MultiPolygon) value);
- jgen.writeEndArray();
- break;
-
- case GeographyCollection:
- case GeometryCollection:
- collection(jgen, (GeospatialCollection) value);
- break;
-
- default:
- }
-
- if (value.getCrs() != null) {
- crs(jgen, value.getCrs());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java
deleted file mode 100644
index 172498a..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyDeserializer.java
+++ /dev/null
@@ -1,71 +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.data;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import java.io.IOException;
-import java.net.URI;
-import org.apache.olingo.client.api.Constants;
-
-/**
- * Parse JSON string into <tt>JSONPropertyImpl</tt>.
- *
- * @see JSONPropertyImpl
- */
-public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPropertyImpl> {
-
- @Override
- protected JSONPropertyImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
-
- final JSONPropertyImpl property = new JSONPropertyImpl();
-
- if (tree.hasNonNull(Constants.JSON_METADATA)) {
- property.setMetadata(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
- tree.remove(Constants.JSON_METADATA);
- }
-
- if (property.getMetadata() != null) {
- final String metadataURI = property.getMetadata().toASCIIString();
- final int dashIdx = metadataURI.lastIndexOf('#');
- if (dashIdx != -1) {
- property.setType(metadataURI.substring(dashIdx + 1));
- }
- }
-
- if (tree.has(Constants.JSON_TYPE) && property.getType() == null) {
- property.setType(tree.get(Constants.JSON_TYPE).asText());
- }
-
- if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
- property.setValue(new NullValueImpl());
- }
-
- if (property.getValue() == null) {
- value(property, tree.has(Constants.JSON_VALUE) ? tree.get(Constants.JSON_VALUE) : tree);
- }
-
- return property;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java
deleted file mode 100644
index 1002d3b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertyImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.net.URI;
-
-/**
- * A single property (primitive, complex or collection) represented via JSON.
- */
-@JsonSerialize(using = JSONPropertySerializer.class)
-@JsonDeserialize(using = JSONPropertyDeserializer.class)
-public class JSONPropertyImpl extends AbstractPropertyImpl {
-
- private static final long serialVersionUID = 553414431536637434L;
-
- private URI metadata;
-
- /**
- * Gets metadata URI.
- *
- * @return metadata URI.
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java
deleted file mode 100644
index 21e017b..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONPropertySerializer.java
+++ /dev/null
@@ -1,59 +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.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import java.io.IOException;
-import org.apache.olingo.client.api.Constants;
-import org.apache.olingo.client.api.data.Property;
-
-/**
- * Writes out JSON string from <tt>JSONPropertyImpl</tt>.
- *
- * @see JSONPropertyImpl
- */
-public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyImpl> {
-
- @Override
- protected void doSerialize(final JSONPropertyImpl property, final JsonGenerator jgen,
- final SerializerProvider provider) throws IOException, JsonProcessingException {
-
- jgen.writeStartObject();
-
- if (property.getMetadata() != null) {
- jgen.writeStringField(Constants.JSON_METADATA, property.getMetadata().toASCIIString());
- }
-
- if (property.getValue().isNull()) {
- jgen.writeBooleanField(Constants.JSON_NULL, true);
- } else if (property.getValue().isSimple()) {
- jgen.writeStringField(Constants.JSON_VALUE, property.getValue().asSimple().get());
- } else if (property.getValue().isGeospatial() || property.getValue().isCollection()) {
- property(jgen, property, Constants.JSON_VALUE);
- } else if (property.getValue().isComplex()) {
- for (Property cproperty : property.getValue().asComplex().get()) {
- property(jgen, cproperty, cproperty.getName());
- }
- }
-
- jgen.writeEndObject();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
index 4a6ebc0..143aed8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
@@ -28,8 +28,9 @@ import java.io.IOException;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.data.ODataJacksonDeserializer;
public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<AbstractServiceDocument> {
@@ -39,7 +40,7 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
- final AbstractServiceDocument serviceDocument = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractServiceDocument serviceDocument = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java
deleted file mode 100644
index 2bba504..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/LinkImpl.java
+++ /dev/null
@@ -1,112 +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.data;
-
-import org.apache.olingo.client.api.data.Entry;
-import org.apache.olingo.client.api.data.Feed;
-import org.apache.olingo.client.api.data.Link;
-
-public class LinkImpl extends AbstractPayloadObject implements Link {
-
- private static final long serialVersionUID = -3449344217160035501L;
-
- private String title;
-
- private String rel;
-
- private String href;
-
- private String type;
-
- private String mediaETag;
-
- private Entry entry;
-
- private Feed feed;
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- public void setTitle(final String title) {
- this.title = title;
- }
-
- @Override
- public String getRel() {
- return rel;
- }
-
- @Override
- public void setRel(final String rel) {
- this.rel = rel;
- }
-
- @Override
- public String getHref() {
- return href;
- }
-
- @Override
- public void setHref(final String href) {
- this.href = href;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public String getMediaETag() {
- return mediaETag;
- }
-
- @Override
- public void setMediaETag(final String mediaETag) {
- this.mediaETag = mediaETag;
- }
-
- @Override
- public Entry getInlineEntry() {
- return entry;
- }
-
- @Override
- public void setInlineEntry(final Entry entry) {
- this.entry = entry;
- }
-
- @Override
- public Feed getInlineFeed() {
- return feed;
- }
-
- @Override
- public void setInlineFeed(final Feed feed) {
- this.feed = feed;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java
deleted file mode 100644
index 83e6785..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/NullValueImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.client.core.data;
-
-import org.apache.olingo.client.api.data.NullValue;
-
-public class NullValueImpl extends AbstractValue implements NullValue {
-
- @Override
- public boolean isNull() {
- return true;
- }
-
- @Override
- public Void get() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
deleted file mode 100644
index 49c85fb..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonDeserializer.java
+++ /dev/null
@@ -1,45 +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.data;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-
-import java.io.IOException;
-
-import org.apache.olingo.client.api.CommonODataClient;
-
-abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
-
- protected CommonODataClient client;
-
- protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
- throws IOException, JsonProcessingException;
-
- @Override
- public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- client = (CommonODataClient) ctxt.findInjectableValue(CommonODataClient.class.getName(), null, null);
- return doDeserialize(jp, ctxt);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
deleted file mode 100644
index 4638c18..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/ODataJacksonSerializer.java
+++ /dev/null
@@ -1,45 +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.data;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.SerializerProvider;
-
-import java.io.IOException;
-
-import org.apache.olingo.client.api.CommonODataClient;
-
-abstract class ODataJacksonSerializer<T> extends JsonSerializer<T> {
-
- protected CommonODataClient client;
-
- protected abstract void doSerialize(T value, JsonGenerator jgen, SerializerProvider provider)
- throws IOException, JsonProcessingException;
-
- @Override
- public void serialize(final T value, final JsonGenerator jgen, final SerializerProvider provider)
- throws IOException, JsonProcessingException {
-
- client = (CommonODataClient) provider.getAttribute(CommonODataClient.class);
- doSerialize(value, jgen, provider);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java
deleted file mode 100644
index 6d61cf4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/PrimitiveValueImpl.java
+++ /dev/null
@@ -1,41 +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.data;
-
-import org.apache.olingo.client.api.data.PrimitiveValue;
-
-public class PrimitiveValueImpl extends AbstractValue implements PrimitiveValue {
-
- private final String value;
-
- public PrimitiveValueImpl(final String value) {
- this.value = value;
- }
-
- @Override
- public boolean isSimple() {
- return true;
- }
-
- @Override
- public String get() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
deleted file mode 100644
index 9e5b3c8..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLErrorImpl.java
+++ /dev/null
@@ -1,213 +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.data;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class XMLErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- @JacksonXmlText(false)
- private String code;
-
- @JsonProperty
- private Message message;
-
- @JsonProperty(required = false)
- private InnerError innererror;
-
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace().getValue();
- }
-
- static class TextChildContainer extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -8908394095210115904L;
-
- public TextChildContainer() {
- super();
- }
-
- public TextChildContainer(final String value) {
- super();
- this.value = value;
- }
-
- @JsonCreator
- public TextChildContainer(final Map<String, Object> props) {
- super();
- this.value = (String) props.get("");
- }
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Error message.
- */
- public static class Message extends TextChildContainer {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- public Message() {
- super();
- }
-
- @JsonCreator
- public Message(final Map<String, Object> props) {
- super(props);
- this.lang = (String) props.get("lang");
- }
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private TextChildContainer message;
-
- private TextChildContainer type;
-
- private TextChildContainer stacktrace;
-
- private InnerError internalexception;
-
- public TextChildContainer getMessage() {
- return message;
- }
-
- public void setMessage(final TextChildContainer message) {
- this.message = message;
- }
-
- public TextChildContainer getType() {
- return type;
- }
-
- public void setType(final TextChildContainer type) {
- this.type = type;
- }
-
- public TextChildContainer getStacktrace() {
- return stacktrace;
- }
-
- public void setStacktrace(final TextChildContainer stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
index da2017f..ef62f13 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.data;
+import org.apache.olingo.commons.core.data.ODataJacksonDeserializer;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonToken;
@@ -69,7 +70,7 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Ser
protected ServiceDocument doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
- final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == client.getServiceVersion()
+ final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
deleted file mode 100644
index 00b8361..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONLinkCollectionImpl.java
+++ /dev/null
@@ -1,118 +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.data.v3;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
-import org.apache.olingo.client.core.data.AbstractPayloadObject;
-
-/**
- * Link from an entry, represented via JSON.
- */
-public class JSONLinkCollectionImpl extends AbstractPayloadObject implements LinkCollection {
-
- private static final long serialVersionUID = -5006368367235783907L;
-
- /**
- * JSON link URL representation.
- */
- static class JSONLinkURL extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 5365055617973271468L;
-
- private URI url;
-
- public URI getUrl() {
- return url;
- }
-
- public void setUrl(final URI url) {
- this.url = url;
- }
- }
-
- @JsonProperty(value = "odata.metadata", required = false)
- private URI metadata;
-
- @JsonProperty(required = false)
- private URI url;
-
- @JsonProperty(value = "value", required = false)
- private final List<JSONLinkURL> links = new ArrayList<JSONLinkURL>();
-
- @JsonProperty(value = "odata.nextLink", required = false)
- private String next;
-
- /**
- * Gets the metadata URI.
- */
- public URI getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final URI metadata) {
- this.metadata = metadata;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public List<URI> getLinks() {
- final List<URI> result = new ArrayList<URI>();
-
- if (this.url == null) {
- for (JSONLinkURL link : links) {
- result.add(link.getUrl());
- }
- } else {
- result.add(this.url);
- }
-
- return result;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public void setNext(final URI next) {
- this.next = next == null ? null : next.toASCIIString();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public URI getNext() {
- return next == null ? null : URI.create(next);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
index 659e91c..ace5487 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
@@ -22,9 +22,9 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.net.URI;
-import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.core.data.AbstractServiceDocument;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
+import org.apache.olingo.commons.api.Constants;
/**
* Service document, represented via JSON.
@@ -41,7 +41,7 @@ public class JSONServiceDocumentImpl extends AbstractServiceDocument {
URI baseURI = null;
if (metadata != null) {
final String metadataURI = getMetadata();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
deleted file mode 100644
index d5dc442..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLLinkCollectionImpl.java
+++ /dev/null
@@ -1,70 +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.data.v3;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.client.api.data.v3.LinkCollection;
-
-public class XMLLinkCollectionImpl implements LinkCollection {
-
- private final List<URI> links = new ArrayList<URI>();
-
- private URI next;
-
- /**
- * Constructor.
- */
- public XMLLinkCollectionImpl() {
- }
-
- /**
- * Constructor.
- *
- * @param next next page link.
- */
- public XMLLinkCollectionImpl(final URI next) {
- this.next = next;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public List<URI> getLinks() {
- return links;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public void setNext(final URI next) {
- this.next = next;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public URI getNext() {
- return next;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
index 23ed64c..b5c352b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
@@ -19,12 +19,12 @@
package org.apache.olingo.client.core.data.v4;
import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.net.URI;
+import org.apache.olingo.commons.api.Constants;
@JsonDeserialize(using = JSONServiceDocumentDeserializer.class)
public class JSONServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
@@ -34,7 +34,7 @@ public class JSONServiceDocumentImpl extends AbstractServiceDocument implements
URI baseURI = null;
if (getMetadataContext() != null) {
final String metadataURI = getMetadataContext();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(SegmentType.METADATA.getValue())));
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
index aac8ee3..a15dd76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
@@ -22,7 +22,7 @@ import java.sql.Timestamp;
import java.util.Calendar;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.olingo.client.api.Constants;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.domain.AbstractODataValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
index 3827418..ae64d31 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmActionImportImpl.java
@@ -19,7 +19,7 @@
package org.apache.olingo.client.core.edm;
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
-import org.apache.olingo.client.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index 948a930..573e2bc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
index 43f5357..9ecc511 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmComplexTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.Map;
import org.apache.olingo.client.api.edm.xml.ComplexType;
import org.apache.olingo.commons.api.edm.Edm;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 03385f8..635b752 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.List;
import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
index 914ad1c..c5637e7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
index 27d6d10..138c2ac 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmFunctionImportImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.v4.FunctionImport;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
index 19df620..44e723e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
index e912ecb..6c71709 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmParameterImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.client.api.edm.xml.CommonParameter;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmMapping;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
index 8e3eba6..9c9b4f6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmPropertyImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.client.api.edm.xml.CommonProperty;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmMapping;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/fac84b3e/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
index b559c71..71a1009 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmReturnTypeImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.edm;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.client.api.edm.xml.v4.ReturnType;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;