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/04/28 17:00:42 UTC
[3/5] [OLINGO-259] Delta response content parsing (including new
domain objects)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index 904e35e..663cff1 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -18,11 +18,16 @@
*/
package org.apache.olingo.client.core.v4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -31,10 +36,11 @@ import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class JSONTest extends AbstractTest {
@@ -79,21 +85,24 @@ public class JSONTest extends AbstractTest {
if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
}
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_COUNT))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_COUNT));
+ }
final List<String> toRemove = new ArrayList<String>();
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
final Map.Entry<String, JsonNode> field = itor.next();
if (field.getKey().charAt(0) == '#'
|| field.getKey().endsWith(
- getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
|| field.getKey().endsWith(
- getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
|| field.getKey().endsWith(
- getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
|| field.getKey().endsWith(
- getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
|| field.getKey().endsWith(
- getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
toRemove.add(field.getKey());
} else if (field.getValue().isObject()) {
@@ -113,51 +122,51 @@ public class JSONTest extends AbstractTest {
protected void assertSimilar(final String filename, final String actual) throws Exception {
final JsonNode expected = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)).
replace(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK),
- Constants.JSON_BIND_LINK_SUFFIX));
+ Constants.JSON_BIND_LINK_SUFFIX));
cleanup((ObjectNode) expected);
final ObjectNode actualNode = (ObjectNode) OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes()));
cleanup(actualNode);
assertEquals(expected, actualNode);
}
- protected void feed(final String filename, final ODataPubFormat format) throws Exception {
+ protected void entitySet(final String filename, final ODataPubFormat format) throws Exception {
final StringWriter writer = new StringWriter();
- getClient().getSerializer().feed(getClient().getDeserializer().toFeed(
+ getClient().getSerializer().entitySet(getClient().getDeserializer().toEntitySet(
getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(), writer);
assertSimilar(filename + "." + getSuffix(format), writer.toString());
}
@Test
- public void feeds() throws Exception {
- feed("Customers", getODataPubFormat());
- feed("collectionOfEntityReferences", getODataPubFormat());
+ public void entitySets() throws Exception {
+ entitySet("Customers", getODataPubFormat());
+ entitySet("collectionOfEntityReferences", getODataPubFormat());
}
- protected void entry(final String filename, final ODataPubFormat format) throws Exception {
+ protected void entity(final String filename, final ODataPubFormat format) throws Exception {
final StringWriter writer = new StringWriter();
- getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
+ getClient().getSerializer().entity(getClient().getDeserializer().toEntity(
getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload(), writer);
assertSimilar(filename + "." + getSuffix(format), writer.toString());
}
@Test
- public void additionalEntries() throws Exception {
- entry("entity.minimal", getODataPubFormat());
- entry("entity.primitive", getODataPubFormat());
- entry("entity.complex", getODataPubFormat());
- entry("entity.collection.primitive", getODataPubFormat());
- entry("entity.collection.complex", getODataPubFormat());
+ public void additionalEntities() throws Exception {
+ entity("entity.minimal", getODataPubFormat());
+ entity("entity.primitive", getODataPubFormat());
+ entity("entity.complex", getODataPubFormat());
+ entity("entity.collection.primitive", getODataPubFormat());
+ entity("entity.collection.complex", getODataPubFormat());
}
@Test
- public void entries() throws Exception {
- entry("Products_5", getODataPubFormat());
- entry("VipCustomer", getODataPubFormat());
- entry("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
- entry("entityReference", getODataPubFormat());
- entry("entity.withcomplexnavigation", getODataPubFormat());
+ public void entities() throws Exception {
+ entity("Products_5", getODataPubFormat());
+ entity("VipCustomer", getODataPubFormat());
+ entity("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
+ entity("entityReference", getODataPubFormat());
+ entity("entity.withcomplexnavigation", getODataPubFormat());
}
protected void property(final String filename, final ODataFormat format) throws Exception {
@@ -179,7 +188,39 @@ public class JSONTest extends AbstractTest {
@Test
public void crossjoin() throws Exception {
- getClient().getDeserializer().toFeed(
- getClass().getResourceAsStream("crossjoin.json"), ODataPubFormat.JSON_FULL_METADATA);
+ assertNotNull(getClient().getDeserializer().toEntitySet(
+ getClass().getResourceAsStream("crossjoin.json"), ODataPubFormat.JSON_FULL_METADATA));
+ }
+
+ protected void delta(final String filename, final ODataPubFormat format) throws Exception {
+ final Delta delta = getClient().getDeserializer().toDelta(
+ getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getPayload();
+ assertNotNull(delta);
+ assertNotNull(delta.getDeltaLink());
+ assertEquals(5, delta.getCount(), 0);
+
+ assertEquals(1, delta.getDeletedEntities().size());
+ assertTrue(delta.getDeletedEntities().get(0).getId().endsWith("Customers('ANTON')"));
+
+ assertEquals(1, delta.getAddedLinks().size());
+ assertTrue(delta.getAddedLinks().get(0).getSource().toASCIIString().endsWith("Customers('BOTTM')"));
+ assertEquals("Orders", delta.getAddedLinks().get(0).getRelationship());
+
+ assertEquals(1, delta.getDeletedLinks().size());
+ assertTrue(delta.getDeletedLinks().get(0).getSource().toASCIIString().endsWith("Customers('ALFKI')"));
+ assertEquals("Orders", delta.getDeletedLinks().get(0).getRelationship());
+
+ assertEquals(2, delta.getEntities().size());
+ Property property = delta.getEntities().get(0).getProperty("ContactName");
+ assertNotNull(property);
+ assertTrue(property.getValue().isPrimitive());
+ property = delta.getEntities().get(1).getProperty("ShippingAddress");
+ assertNotNull(property);
+ assertTrue(property.getValue().isComplex());
+ }
+
+ @Test
+ public void deltas() throws Exception {
+ delta("delta", getODataPubFormat());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
index c8e2cdf..c37d5a5 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
@@ -1,6 +1,6 @@
{
"@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers",
- "odata.count": 2,
+ "@odata.count": 2,
"value": [{
"@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
"@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.json
new file mode 100644
index 0000000..d8e8f54
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.json
@@ -0,0 +1,39 @@
+{
+ "@odata.context": "http://host/service/$metadata#Customers/$delta",
+ "@odata.count": 5,
+ "value":
+ [
+ {
+ "@odata.id": "Customers('BOTTM')'",
+ "ContactName": "Susan Halvenstern"
+ },
+ {
+ "@odata.context": "#Customers/$deletedLink",
+ "source": "Customers('ALFKI')",
+ "relationship": "Orders",
+ "target": "Orders(10643)"
+ },
+ {
+ "@odata.context": "#Customers/$link",
+ "source": "Customers('BOTTM')",
+ "relationship": "Orders",
+ "target": "Orders(10645)"
+ },
+ {
+ "@odata.context": "#Orders/$entity",
+ "@odata.id": "Orders(10643)",
+ "ShippingAddress": {
+ "Street": "23 Tsawassen Blvd.",
+ "City": " Tsawassen ",
+ "Region": "BC",
+ "PostalCode": "T2F 8M4"
+ }
+ },
+ {
+ "@odata.context": "#Customers/$deletedEntity",
+ "id": "Customers('ANTON')",
+ "reason": "deleted"
+ }
+ ],
+ "@odata.deltaLink": "Customers?$expand=Orders&$deltatoken=8015"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.xml
new file mode 100644
index 0000000..df65b49
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/delta.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<feed xml:base="http://host/service/"
+ xmlns:data="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:metadata="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:at="http://purl.org/atompub/tombstones/1.0"
+ metadata:context="$metadata#Customers/$delta">
+ <title type="text">Customers</title>
+ <id>http://host/service/Customers</id>
+ <updated>2012-11-27T15:38:25Z</updated>
+ <metadata:count>5</metadata:count>
+ <entry>
+ <id>http://host/service/Customers('BOTTM')</id>
+ <title type="text" />
+ <updated>2012-11-17T15:38:22Z</updated>
+ <author>
+ <name />
+ </author>
+ <link rel="edit" title="Customer" href="Customers('BOTTM')"/>
+ <category term="#Model.Customer"
+ scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <content type="application/xml">
+ <metadata:properties>
+ <data:ContactName>Susan Halvenstern</data:ContactName>
+ </metadata:properties>
+ </content>
+ </entry>
+ <metadata:deleted-link
+ metadata:context="$metadata#Customers/$deleted-link"
+ source="http://host/service/Customers('ALFKI')"
+ relationship="Orders"
+ target="http://host/service/Orders(10643)"/>
+ <metadata:link
+ metadata:context="$metadata#Customers/$link"
+ source="http://host/service/Customers('BOTTM')"
+ relationship="Orders"
+ target="http://host/service/Orders(10645)"/>
+ <entry metadata:context="$metadata#Orders/$entity">
+ <id>http://host/service/Orders(10643)</id>
+ <title type="text" />
+ <updated>2012-11-27T15:38:24Z</updated>
+ <author>
+ <name/>
+ </author>
+ <link rel="edit" title="Order" href="Orders(10643)" />
+ <category term="#Model.Order"
+ scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <content type="application/xml">
+ <metadata:properties>
+ <data:ShippingAddress>
+ <data:Street>23 Tsawassen Blvd.</data:Street>
+ <data:City>Tsawassen</data:City>
+ <data:Region>BC</data:Region>
+ <data:PostalCode>T2F 8M4</data:PostalCode>
+ </data:ShippingAddress>
+ </metadata:properties>
+ </content>
+ </entry>
+ <at:deleted-entry
+ metadata:context="$metadata#Customers/$deleted-entry"
+ ref="http://host/service/Customers('ANTON')"
+ when="2012-11-27T15:38:25Z"
+ metadata:reason="deleted"/>
+ <link
+ rel="http://docs.oasis-open.org/odata/ns/delta"
+ href="http://host/service/Customers?$expand=Orders&$deltatoken=8015"/>
+</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 882c811..770f81c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -42,6 +42,8 @@ public interface Constants {
public static final String NS_GML = "http://www.opengis.net/gml";
+ public static final String NS_ATOM_TOMBSTONE = "http://purl.org/atompub/tombstones/1.0";
+
public static final String PREFIX_DATASERVICES = "d";
public static final String PREFIX_METADATA = "m";
@@ -61,6 +63,8 @@ public interface Constants {
public static final String NEXT_LINK_REL = "next";
+ public static final String DELTA_LINK_REL = "http://docs.oasis-open.org/odata/ns/delta";
+
// XML elements and attributes
public static final String PROPERTIES = "properties";
@@ -84,6 +88,8 @@ public interface Constants {
public static final String ATTR_HREF = "href";
+ public static final String ATTR_REF = "ref";
+
public static final String ATTR_TARGET = "target";
public static final String ATTR_SRSNAME = "srsName";
@@ -138,6 +144,14 @@ public interface Constants {
public static final String ELEM_URI = "uri";
+ public final static String ELEM_REASON = "reason";
+
+ public static final String ELEM_DELETED_LINK = "deleted-link";
+
+ public static final String ATTR_SOURCE = "source";
+
+ public static final String ATTR_RELATIONSHIP = "relationship";
+
// JSON stuff
public final static String JSON_METADATA = "odata.metadata";
@@ -159,10 +173,6 @@ public interface Constants {
public final static String JSON_CRS = "crs";
- public final static String JSON_COUNT = "odata.count";
-
- public final static String JSON_NEXT_LINK = "odata.nextLink";
-
public final static String JSON_NAME = "name";
// Atom stuff
@@ -224,7 +234,9 @@ public interface Constants {
public static final String ATOM_ATTR_METADATAETAG = "metadata-etag";
- // error stuff
+ public static final String ATOM_ELEM_DELETED_ENTRY = "deleted-entry";
+
+// error stuff
public static final String ERROR_CODE = "code";
public static final String ERROR_MESSAGE = "message";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
index c2d503e..4fa1350 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
@@ -42,14 +42,38 @@ public class ContextURL {
private String navOrPropertyPath;
+ private boolean entity;
+
+ private boolean delta;
+
+ private boolean deltaDeletedEntity;
+
+ private boolean deltaLink;
+
+ private boolean deltaDeletedLink;
+
public static ContextURL getInstance(final URI contextURL) {
final ContextURL instance = new ContextURL();
instance.uri = contextURL;
- final String contextURLasString = instance.uri.toASCIIString().
- replace("/$entity", StringUtils.EMPTY).
- replace("/@Element", StringUtils.EMPTY);
-
+ String contextURLasString = instance.uri.toASCIIString();
+
+ instance.entity = contextURLasString.endsWith("/$entity") || contextURLasString.endsWith("/@Element");
+ contextURLasString = contextURLasString.
+ replace("/$entity", StringUtils.EMPTY).replace("/@Element", StringUtils.EMPTY);
+
+ instance.delta = contextURLasString.endsWith("/$delta");
+ contextURLasString = contextURLasString.replace("/$delta", StringUtils.EMPTY);
+
+ instance.deltaDeletedEntity = contextURLasString.endsWith("/$deletedEntity");
+ contextURLasString = contextURLasString.replace("/$deletedEntity", StringUtils.EMPTY);
+
+ instance.deltaLink = contextURLasString.endsWith("/$link");
+ contextURLasString = contextURLasString.replace("/$link", StringUtils.EMPTY);
+
+ instance.deltaDeletedLink = contextURLasString.endsWith("$deletedLink");
+ contextURLasString = contextURLasString.replace("$deletedLink", StringUtils.EMPTY);
+
instance.serviceRoot = URI.create(StringUtils.substringBefore(contextURLasString, Constants.METADATA));
final String rest = StringUtils.substringAfter(contextURLasString, Constants.METADATA + "#");
@@ -124,6 +148,26 @@ public class ContextURL {
return navOrPropertyPath;
}
+ public boolean isEntity() {
+ return entity;
+ }
+
+ public boolean isDelta() {
+ return delta;
+ }
+
+ public boolean isDeltaDeletedEntity() {
+ return deltaDeletedEntity;
+ }
+
+ public boolean isDeltaLink() {
+ return deltaLink;
+ }
+
+ public boolean isDeltaDeletedLink() {
+ return deltaDeletedLink;
+ }
+
@Override
public boolean equals(final Object obj) {
if (obj == null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java
new file mode 100644
index 0000000..98f2a89
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeletedEntity.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+public interface DeletedEntity {
+
+ String getId();
+
+ String getReason();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
new file mode 100644
index 0000000..066033a
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Delta.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import java.net.URI;
+import java.util.List;
+
+public interface Delta extends EntitySet {
+
+ List<DeletedEntity> getDeletedEntities();
+
+ List<DeltaLink> getAddedLinks();
+
+ List<DeltaLink> getDeletedLinks();
+
+ /**
+ * Gets delta link if exists.
+ *
+ * @return delta link if exists; null otherwise.
+ */
+ URI getDeltaLink();
+
+ /**
+ * Sets delta link.
+ *
+ * @param deltaLink delta link.
+ */
+ void setDeltaLink(URI deltaLink);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java
new file mode 100644
index 0000000..a280165
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/DeltaLink.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import java.net.URI;
+
+public interface DeltaLink {
+
+ URI getSource();
+
+ void setSource(URI source);
+
+ String getRelationship();
+
+ void setRelationship(String relationship);
+
+ URI getTarget();
+
+ void setTarget(URI target);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
new file mode 100644
index 0000000..ed0ad15
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java
@@ -0,0 +1,174 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import java.net.URI;
+import java.util.List;
+
+public interface Entity extends Linked {
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ String getETag();
+
+ /**
+ * Gets base URI.
+ *
+ * @return base URI.
+ */
+ URI getBaseURI();
+
+ /**
+ * Gets entity type.
+ *
+ * @return entity type.
+ */
+ String getType();
+
+ /**
+ * Sets entity type.
+ *
+ * @param type entity type.
+ */
+ void setType(String type);
+
+ /**
+ * Gets entity ID.
+ *
+ * @return entity ID.
+ */
+ String getId();
+
+ /**
+ * Sets entity ID.
+ *
+ * @param id entity ID.
+ */
+ void setId(String id);
+
+ /**
+ * Gets entity self link.
+ *
+ * @return self link.
+ */
+ Link getSelfLink();
+
+ /**
+ * Sets entity self link.
+ *
+ * @param selfLink self link.
+ */
+ void setSelfLink(Link selfLink);
+
+ /**
+ * Gets entity edit link.
+ *
+ * @return edit link.
+ */
+ Link getEditLink();
+
+ /**
+ * Sets entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ void setEditLink(Link editLink);
+
+ /**
+ * Gets media entity links.
+ *
+ * @return links.
+ */
+ List<Link> getMediaEditLinks();
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ List<ODataOperation> getOperations();
+
+ /**
+ * Gets properties.
+ *
+ * @return properties.
+ */
+ List<Property> getProperties();
+
+ /**
+ * Gets property with given name.
+ *
+ * @param name property name
+ * @return property with given name if found, null otherwise
+ */
+ Property getProperty(String name);
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ String getMediaContentType();
+
+ /**
+ * Gets media content resource.
+ *
+ * @return media content resource.
+ */
+ String getMediaContentSource();
+
+ /**
+ * Set media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ void setMediaContentSource(String mediaContentSource);
+
+ /**
+ * Set media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ void setMediaContentType(String mediaContentType);
+
+ /**
+ * ETag of the binary stream represented by this media entity or named stream property.
+ *
+ * @return media ETag value
+ */
+ String getMediaETag();
+
+ /**
+ * Set media ETag.
+ *
+ * @param eTag media ETag value
+ */
+ void setMediaETag(String eTag);
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if is a media entity; 'FALSE' otherwise.
+ */
+ boolean isMediaEntity();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
new file mode 100644
index 0000000..0812acf
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.api.data;
+
+import java.net.URI;
+import java.util.List;
+
+public interface EntitySet {
+
+ /**
+ * Gets base URI.
+ *
+ * @return base URI.
+ */
+ URI getBaseURI();
+
+ /**
+ * Sets number of entries.
+ *
+ * @param count number of entries
+ */
+ void setCount(Integer count);
+
+ /**
+ * Gets number of entries - if it was required.
+ *
+ * @return number of entries into the entity set.
+ */
+ Integer getCount();
+
+ /**
+ * Gest ID.
+ *
+ * @return ID.
+ */
+ String getId();
+
+ /**
+ * Gets entities.
+ *
+ * @return entries.
+ */
+ List<Entity> getEntities();
+
+ /**
+ * Gets next link if exists.
+ *
+ * @return next link if exists; null otherwise.
+ */
+ URI getNext();
+
+ /**
+ * Sets next link.
+ *
+ * @param next next link.
+ */
+ void setNext(URI next);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
deleted file mode 100644
index d82005e..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.api.data;
-
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import java.net.URI;
-import java.util.List;
-
-public interface Entry extends Linked {
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- String getETag();
-
- /**
- * Gets base URI.
- *
- * @return base URI.
- */
- URI getBaseURI();
-
- /**
- * Gets entry type.
- *
- * @return entry type.
- */
- String getType();
-
- /**
- * Sets entry type.
- *
- * @param type entry type.
- */
- void setType(String type);
-
- /**
- * Gets entry ID.
- *
- * @return entry ID.
- */
- String getId();
-
- /**
- * Sets entry ID.
- *
- * @param id entry ID.
- */
- void setId(String id);
-
- /**
- * Gets entry self link.
- *
- * @return self link.
- */
- Link getSelfLink();
-
- /**
- * Sets entry self link.
- *
- * @param selfLink self link.
- */
- void setSelfLink(Link selfLink);
-
- /**
- * Gets entry edit link.
- *
- * @return edit link.
- */
- Link getEditLink();
-
- /**
- * Sets entry edit link.
- *
- * @param editLink edit link.
- */
- void setEditLink(Link editLink);
-
- /**
- * Gets media entity links.
- *
- * @return links.
- */
- List<Link> getMediaEditLinks();
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- List<ODataOperation> getOperations();
-
- /**
- * Gets properties.
- *
- * @return properties.
- */
- List<Property> getProperties();
-
- /**
- * Gets property with given name.
- *
- * @param name property name
- * @return property with given name if found, null otherwise
- */
- Property getProperty(String name);
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- String getMediaContentType();
-
- /**
- * Gets media content resource.
- *
- * @return media content resource.
- */
- String getMediaContentSource();
-
- /**
- * Set media content source.
- *
- * @param mediaContentSource media content source.
- */
- void setMediaContentSource(String mediaContentSource);
-
- /**
- * Set media content type.
- *
- * @param mediaContentType media content type.
- */
- void setMediaContentType(String mediaContentType);
-
- /**
- * ETag of the binary stream represented by this media entity or named stream property.
- *
- * @return media ETag value
- */
- String getMediaETag();
-
- /**
- * Set media ETag.
- *
- * @param eTag media ETag value
- */
- void setMediaETag(String eTag);
-
- /**
- * Checks if the current entry is a media entry.
- *
- * @return 'TRUE' if is a media entry; 'FALSE' otherwise.
- */
- boolean isMediaEntry();
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
deleted file mode 100644
index 4f6a542..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.api.data;
-
-import java.net.URI;
-import java.util.List;
-
-public interface Feed {
-
- /**
- * Gets base URI.
- *
- * @return base URI.
- */
- URI getBaseURI();
-
- /**
- * Sets number of entries.
- *
- * @param count number of entries
- */
- void setCount(Integer count);
-
- /**
- * Gets number of entries - if it was required.
- *
- * @return number of entries into the feed.
- */
- Integer getCount();
-
- /**
- * Gest feed ID.
- *
- * @return feed ID.
- */
- String getId();
-
- /**
- * Gets entries.
- *
- * @return entries.
- */
- List<Entry> getEntries();
-
- /**
- * Gets next link if exists.
- *
- * @return next link if exists; null otherwise.
- */
- URI getNext();
-
- /**
- * Sets next link.
- *
- * @param next next link.
- */
- void setNext(URI next);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
index f0a35a5..63c953a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Link.java
@@ -91,31 +91,31 @@ public interface Link {
void setMediaETag(String etag);
/**
- * Gets in-line entry.
+ * Gets in-line entity.
*
- * @return in-line entry.
+ * @return in-line entity.
*/
- Entry getInlineEntry();
+ Entity getInlineEntity();
/**
- * Sets in-line entry.
+ * Sets in-line entity.
*
- * @param entry entry.
+ * @param entity entity.
*/
- void setInlineEntry(Entry entry);
+ void setInlineEntity(Entity entity);
/**
- * Gets in-line feed.
+ * Gets in-line entity set.
*
- * @return in-line feed.
+ * @return in-line entity set.
*/
- Feed getInlineFeed();
+ EntitySet getInlineEntitySet();
/**
- * Sets in-line feed.
+ * Sets in-line entity set.
*
- * @param feed feed.
+ * @param entitySet entity set.
*/
- void setInlineFeed(Feed feed);
+ void setInlineEntitySet(EntitySet entitySet);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
index 3967748..e33055f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
@@ -36,7 +36,7 @@ public interface CommonODataEntitySet extends ODataInvokeResult {
/**
* Gets contained entities.
*
- * @return feed entries.
+ * @return entity set's entities.
*/
List<? extends CommonODataEntity> getEntities();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
index 0dd5462..4e3852c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinked.java
@@ -62,7 +62,7 @@ public interface ODataLinked {
ODataLink getNavigationLink(String name);
/**
- * Returns all entity navigation links (including inline entities / feeds).
+ * Returns all entity navigation links (including inline entities / entity sets).
*
* @return OData entity links.
*/
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index c6354ec..8e6b145 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -69,6 +69,13 @@ public enum ODataServiceVersion {
public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
+
+ public final static String JSON_COUNT = "jsonCount";
+
+ public final static String JSON_NEXT_LINK = "jsonNextLink";
+
+ public final static String JSON_DELTA_LINK = "jsonDeltaLink";
+
public static final String JSON_ERROR = "jsonError";
private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
@@ -101,6 +108,8 @@ public enum ODataServiceVersion {
put(JSON_MEDIA_ETAG, "odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
+ put(JSON_COUNT, "odata.count");
+ put(JSON_NEXT_LINK, "odata.nextLink");
put(JSON_ERROR, "odata.error");
}
});
@@ -135,6 +144,9 @@ public enum ODataServiceVersion {
put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
+ put(JSON_COUNT, "@odata.count");
+ put(JSON_NEXT_LINK, "@odata.nextLink");
+ put(JSON_DELTA_LINK, "@odata.deltaLink");
put(JSON_ERROR, "error");
}
});
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
index 52b0103..a0d9a87 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
@@ -21,35 +21,35 @@ package org.apache.olingo.commons.api.op;
import java.io.InputStream;
import java.io.Serializable;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
- * Interface for serialization.
+ * Interface for de-serialization.
*/
public interface CommonODataDeserializer extends Serializable {
/**
- * Gets a feed object from the given InputStream.
+ * Gets an entity set object from the given InputStream.
*
* @param input stream to be de-serialized.
* @param format Atom or JSON
- * @return Feed instance.
+ * @return {@link EntitySet} instance.
*/
- ResWrap<Feed> toFeed(InputStream input, ODataPubFormat format);
+ ResWrap<EntitySet> toEntitySet(InputStream input, ODataPubFormat format);
/**
- * Gets an entry object from the given InputStream.
+ * Gets an entity object from the given InputStream.
*
* @param input stream to be de-serialized.
* @param format Atom or JSON
- * @return Entry instance.
+ * @return {@link Entity} instance.
*/
- ResWrap<Entry> toEntry(InputStream input, ODataPubFormat format);
+ ResWrap<Entity> toEntity(InputStream input, ODataPubFormat format);
/**
* Gets a property object from the given InputStream.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java
index 2a7beff..c8a02cf 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/ODataSerializer.java
@@ -21,8 +21,8 @@ package org.apache.olingo.commons.api.op;
import java.io.OutputStream;
import java.io.Serializable;
import java.io.Writer;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.format.ODataFormat;
@@ -33,36 +33,36 @@ import org.apache.olingo.commons.api.format.ODataFormat;
public interface ODataSerializer extends Serializable {
/**
- * Writes Feed object onto the given stream.
+ * Writes entity set object onto the given stream.
*
* @param obj object to be streamed.
* @param out output stream.
*/
- void feed(Feed obj, OutputStream out);
+ void entitySet(EntitySet obj, OutputStream out);
/**
- * Writes Feed object by the given writer.
+ * Writes entity set object by the given writer.
*
* @param obj object to be streamed.
* @param writer writer.
*/
- void feed(Feed obj, Writer writer);
+ void entitySet(EntitySet obj, Writer writer);
/**
- * Writes theEntry object onto the given stream.
+ * Writes entity object onto the given stream.
*
* @param obj object to be streamed.
* @param out output stream.
*/
- void entry(Entry obj, OutputStream out);
+ void entity(Entity obj, OutputStream out);
/**
- * Writes the Entry object by the given writer.
+ * Writes entity object by the given writer.
*
* @param obj object to be streamed.
* @param writer writer.
*/
- void entry(Entry obj, Writer writer);
+ void entity(Entity obj, Writer writer);
/**
* Writes the property object onto the given stream.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
index df7e649..14d42e2 100644
--- a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
+++ b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
@@ -19,7 +19,9 @@
package org.apache.olingo.commons.api.data;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.net.URI;
import org.junit.Test;
@@ -35,6 +37,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Orders(4711)/Items"));
@@ -42,6 +45,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertEquals("Items", contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -52,6 +56,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Orders(4711)/Items/$entity"));
@@ -59,6 +64,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertEquals("Items", contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
// v3
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Products/@Element"));
@@ -67,6 +73,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
}
@Test
@@ -77,6 +84,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -88,6 +96,7 @@ public class ContextURLTest {
assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -99,6 +108,7 @@ public class ContextURLTest {
assertEquals("Model.VipCustomer", contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
}
@Test
@@ -110,6 +120,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertEquals("Address,Orders", contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -121,6 +132,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertEquals("Name,Rating", contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertTrue(contextURL.isEntity());
contextURL = ContextURL.getInstance(
URI.create("http://host/service/$metadata#Customers(Name,Address/Country)"));
@@ -129,6 +141,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertEquals("Name,Address/Country", contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -141,6 +154,7 @@ public class ContextURLTest {
assertEquals("Sales.Manager", contextURL.getDerivedEntity());
assertEquals("DirectReports,DirectReports+(FirstName,LastName)", contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -152,6 +166,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertEquals("Addresses", contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -163,6 +178,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
@Test
@@ -173,6 +189,7 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#ODataDemo.Address"));
@@ -180,5 +197,21 @@ public class ContextURLTest {
assertNull(contextURL.getDerivedEntity());
assertNull(contextURL.getSelectList());
assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
+ }
+
+ @Test
+ public void delta() {
+ ContextURL contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$delta"));
+ assertTrue(contextURL.isDelta());
+
+ contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$deletedLink"));
+ assertTrue(contextURL.isDeltaDeletedLink());
+
+ contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$link"));
+ assertTrue(contextURL.isDeltaLink());
+
+ contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$deletedEntity"));
+ assertTrue(contextURL.isDeltaDeletedEntity());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index f571c66..2f3ebb3 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -58,7 +58,15 @@ abstract class AbstractAtomDealer {
protected final QName entryRefQName;
- protected final QName v4PropertyValueQName;
+ protected final QName propertyValueQName;
+
+ protected final QName deletedEntryQName;
+
+ protected final QName reasonQName;
+
+ protected final QName linkQName;
+
+ protected final QName deletedLinkQName;
protected final QName errorCodeQName;
@@ -94,9 +102,17 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.CONTEXT);
this.entryRefQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
- this.v4PropertyValueQName =
+ this.propertyValueQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
+ this.deletedEntryQName = new QName(Constants.NS_ATOM_TOMBSTONE, Constants.ATOM_ELEM_DELETED_ENTRY);
+ this.reasonQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_REASON);
+ this.linkQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_LINK);
+ this.deletedLinkQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_DELETED_LINK);
+
this.errorCodeQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_CODE);
this.errorMessageQName =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractDelta.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractDelta.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractDelta.java
new file mode 100644
index 0000000..73a65b7
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractDelta.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.DeletedEntity;
+import org.apache.olingo.commons.api.data.Delta;
+import org.apache.olingo.commons.api.data.DeltaLink;
+
+public abstract class AbstractDelta extends AbstractEntitySet implements Delta {
+
+ private static final long serialVersionUID = 4576771708961553195L;
+
+ private final List<DeletedEntity> deletedEntities = new ArrayList<DeletedEntity>();
+
+ private final List<DeltaLink> addedLinks = new ArrayList<DeltaLink>();
+
+ private final List<DeltaLink> deletedLinks = new ArrayList<DeltaLink>();
+
+ private URI deltaLink;
+
+ @Override
+ public List<DeletedEntity> getDeletedEntities() {
+ return deletedEntities;
+ }
+
+ @Override
+ public List<DeltaLink> getAddedLinks() {
+ return addedLinks;
+ }
+
+ @Override
+ public List<DeltaLink> getDeletedLinks() {
+ return deletedLinks;
+ }
+
+ @Override
+ public URI getDeltaLink() {
+ return deltaLink;
+ }
+
+ @Override
+ public void setDeltaLink(final URI deltaLink) {
+ this.deltaLink = deltaLink;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
new file mode 100644
index 0000000..fc89504
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntity.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+
+/**
+ * Abstract base for classes implementing an OData entity in Atom and JSON.
+ */
+public abstract class AbstractEntity extends AbstractODataObject implements Entity {
+
+ private static final long serialVersionUID = 2127764552600969783L;
+
+ private String eTag;
+
+ private String type;
+
+ private Link readLink;
+
+ private Link editLink;
+
+ private final List<Link> associationLinks = new ArrayList<Link>();
+
+ private final List<Link> navigationLinks = new ArrayList<Link>();
+
+ private final List<Link> mediaEditLinks = new ArrayList<Link>();
+
+ private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ private final List<Property> properties = new ArrayList<Property>();
+
+ private String mediaContentSource;
+
+ private String mediaContentType;
+
+ private String mediaETag;
+
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Link getSelfLink() {
+ return readLink;
+ }
+
+ @Override
+ public void setSelfLink(final Link readLink) {
+ this.readLink = readLink;
+ }
+
+ @Override
+ public Link getEditLink() {
+ return editLink;
+ }
+
+ @Override
+ public void setEditLink(final Link editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public List<Link> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ @Override
+ public List<Link> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ @Override
+ public List<Link> getMediaEditLinks() {
+ return mediaEditLinks;
+ }
+
+ @Override
+ public List<ODataOperation> getOperations() {
+ return operations;
+ }
+
+ @Override
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public Property getProperty(final String name) {
+ Property result = null;
+
+ for (Property property : properties) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public String getMediaContentType() {
+ return this.mediaContentType;
+ }
+
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ @Override
+ public String getMediaContentSource() {
+ return this.mediaContentSource;
+ }
+
+ @Override
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+
+ @Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String eTag) {
+ this.mediaETag = eTag;
+ }
+
+ @Override
+ public boolean isMediaEntity() {
+ return StringUtils.isNotBlank(this.mediaContentSource);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntitySet.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntitySet.java
new file mode 100644
index 0000000..b640812
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntitySet.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.commons.core.data;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntitySet;
+
+public abstract class AbstractEntitySet extends AbstractODataObject implements EntitySet {
+
+ private static final long serialVersionUID = -9159884750819150969L;
+
+ private Integer count;
+
+ private final List<Entity> entities = new ArrayList<Entity>();
+
+ private URI next;
+
+ @Override
+ public void setCount(final Integer count) {
+ this.count = count;
+ }
+
+ @Override
+ public Integer getCount() {
+ return count;
+ }
+
+ @Override
+ public List<Entity> getEntities() {
+ return entities;
+ }
+
+ @Override
+ public void setNext(final URI next) {
+ this.next = next;
+ }
+
+ @Override
+ public URI getNext() {
+ return next;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
deleted file mode 100644
index 4c0f346..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-
-/**
- * Abstract base for classes implementing an OData entry in Atom and JSON.
- */
-public abstract class AbstractEntry extends AbstractODataObject implements Entry {
-
- private static final long serialVersionUID = 2127764552600969783L;
-
- private String eTag;
-
- private String type;
-
- private Link readLink;
-
- private Link editLink;
-
- private final List<Link> associationLinks = new ArrayList<Link>();
-
- private final List<Link> navigationLinks = new ArrayList<Link>();
-
- private final List<Link> mediaEditLinks = new ArrayList<Link>();
-
- private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- private final List<Property> properties = new ArrayList<Property>();
-
- private String mediaContentSource;
-
- private String mediaContentType;
-
- private String mediaETag;
-
- @Override
- public String getETag() {
- return eTag;
- }
-
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Link getSelfLink() {
- return readLink;
- }
-
- @Override
- public void setSelfLink(final Link readLink) {
- this.readLink = readLink;
- }
-
- @Override
- public Link getEditLink() {
- return editLink;
- }
-
- @Override
- public void setEditLink(final Link editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public List<Link> getAssociationLinks() {
- return associationLinks;
- }
-
- @Override
- public List<Link> getNavigationLinks() {
- return navigationLinks;
- }
-
- @Override
- public List<Link> getMediaEditLinks() {
- return mediaEditLinks;
- }
-
- @Override
- public List<ODataOperation> getOperations() {
- return operations;
- }
-
- @Override
- public List<Property> getProperties() {
- return properties;
- }
-
- @Override
- public Property getProperty(final String name) {
- Property result = null;
-
- for (Property property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
-
- return result;
- }
-
- @Override
- public String getMediaContentType() {
- return this.mediaContentType;
- }
-
- @Override
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
-
- @Override
- public String getMediaContentSource() {
- return this.mediaContentSource;
- }
-
- @Override
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
-
- @Override
- public String getMediaETag() {
- return mediaETag;
- }
-
- @Override
- public void setMediaETag(final String eTag) {
- this.mediaETag = eTag;
- }
-
- @Override
- public boolean isMediaEntry() {
- return StringUtils.isNotBlank(this.mediaContentSource);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 97be4eb..82f8ae0 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -60,33 +60,33 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<ResW
protected String setInline(final String name, final String suffix, final JsonNode tree,
final ObjectCodec codec, final LinkImpl link) throws IOException {
- final String entryNamePrefix = name.substring(0, name.indexOf(suffix));
- if (tree.has(entryNamePrefix)) {
- final JsonNode inline = tree.path(entryNamePrefix);
+ final String entityNamePrefix = name.substring(0, name.indexOf(suffix));
+ if (tree.has(entityNamePrefix)) {
+ final JsonNode inline = tree.path(entityNamePrefix);
if (inline instanceof ObjectNode) {
link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- link.setInlineEntry(inline.traverse(codec).<ResWrap<JSONEntryImpl>>readValueAs(
- new TypeReference<JSONEntryImpl>() {
+ link.setInlineEntity(inline.traverse(codec).<ResWrap<JSONEntityImpl>>readValueAs(
+ new TypeReference<JSONEntityImpl>() {
}).getPayload());
}
if (inline instanceof ArrayNode) {
link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
- final JSONFeedImpl feed = new JSONFeedImpl();
+ final JSONEntitySetImpl entitySet = new JSONEntitySetImpl();
final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
while (entries.hasNext()) {
- feed.getEntries().add(entries.next().traverse(codec).<ResWrap<JSONEntryImpl>>readValuesAs(
- new TypeReference<JSONEntryImpl>() {
+ entitySet.getEntities().add(entries.next().traverse(codec).<ResWrap<JSONEntityImpl>>readValuesAs(
+ new TypeReference<JSONEntityImpl>() {
}).next().getPayload());
}
- link.setInlineFeed(feed);
+ link.setInlineEntitySet(entitySet);
}
}
- return entryNamePrefix;
+ return entityNamePrefix;
}
protected void links(final Map.Entry<String, JsonNode> field, final Linked linked, final Set<String> toRemove,
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
index 06e0e5e..9efc67c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.PrimitiveValue;
@@ -86,11 +86,11 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
}
}
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- } else if (link.getInlineFeed() != null) {
+ if (link.getInlineEntity() != null) {
+ jgen.writeObjectField(link.getTitle(), link.getInlineEntity());
+ } else if (link.getInlineEntitySet() != null) {
jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
+ for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
jgen.writeObject(subEntry);
}
jgen.writeEndArray();
@@ -123,11 +123,11 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
link.getHref());
}
- if (link.getInlineEntry() != null) {
- jgen.writeObjectField(link.getTitle(), link.getInlineEntry());
- } else if (link.getInlineFeed() != null) {
+ if (link.getInlineEntity() != null) {
+ jgen.writeObjectField(link.getTitle(), link.getInlineEntity());
+ } else if (link.getInlineEntitySet() != null) {
jgen.writeArrayFieldStart(link.getTitle());
- for (Entry subEntry : link.getInlineFeed().getEntries()) {
+ for (Entity subEntry : link.getInlineEntitySet().getEntities()) {
jgen.writeObject(subEntry);
}
jgen.writeEndArray();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeltaImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeltaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeltaImpl.java
new file mode 100644
index 0000000..165299b
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeltaImpl.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.commons.core.data;
+
+public class AtomDeltaImpl extends AbstractDelta {
+
+ private static final long serialVersionUID = -730729098008847535L;
+
+}