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:44 UTC
[5/5] git commit: [OLINGO-259] Delta response content parsing
(including new domain objects)
[OLINGO-259] Delta response content parsing (including new domain objects)
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/118b779b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/118b779b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/118b779b
Branch: refs/heads/master
Commit: 118b779bc4817e19e746c295c09b15f0df7a713c
Parents: 0b05798
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Apr 28 17:00:23 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Apr 28 17:00:23 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 109 +++++-----
.../apache/olingo/fit/V3ActionOverloading.java | 4 +-
.../java/org/apache/olingo/fit/V3Services.java | 6 +-
.../java/org/apache/olingo/fit/V4Services.java | 96 ++++----
.../apache/olingo/fit/metadata/Metadata.java | 2 +-
.../olingo/fit/metadata/NavigationProperty.java | 10 +-
.../fit/serializer/JSONEntryContainer.java | 14 +-
.../fit/serializer/JSONFeedContainer.java | 14 +-
.../olingo/fit/utils/AbstractUtilities.java | 64 +++---
.../org/apache/olingo/fit/utils/DataBinder.java | 153 +++++++------
.../org/apache/olingo/fit/utils/FSManager.java | 6 +-
.../apache/olingo/fit/utils/XMLUtilities.java | 2 +-
.../client/api/CommonEdmEnabledODataClient.java | 1 -
.../request/v4/AsyncRequestFactory.java | 1 -
.../api/domain/ODataEntitySetIterator.java | 77 +++----
.../olingo/client/api/op/CommonODataBinder.java | 32 +--
.../olingo/client/api/op/CommonODataReader.java | 6 +-
.../olingo/client/api/op/v3/ODataBinder.java | 8 +-
.../olingo/client/api/op/v4/ODataBinder.java | 8 +-
.../client/api/op/v4/ODataDeserializer.java | 11 +
.../cud/ODataEntityCreateRequestImpl.java | 6 +-
.../cud/ODataEntityUpdateRequestImpl.java | 6 +-
.../retrieve/ODataEntityRequestImpl.java | 6 +-
.../ODataEntitySetIteratorRequestImpl.java | 10 +-
.../retrieve/ODataEntitySetRequestImpl.java | 6 +-
.../ODataMediaEntityCreateRequestImpl.java | 4 +-
.../ODataMediaEntityUpdateRequestImpl.java | 4 +-
.../request/v4/AsyncRequestFactoryImpl.java | 3 +-
.../client/core/op/AbstractODataBinder.java | 132 +++++------
.../client/core/op/AbstractODataReader.java | 9 +-
.../olingo/client/core/op/ODataWriterImpl.java | 6 +-
.../client/core/op/impl/v3/ODataBinderImpl.java | 10 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 4 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 20 +-
.../core/op/impl/v4/ODataDeserializerImpl.java | 12 +
.../client/core/op/impl/v4/ODataReaderImpl.java | 4 +-
.../client/core/it/AbstractBaseTestITCase.java | 20 +-
.../core/it/v3/EntityRetrieveTestITCase.java | 6 +-
.../client/core/it/v3/EntitySetTestITCase.java | 2 +-
.../core/it/v3/QueryOptionsTestITCase.java | 10 +-
.../apache/olingo/client/core/v3/AtomTest.java | 30 +--
.../olingo/client/core/v3/EntitySetTest.java | 10 +-
.../olingo/client/core/v3/EntityTest.java | 32 +--
.../apache/olingo/client/core/v4/AtomTest.java | 2 +-
.../olingo/client/core/v4/EntitySetTest.java | 18 +-
.../olingo/client/core/v4/EntityTest.java | 51 +++--
.../apache/olingo/client/core/v4/JSONTest.java | 97 ++++++---
.../apache/olingo/client/core/v4/Customers.json | 2 +-
.../org/apache/olingo/client/core/v4/delta.json | 39 ++++
.../org/apache/olingo/client/core/v4/delta.xml | 87 ++++++++
.../apache/olingo/commons/api/Constants.java | 22 +-
.../olingo/commons/api/data/ContextURL.java | 52 ++++-
.../olingo/commons/api/data/DeletedEntity.java | 27 +++
.../apache/olingo/commons/api/data/Delta.java | 45 ++++
.../olingo/commons/api/data/DeltaLink.java | 36 +++
.../apache/olingo/commons/api/data/Entity.java | 174 +++++++++++++++
.../olingo/commons/api/data/EntitySet.java | 74 +++++++
.../apache/olingo/commons/api/data/Entry.java | 174 ---------------
.../apache/olingo/commons/api/data/Feed.java | 74 -------
.../apache/olingo/commons/api/data/Link.java | 24 +-
.../api/domain/CommonODataEntitySet.java | 2 +-
.../olingo/commons/api/domain/ODataLinked.java | 2 +-
.../api/edm/constants/ODataServiceVersion.java | 12 +
.../commons/api/op/CommonODataDeserializer.java | 18 +-
.../olingo/commons/api/op/ODataSerializer.java | 20 +-
.../olingo/commons/api/data/ContextURLTest.java | 33 +++
.../commons/core/data/AbstractAtomDealer.java | 20 +-
.../olingo/commons/core/data/AbstractDelta.java | 65 ++++++
.../commons/core/data/AbstractEntity.java | 171 +++++++++++++++
.../commons/core/data/AbstractEntitySet.java | 61 ++++++
.../olingo/commons/core/data/AbstractEntry.java | 171 ---------------
.../core/data/AbstractJsonDeserializer.java | 20 +-
.../core/data/AbstractJsonSerializer.java | 18 +-
.../olingo/commons/core/data/AtomDeltaImpl.java | 25 +++
.../commons/core/data/AtomDeserializer.java | 217 ++++++++++++++-----
.../commons/core/data/AtomEntityImpl.java | 25 +++
.../commons/core/data/AtomEntitySetImpl.java | 28 +++
.../olingo/commons/core/data/AtomEntryImpl.java | 25 ---
.../olingo/commons/core/data/AtomFeedImpl.java | 66 ------
.../commons/core/data/AtomSerializer.java | 154 ++++++-------
.../commons/core/data/DeletedEntityImpl.java | 49 +++++
.../olingo/commons/core/data/DeltaLinkImpl.java | 64 ++++++
.../core/data/JSONDeltaDeserializer.java | 93 ++++++++
.../olingo/commons/core/data/JSONDeltaImpl.java | 28 +++
.../core/data/JSONEntityDeserializer.java | 200 +++++++++++++++++
.../commons/core/data/JSONEntityImpl.java | 33 +++
.../commons/core/data/JSONEntitySerializer.java | 123 +++++++++++
.../core/data/JSONEntitySetDeserializer.java | 93 ++++++++
.../commons/core/data/JSONEntitySetImpl.java | 35 +++
.../core/data/JSONEntitySetSerializer.java | 82 +++++++
.../core/data/JSONEntryDeserializer.java | 200 -----------------
.../olingo/commons/core/data/JSONEntryImpl.java | 33 ---
.../commons/core/data/JSONEntrySerializer.java | 123 -----------
.../commons/core/data/JSONFeedDeserializer.java | 90 --------
.../olingo/commons/core/data/JSONFeedImpl.java | 99 ---------
.../commons/core/data/JSONFeedSerializer.java | 82 -------
.../olingo/commons/core/data/LinkImpl.java | 24 +-
.../core/data/ODataJacksonDeserializer.java | 9 +
.../core/data/v3/JSONLinkCollectionImpl.java | 2 +-
.../core/domain/AbstractODataEntity.java | 2 +-
.../core/domain/AbstractODataEntitySet.java | 5 +-
.../core/domain/v4/ODataComplexValueImpl.java | 2 +-
.../core/edm/AbstractEdmNavigationProperty.java | 1 -
.../core/op/AbstractODataDeserializer.java | 24 +-
.../core/op/AbstractODataSerializer.java | 36 +--
.../olingo/commons/core/op/ResourceFactory.java | 84 +++----
106 files changed, 2777 insertions(+), 1966 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index a3a414d..202d118 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -68,22 +68,21 @@ import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
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.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.data.Feed;
+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.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomEntitySetImpl;
import org.apache.olingo.commons.core.data.LinkImpl;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomEntityImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
import org.apache.olingo.commons.core.data.AtomSerializer;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONEntityImpl;
import org.apache.olingo.commons.core.data.NullValueImpl;
import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
-import org.apache.olingo.fit.metadata.EntitySet;
import org.apache.olingo.fit.metadata.EntityType;
import org.apache.olingo.fit.metadata.NavigationProperty;
import org.apache.olingo.fit.methods.MERGE;
@@ -401,22 +400,22 @@ public abstract class AbstractServices {
final Accept contentTypeValue = Accept.parse(contentType, version);
- final AtomEntryImpl entryChanges;
+ final AtomEntityImpl entryChanges;
if (contentTypeValue == Accept.XML || contentTypeValue == Accept.TEXT) {
throw new UnsupportedMediaTypeException("Unsupported media type");
} else if (contentTypeValue == Accept.ATOM) {
- entryChanges = atomDeserializer.<AtomEntryImpl, AtomEntryImpl>read(
- IOUtils.toInputStream(changes, Constants.ENCODING), AtomEntryImpl.class).getPayload();
+ entryChanges = atomDeserializer.<AtomEntityImpl, AtomEntityImpl>read(
+ IOUtils.toInputStream(changes, Constants.ENCODING), AtomEntityImpl.class).getPayload();
} else {
- final ResWrap<JSONEntryImpl> jcont = mapper.readValue(IOUtils.toInputStream(changes, Constants.ENCODING),
- new TypeReference<JSONEntryImpl>() {
+ final ResWrap<JSONEntityImpl> jcont = mapper.readValue(IOUtils.toInputStream(changes, Constants.ENCODING),
+ new TypeReference<JSONEntityImpl>() {
});
- entryChanges = dataBinder.toAtomEntry(jcont.getPayload());
+ entryChanges = dataBinder.toAtomEntity(jcont.getPayload());
}
- final ResWrap<AtomEntryImpl> container = atomDeserializer.read(entityInfo.getValue(), AtomEntryImpl.class);
+ final ResWrap<AtomEntityImpl> container = atomDeserializer.read(entityInfo.getValue(), AtomEntityImpl.class);
for (Property property : entryChanges.getProperties()) {
container.getPayload().getProperty(property.getName()).setValue(property.getValue());
@@ -435,7 +434,7 @@ public abstract class AbstractServices {
final InputStream res = xml.addOrReplaceEntity(
entityId, entitySetName, new ByteArrayInputStream(content.toByteArray()), container.getPayload());
- final ResWrap<AtomEntryImpl> cres = atomDeserializer.read(res, AtomEntryImpl.class);
+ final ResWrap<AtomEntityImpl> cres = atomDeserializer.read(res, AtomEntityImpl.class);
normalizeAtomEntry(cres.getPayload(), entitySetName, entityId);
@@ -492,14 +491,14 @@ public abstract class AbstractServices {
IOUtils.toInputStream(entity, Constants.ENCODING),
xml.readEntry(acceptType, IOUtils.toInputStream(entity, Constants.ENCODING)));
- final ResWrap<AtomEntryImpl> cres;
+ final ResWrap<AtomEntityImpl> cres;
if (acceptType == Accept.ATOM) {
- cres = atomDeserializer.read(res, AtomEntryImpl.class);
+ cres = atomDeserializer.read(res, AtomEntityImpl.class);
} else {
- final ResWrap<JSONEntryImpl> jcont = mapper.readValue(res, new TypeReference<JSONEntryImpl>() {
+ final ResWrap<JSONEntityImpl> jcont = mapper.readValue(res, new TypeReference<JSONEntityImpl>() {
});
- cres = new ResWrap<AtomEntryImpl>(jcont.getContextURL(), jcont.getMetadataETag(),
- dataBinder.toAtomEntry(jcont.getPayload()));
+ cres = new ResWrap<AtomEntityImpl>(jcont.getContextURL(), jcont.getMetadataETag(),
+ dataBinder.toAtomEntity(jcont.getPayload()));
}
final String path = Commons.getEntityBasePath(entitySetName, entityId);
@@ -552,14 +551,14 @@ public abstract class AbstractServices {
throw new UnsupportedMediaTypeException("Unsupported media type");
}
- final ResWrap<AtomEntryImpl> container;
+ final ResWrap<AtomEntityImpl> container;
- final EntitySet entitySet = getMetadataObj().getEntitySet(entitySetName);
+ final org.apache.olingo.fit.metadata.EntitySet entitySet = getMetadataObj().getEntitySet(entitySetName);
- final AtomEntryImpl entry;
+ final AtomEntityImpl entry;
final String entityKey;
if (xml.isMediaContent(entitySetName)) {
- entry = new AtomEntryImpl();
+ entry = new AtomEntityImpl();
entry.setMediaContentType(ContentType.WILDCARD);
entry.setType(entitySet.getType());
@@ -584,21 +583,21 @@ public abstract class AbstractServices {
entry.setMediaContentSource(editLink.getHref() + "/$value");
- container = new ResWrap<AtomEntryImpl>((URI) null, null, entry);
+ container = new ResWrap<AtomEntityImpl>((URI) null, null, entry);
} else {
final Accept contentTypeValue = Accept.parse(contentType, version);
if (Accept.ATOM == contentTypeValue) {
- container = atomDeserializer.read(IOUtils.toInputStream(entity, Constants.ENCODING), AtomEntryImpl.class);
+ container = atomDeserializer.read(IOUtils.toInputStream(entity, Constants.ENCODING), AtomEntityImpl.class);
entry = container.getPayload();
} else {
- final ResWrap<JSONEntryImpl> jcontainer =
+ final ResWrap<JSONEntityImpl> jcontainer =
mapper.readValue(IOUtils.toInputStream(entity, Constants.ENCODING),
- new TypeReference<JSONEntryImpl>() {
+ new TypeReference<JSONEntityImpl>() {
});
- entry = dataBinder.toAtomEntry(jcontainer.getPayload());
+ entry = dataBinder.toAtomEntity(jcontainer.getPayload());
- container = new ResWrap<AtomEntryImpl>(
+ container = new ResWrap<AtomEntityImpl>(
jcontainer.getContextURL(),
jcontainer.getMetadataETag(),
entry);
@@ -618,8 +617,8 @@ public abstract class AbstractServices {
final InputStream serialization =
xml.addOrReplaceEntity(null, entitySetName, new ByteArrayInputStream(content.toByteArray()), entry);
- ResWrap<AtomEntryImpl> result = atomDeserializer.read(serialization, AtomEntryImpl.class);
- result = new ResWrap<AtomEntryImpl>(
+ ResWrap<AtomEntityImpl> result = atomDeserializer.read(serialization, AtomEntityImpl.class);
+ result = new ResWrap<AtomEntityImpl>(
URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
+ entitySetName + Constants.get(version, ConstantKey.ODATA_METADATA_ENTITY_SUFFIX)),
null, result.getPayload());
@@ -862,7 +861,7 @@ public abstract class AbstractServices {
final InputStream feed = FSManager.instance(version).readFile(builder.toString(), Accept.ATOM);
- final ResWrap<AtomFeedImpl> container = atomDeserializer.read(feed, AtomFeedImpl.class);
+ final ResWrap<AtomEntitySetImpl> container = atomDeserializer.read(feed, AtomEntitySetImpl.class);
setInlineCount(container.getPayload(), count);
@@ -872,7 +871,7 @@ public abstract class AbstractServices {
// -----------------------------------------------
// Evaluate $skip and $top
// -----------------------------------------------
- List<Entry> entries = new ArrayList<Entry>(container.getPayload().getEntries());
+ List<Entity> entries = new ArrayList<Entity>(container.getPayload().getEntities());
if (StringUtils.isNotBlank(skip)) {
entries = entries.subList(Integer.valueOf(skip), entries.size());
@@ -882,8 +881,8 @@ public abstract class AbstractServices {
entries = entries.subList(0, Integer.valueOf(top));
}
- container.getPayload().getEntries().clear();
- container.getPayload().getEntries().addAll(entries);
+ container.getPayload().getEntities().clear();
+ container.getPayload().getEntities().addAll(entries);
// -----------------------------------------------
if (acceptType == Accept.ATOM) {
@@ -893,7 +892,7 @@ public abstract class AbstractServices {
} else {
mapper.writeValue(
writer, new JSONFeedContainer(container.getContextURL(), container.getMetadataETag(),
- dataBinder.toJSONFeed(container.getPayload())));
+ dataBinder.toJSONEntitySet(container.getPayload())));
}
return xml.createResponse(
@@ -907,7 +906,7 @@ public abstract class AbstractServices {
}
}
- protected abstract void setInlineCount(final Feed feed, final String count);
+ protected abstract void setInlineCount(final EntitySet feed, final String count);
/**
* Retrieve entity with key as segment.
@@ -1000,13 +999,13 @@ public abstract class AbstractServices {
final InputStream entity = entityInfo.getValue();
- ResWrap<AtomEntryImpl> container = atomDeserializer.read(entity, AtomEntryImpl.class);
+ ResWrap<AtomEntityImpl> container = atomDeserializer.read(entity, AtomEntityImpl.class);
if (container.getContextURL() == null) {
- container = new ResWrap<AtomEntryImpl>(URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
+ container = new ResWrap<AtomEntityImpl>(URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
+ entitySetName + Constants.get(version, ConstantKey.ODATA_METADATA_ENTITY_SUFFIX)),
container.getMetadataETag(), container.getPayload());
}
- final Entry entry = container.getPayload();
+ final Entity entry = container.getPayload();
if (keyAsSegment) {
final Link editLink = new LinkImpl();
@@ -1055,16 +1054,16 @@ public abstract class AbstractServices {
rep.setType(link.getType());
if (link.getType().equals(Constants.get(version, ConstantKey.ATOM_LINK_ENTRY))) {
// inline entry
- final Entry inline = atomDeserializer.<Entry, AtomEntryImpl>read(
+ final Entity inline = atomDeserializer.<Entity, AtomEntityImpl>read(
xml.expandEntity(entitySetName, entityId, link.getTitle()),
- AtomEntryImpl.class).getPayload();
- rep.setInlineEntry(inline);
+ AtomEntityImpl.class).getPayload();
+ rep.setInlineEntity(inline);
} else if (link.getType().equals(Constants.get(version, ConstantKey.ATOM_LINK_FEED))) {
// inline feed
- final Feed inline = atomDeserializer.<Feed, AtomFeedImpl>read(
+ final EntitySet inline = atomDeserializer.<EntitySet, AtomEntitySetImpl>read(
xml.expandEntity(entitySetName, entityId, link.getTitle()),
- AtomFeedImpl.class).getPayload();
- rep.setInlineFeed(inline);
+ AtomEntitySetImpl.class).getPayload();
+ rep.setInlineEntitySet(inline);
}
replace.put(link, rep);
}
@@ -1508,7 +1507,8 @@ public abstract class AbstractServices {
final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
if (linkInfo.isFeed()) {
- final ResWrap<Feed> container = atomDeserializer.<Feed, AtomFeedImpl>read(stream, AtomFeedImpl.class);
+ final ResWrap<EntitySet> container =
+ atomDeserializer.<EntitySet, AtomEntitySetImpl>read(stream, AtomEntitySetImpl.class);
if (acceptType == Accept.ATOM) {
atomSerializer.write(writer, container);
@@ -1519,10 +1519,11 @@ public abstract class AbstractServices {
writer,
new JSONFeedContainer(container.getContextURL(),
container.getMetadataETag(),
- dataBinder.toJSONFeed((AtomFeedImpl) container.getPayload())));
+ dataBinder.toJSONEntitySet((AtomEntitySetImpl) container.getPayload())));
}
} else {
- final ResWrap<Entry> container = atomDeserializer.<Entry, AtomEntryImpl>read(stream, AtomEntryImpl.class);
+ final ResWrap<Entity> container =
+ atomDeserializer.<Entity, AtomEntityImpl>read(stream, AtomEntityImpl.class);
if (acceptType == Accept.ATOM) {
atomSerializer.write(writer, container);
writer.flush();
@@ -1532,7 +1533,7 @@ public abstract class AbstractServices {
writer,
new JSONEntryContainer(container.getContextURL(),
container.getMetadataETag(),
- dataBinder.toJSONEntry((AtomEntryImpl) container.getPayload())));
+ dataBinder.toJSONEntityType((AtomEntityImpl) container.getPayload())));
}
}
@@ -1581,7 +1582,7 @@ public abstract class AbstractServices {
final InputStream entity = entityInfo.getValue();
- final ResWrap<AtomEntryImpl> entryContainer = atomDeserializer.read(entity, AtomEntryImpl.class);
+ final ResWrap<AtomEntityImpl> entryContainer = atomDeserializer.read(entity, AtomEntityImpl.class);
final String[] pathElems = StringUtils.split(path, "/");
AtomPropertyImpl property = (AtomPropertyImpl) entryContainer.getPayload().getProperty(pathElems[0]);
@@ -1676,8 +1677,8 @@ public abstract class AbstractServices {
return utils;
}
- protected void normalizeAtomEntry(final AtomEntryImpl entry, final String entitySetName, final String entityKey) {
- final EntitySet entitySet = getMetadataObj().getEntitySet(entitySetName);
+ protected void normalizeAtomEntry(final AtomEntityImpl entry, final String entitySetName, final String entityKey) {
+ final org.apache.olingo.fit.metadata.EntitySet entitySet = getMetadataObj().getEntitySet(entitySetName);
final EntityType entityType = getMetadataObj().getEntityType(entitySet.getType());
for (Map.Entry<String, org.apache.olingo.fit.metadata.Property> property
: entityType.getPropertyMap().entrySet()) {
@@ -1700,7 +1701,7 @@ public abstract class AbstractServices {
if (!found) {
final LinkImpl link = new LinkImpl();
link.setTitle(property.getKey());
- link.setType(property.getValue().isFeed()
+ link.setType(property.getValue().isEntitySet()
? Constants.get(version, ConstantKey.ATOM_LINK_FEED)
: Constants.get(version, ConstantKey.ATOM_LINK_ENTRY));
link.setRel(Constants.get(version, ConstantKey.ATOM_LINK_REL) + property.getKey());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java b/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
index 974014b..b87b638 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3ActionOverloading.java
@@ -40,7 +40,7 @@ import javax.ws.rs.core.UriInfo;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
-import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import static org.apache.olingo.fit.AbstractServices.LOG;
import org.apache.olingo.fit.utils.AbstractUtilities;
@@ -206,7 +206,7 @@ public class V3ActionOverloading extends AbstractServices {
}
@Override
- protected void setInlineCount(Feed feed, String count) {
+ protected void setInlineCount(EntitySet feed, String count) {
throw new UnsupportedOperationException("Not supported yet.");
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3Services.java b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
index 66b1150..4c08cf9 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
@@ -45,7 +45,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
-import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.fit.methods.MERGE;
import org.apache.olingo.fit.methods.PATCH;
@@ -109,9 +109,9 @@ public class V3Services extends AbstractServices {
}
@Override
- protected void setInlineCount(final Feed feed, final String count) {
+ protected void setInlineCount(final EntitySet feed, final String count) {
if ("allpages".equals(count)) {
- feed.setCount(feed.getEntries().size());
+ feed.setCount(feed.getEntities().size());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 38d8696..386d97b 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -55,17 +55,17 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ResWrap;
-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.Property;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomEntityImpl;
+import org.apache.olingo.commons.core.data.AtomEntitySetImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
import org.apache.olingo.commons.core.data.CollectionValueImpl;
import org.apache.olingo.commons.core.data.EnumValueImpl;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONEntityImpl;
import org.apache.olingo.commons.core.data.JSONPropertyImpl;
import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
@@ -192,7 +192,7 @@ public class V4Services extends AbstractServices {
final UUID uuid = UUID.randomUUID();
providedAsync.put(uuid.toString(), bos.toString(Constants.ENCODING.toString()));
-
+
bos.flush();
bos.close();
@@ -242,9 +242,9 @@ public class V4Services extends AbstractServices {
}
@Override
- protected void setInlineCount(final Feed feed, final String count) {
+ protected void setInlineCount(final EntitySet feed, final String count) {
if ("true".equals(count)) {
- feed.setCount(feed.getEntries().size());
+ feed.setCount(feed.getEntities().size());
}
}
@@ -392,7 +392,7 @@ public class V4Services extends AbstractServices {
}
final Accept contentTypeValue = Accept.parse(contentType, version);
- final Entry entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+ final Entity entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
return xml.createResponse(
null,
@@ -419,7 +419,7 @@ public class V4Services extends AbstractServices {
acceptType = Accept.parse(accept, version);
}
- final AtomEntryImpl entry = new AtomEntryImpl();
+ final AtomEntityImpl entry = new AtomEntityImpl();
entry.setType("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail");
final Property productId = new AtomPropertyImpl();
productId.setName("ProductID");
@@ -432,10 +432,10 @@ public class V4Services extends AbstractServices {
productDetailId.setValue(new PrimitiveValueImpl("2"));
entry.getProperties().add(productDetailId);
- final AtomFeedImpl feed = new AtomFeedImpl();
- feed.getEntries().add(entry);
+ final AtomEntitySetImpl feed = new AtomEntitySetImpl();
+ feed.getEntities().add(entry);
- final ResWrap<AtomFeedImpl> container = new ResWrap<AtomFeedImpl>(
+ final ResWrap<AtomEntitySetImpl> container = new ResWrap<AtomEntitySetImpl>(
URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX) + "ProductDetail"), null,
feed);
@@ -466,7 +466,7 @@ public class V4Services extends AbstractServices {
}
final Accept contentTypeValue = Accept.parse(contentType, version);
- final Entry entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+ final Entity entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
assert 1 == entry.getProperties().size();
assert entry.getProperty("accessRight") != null;
@@ -495,7 +495,7 @@ public class V4Services extends AbstractServices {
try {
final Accept contentTypeValue = Accept.parse(contentType, version);
- final Entry entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+ final Entity entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
assert 2 == entry.getProperties().size();
assert entry.getProperty("addresses") != null;
@@ -532,7 +532,7 @@ public class V4Services extends AbstractServices {
try {
final Accept contentTypeValue = Accept.parse(contentType, version);
- final Entry entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+ final Entity entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
assert 1 == entry.getProperties().size();
assert entry.getProperty("newDate") != null;
@@ -619,7 +619,7 @@ public class V4Services extends AbstractServices {
return utils.getValue().createResponse(
FSManager.instance(version).readFile(Constants.get(version, ConstantKey.REF)
- + File.separatorChar + filename, utils.getKey()),
+ + File.separatorChar + filename, utils.getKey()),
null,
utils.getKey());
} catch (Exception e) {
@@ -641,7 +641,7 @@ public class V4Services extends AbstractServices {
final Response response =
getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY, false);
+ accept, entitySetName, entityId, accept, StringUtils.EMPTY, StringUtils.EMPTY, false);
return response.getStatus() >= 400
? postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, changes)
: super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes);
@@ -699,7 +699,7 @@ public class V4Services extends AbstractServices {
}
final InputStream entry = FSManager.instance(version).readFile(containedPath.toString(), Accept.ATOM);
- final ResWrap<AtomEntryImpl> container = atomDeserializer.read(entry, AtomEntryImpl.class);
+ final ResWrap<AtomEntityImpl> container = atomDeserializer.read(entry, AtomEntityImpl.class);
return xml.createResponse(
null,
@@ -730,21 +730,21 @@ public class V4Services extends AbstractServices {
final AbstractUtilities utils = getUtilities(acceptType);
// 1. parse the entry (from Atom or JSON) into AtomEntryImpl
- final ResWrap<AtomEntryImpl> entryContainer;
- final AtomEntryImpl entry;
+ final ResWrap<AtomEntityImpl> entryContainer;
+ final AtomEntityImpl entry;
final Accept contentTypeValue = Accept.parse(contentType, version);
if (Accept.ATOM == contentTypeValue) {
- entryContainer = atomDeserializer.read(IOUtils.toInputStream(entity, Constants.ENCODING), AtomEntryImpl.class);
+ entryContainer = atomDeserializer.read(IOUtils.toInputStream(entity, Constants.ENCODING), AtomEntityImpl.class);
entry = entryContainer.getPayload();
} else {
- final ResWrap<JSONEntryImpl> jcontainer =
+ final ResWrap<JSONEntityImpl> jcontainer =
mapper.readValue(IOUtils.toInputStream(entity, Constants.ENCODING),
- new TypeReference<JSONEntryImpl>() {
- });
+ new TypeReference<JSONEntityImpl>() {
+ });
- entry = dataBinder.toAtomEntry(jcontainer.getPayload());
+ entry = dataBinder.toAtomEntity(jcontainer.getPayload());
- entryContainer = new ResWrap<AtomEntryImpl>(
+ entryContainer = new ResWrap<AtomEntityImpl>(
jcontainer.getContextURL(),
jcontainer.getMetadataETag(),
entry);
@@ -765,8 +765,8 @@ public class V4Services extends AbstractServices {
// 3. Update the contained entity set
final String atomFeedRelativePath = containedPath(entityId, containedEntitySetName).toString();
final InputStream feedIS = FSManager.instance(version).readFile(atomFeedRelativePath, Accept.ATOM);
- final ResWrap<AtomFeedImpl> feedContainer = atomDeserializer.read(feedIS, AtomFeedImpl.class);
- feedContainer.getPayload().getEntries().add(entry);
+ final ResWrap<AtomEntitySetImpl> feedContainer = atomDeserializer.read(feedIS, AtomEntitySetImpl.class);
+ feedContainer.getPayload().getEntities().add(entry);
final ByteArrayOutputStream content = new ByteArrayOutputStream();
final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
@@ -823,12 +823,12 @@ public class V4Services extends AbstractServices {
final LinkInfo links = xml.readLinks(
entitySetName, entityId, containedEntitySetName + "(" + containedEntityId + ")", Accept.ATOM);
- ResWrap<AtomEntryImpl> container = atomDeserializer.read(links.getLinks(), AtomEntryImpl.class);
- final AtomEntryImpl original = container.getPayload();
+ ResWrap<AtomEntityImpl> container = atomDeserializer.read(links.getLinks(), AtomEntityImpl.class);
+ final AtomEntityImpl original = container.getPayload();
- final AtomEntryImpl entryChanges;
+ final AtomEntityImpl entryChanges;
if (Accept.ATOM == contentTypeValue) {
- container = atomDeserializer.read(IOUtils.toInputStream(changes, Constants.ENCODING), AtomEntryImpl.class);
+ container = atomDeserializer.read(IOUtils.toInputStream(changes, Constants.ENCODING), AtomEntityImpl.class);
entryChanges = container.getPayload();
} else {
final String entityType = getMetadataObj().getEntitySet(entitySetName).getType();
@@ -836,11 +836,11 @@ public class V4Services extends AbstractServices {
getNavigationProperty(containedEntitySetName).getType();
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(containedType).build();
- final ResWrap<JSONEntryImpl> jsonContainer = mapper.readValue(
- IOUtils.toInputStream(changes, Constants.ENCODING), new TypeReference<JSONEntryImpl>() {
- });
+ final ResWrap<JSONEntityImpl> jsonContainer = mapper.readValue(
+ IOUtils.toInputStream(changes, Constants.ENCODING), new TypeReference<JSONEntityImpl>() {
+ });
jsonContainer.getPayload().setType(typeInfo.getFullQualifiedName().toString());
- entryChanges = dataBinder.toAtomEntry(jsonContainer.getPayload());
+ entryChanges = dataBinder.toAtomEntity(jsonContainer.getPayload());
}
for (Property property : entryChanges.getProperties()) {
@@ -851,7 +851,7 @@ public class V4Services extends AbstractServices {
original.getProperties().add(property);
}
- FSManager.instance(version).putInMemory(new ResWrap<AtomEntryImpl>((URI) null, null, original),
+ FSManager.instance(version).putInMemory(new ResWrap<AtomEntityImpl>((URI) null, null, original),
xml.getLinksBasePath(entitySetName, entityId) + containedEntitySetName + "(" + containedEntityId + ")");
return xml.createResponse(null, null, acceptType, Response.Status.NO_CONTENT);
@@ -871,8 +871,8 @@ public class V4Services extends AbstractServices {
// 1. Fetch the contained entity to be removed
final InputStream entry = FSManager.instance(version).
readFile(containedPath(entityId, containedEntitySetName).
- append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
- final ResWrap<AtomEntryImpl> container = atomDeserializer.read(entry, AtomEntryImpl.class);
+ append('(').append(containedEntityId).append(')').toString(), Accept.ATOM);
+ final ResWrap<AtomEntityImpl> container = atomDeserializer.read(entry, AtomEntityImpl.class);
// 2. Remove the contained entity
final String atomEntryRelativePath = containedPath(entityId, containedEntitySetName).
@@ -882,8 +882,8 @@ public class V4Services extends AbstractServices {
// 3. Update the contained entity set
final String atomFeedRelativePath = containedPath(entityId, containedEntitySetName).toString();
final InputStream feedIS = FSManager.instance(version).readFile(atomFeedRelativePath, Accept.ATOM);
- final ResWrap<AtomFeedImpl> feedContainer = atomDeserializer.read(feedIS, AtomFeedImpl.class);
- feedContainer.getPayload().getEntries().remove(container.getPayload());
+ final ResWrap<AtomEntitySetImpl> feedContainer = atomDeserializer.read(feedIS, AtomEntitySetImpl.class);
+ feedContainer.getPayload().getEntities().remove(container.getPayload());
final ByteArrayOutputStream content = new ByteArrayOutputStream();
final OutputStreamWriter writer = new OutputStreamWriter(content, Constants.ENCODING);
@@ -927,7 +927,7 @@ public class V4Services extends AbstractServices {
final InputStream feed = FSManager.instance(version).
readFile(containedPath(entityId, containedEntitySetName).toString(), Accept.ATOM);
- final ResWrap<AtomFeedImpl> container = atomDeserializer.read(feed, AtomFeedImpl.class);
+ final ResWrap<AtomEntitySetImpl> container = atomDeserializer.read(feed, AtomEntitySetImpl.class);
return xml.createResponse(
null,
@@ -1100,8 +1100,8 @@ public class V4Services extends AbstractServices {
} else {
final ResWrap<JSONPropertyImpl> paramContainer =
mapper.readValue(IOUtils.toInputStream(param, Constants.ENCODING),
- new TypeReference<JSONPropertyImpl>() {
- });
+ new TypeReference<JSONPropertyImpl>() {
+ });
property = paramContainer.getPayload();
}
@@ -1142,8 +1142,8 @@ public class V4Services extends AbstractServices {
} else {
final ResWrap<JSONPropertyImpl> paramContainer =
mapper.readValue(IOUtils.toInputStream(param, Constants.ENCODING),
- new TypeReference<JSONPropertyImpl>() {
- });
+ new TypeReference<JSONPropertyImpl>() {
+ });
property = paramContainer.getPayload();
}
@@ -1177,7 +1177,7 @@ public class V4Services extends AbstractServices {
}
final Accept contentTypeValue = Accept.parse(contentType, version);
- final Entry entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
+ final Entity entry = xml.readEntry(contentTypeValue, IOUtils.toInputStream(param, Constants.ENCODING));
assert 1 == entry.getProperties().size();
assert "Collection(Edm.String)".equals(entry.getProperty("emails").getType());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java
index ebd599b..af6518c 100644
--- a/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/Metadata.java
@@ -81,7 +81,7 @@ public class Metadata extends AbstractMetadataElement {
property.getReleationship().replaceAll(schemaEntry.getKey() + "\\.", ""));
final Association.Role role = association.getRole(property.getToRole());
property.setFeed(role.getMultiplicity().equals("*"));
- property.setType(property.isFeed() ? "Collection(" + role.getType() + ")" : role.getType());
+ property.setType(property.isEntitySet() ? "Collection(" + role.getType() + ")" : role.getType());
// let me assume that it will be just a single container
final AssociationSet associationSet = schemaEntry.getValue().getContainers().iterator().next().
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java
index eb3a74f..ab3a88b 100644
--- a/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java
+++ b/fit/src/main/java/org/apache/olingo/fit/metadata/NavigationProperty.java
@@ -34,7 +34,7 @@ public class NavigationProperty extends AbstractMetadataElement {
private String target;
- private boolean feed;
+ private boolean entitySet;
public NavigationProperty(final String name) {
this.name = name;
@@ -76,11 +76,11 @@ public class NavigationProperty extends AbstractMetadataElement {
this.target = target;
}
- public boolean isFeed() {
- return feed;
+ public boolean isEntitySet() {
+ return entitySet;
}
- public void setFeed(boolean feed) {
- this.feed = feed;
+ public void setFeed(boolean entitySet) {
+ this.entitySet = entitySet;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/serializer/JSONEntryContainer.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/serializer/JSONEntryContainer.java b/fit/src/main/java/org/apache/olingo/fit/serializer/JSONEntryContainer.java
index 364380d..0d3318d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/serializer/JSONEntryContainer.java
+++ b/fit/src/main/java/org/apache/olingo/fit/serializer/JSONEntryContainer.java
@@ -22,15 +22,15 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.core.data.JSONEntryDeserializer;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONEntrySerializer;
+import org.apache.olingo.commons.core.data.JSONEntityDeserializer;
+import org.apache.olingo.commons.core.data.JSONEntityImpl;
+import org.apache.olingo.commons.core.data.JSONEntitySerializer;
-@JsonDeserialize(using = JSONEntryDeserializer.class)
-@JsonSerialize(using = JSONEntrySerializer.class)
-public class JSONEntryContainer extends ResWrap<JSONEntryImpl> {
+@JsonDeserialize(using = JSONEntityDeserializer.class)
+@JsonSerialize(using = JSONEntitySerializer.class)
+public class JSONEntryContainer extends ResWrap<JSONEntityImpl> {
- public JSONEntryContainer(final ContextURL contextURL, final String metadataETag, final JSONEntryImpl object) {
+ public JSONEntryContainer(final ContextURL contextURL, final String metadataETag, final JSONEntityImpl object) {
super(contextURL, metadataETag, object);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/serializer/JSONFeedContainer.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/serializer/JSONFeedContainer.java b/fit/src/main/java/org/apache/olingo/fit/serializer/JSONFeedContainer.java
index 7a53213..c641444 100644
--- a/fit/src/main/java/org/apache/olingo/fit/serializer/JSONFeedContainer.java
+++ b/fit/src/main/java/org/apache/olingo/fit/serializer/JSONFeedContainer.java
@@ -22,15 +22,15 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.data.ResWrap;
-import org.apache.olingo.commons.core.data.JSONFeedDeserializer;
-import org.apache.olingo.commons.core.data.JSONFeedImpl;
-import org.apache.olingo.commons.core.data.JSONFeedSerializer;
+import org.apache.olingo.commons.core.data.JSONEntitySetDeserializer;
+import org.apache.olingo.commons.core.data.JSONEntitySetImpl;
+import org.apache.olingo.commons.core.data.JSONEntitySetSerializer;
-@JsonDeserialize(using = JSONFeedDeserializer.class)
-@JsonSerialize(using = JSONFeedSerializer.class)
-public class JSONFeedContainer extends ResWrap<JSONFeedImpl> {
+@JsonDeserialize(using = JSONEntitySetDeserializer.class)
+@JsonSerialize(using = JSONEntitySetSerializer.class)
+public class JSONFeedContainer extends ResWrap<JSONEntitySetImpl> {
- public JSONFeedContainer(final ContextURL contextURL, final String metadataETag, final JSONFeedImpl object) {
+ public JSONFeedContainer(final ContextURL contextURL, final String metadataETag, final JSONEntitySetImpl object) {
super(contextURL, metadataETag, object);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
index c017186..57e2049 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
@@ -43,16 +43,16 @@ import javax.xml.stream.XMLStreamException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.vfs2.FileObject;
-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.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomEntityImpl;
+import org.apache.olingo.commons.core.data.AtomEntitySetImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
import org.apache.olingo.commons.core.data.AtomSerializer;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import org.apache.olingo.commons.core.data.JSONEntityImpl;
import org.apache.olingo.commons.core.data.JSONPropertyImpl;
import org.apache.olingo.fit.UnsupportedMediaTypeException;
import org.apache.olingo.fit.metadata.Metadata;
@@ -199,7 +199,7 @@ public abstract class AbstractUtilities {
return fo.getContent().getInputStream();
}
- private InputStream toInputStream(final AtomEntryImpl entry) throws XMLStreamException {
+ private InputStream toInputStream(final AtomEntityImpl entry) throws XMLStreamException {
final StringWriter writer = new StringWriter();
atomSerializer.write(writer, entry);
@@ -210,7 +210,7 @@ public abstract class AbstractUtilities {
final String key,
final String entitySetName,
final InputStream is,
- final AtomEntryImpl entry) throws Exception {
+ final AtomEntityImpl entry) throws Exception {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(is, bos);
@@ -297,27 +297,27 @@ public abstract class AbstractUtilities {
navigationProperties == null ? null : navigationProperties.get(link.getTitle());
if (navProp != null) {
final String inlineEntitySetName = navProp.getTarget();
- if (link.getInlineEntry() != null) {
+ if (link.getInlineEntity() != null) {
final String inlineEntryKey = getDefaultEntryKey(
- inlineEntitySetName, (AtomEntryImpl) link.getInlineEntry());
+ inlineEntitySetName, (AtomEntityImpl) link.getInlineEntity());
addOrReplaceEntity(
inlineEntryKey,
inlineEntitySetName,
- toInputStream((AtomEntryImpl) link.getInlineEntry()),
- (AtomEntryImpl) link.getInlineEntry());
+ toInputStream((AtomEntityImpl) link.getInlineEntity()),
+ (AtomEntityImpl) link.getInlineEntity());
hrefs.add(inlineEntitySetName + "(" + inlineEntryKey + ")");
- } else if (link.getInlineFeed() != null) {
- for (Entry subentry : link.getInlineFeed().getEntries()) {
+ } else if (link.getInlineEntitySet() != null) {
+ for (Entity subentry : link.getInlineEntitySet().getEntities()) {
final String inlineEntryKey = getDefaultEntryKey(
- inlineEntitySetName, (AtomEntryImpl) subentry);
+ inlineEntitySetName, (AtomEntityImpl) subentry);
addOrReplaceEntity(
inlineEntryKey,
inlineEntitySetName,
- toInputStream((AtomEntryImpl) subentry),
- (AtomEntryImpl) subentry);
+ toInputStream((AtomEntityImpl) subentry),
+ (AtomEntityImpl) subentry);
hrefs.add(inlineEntitySetName + "(" + inlineEntryKey + ")");
}
@@ -365,7 +365,7 @@ public abstract class AbstractUtilities {
final Metadata metadata = Commons.getMetadata(version);
final Map<String, NavigationProperty> navigationProperties = metadata.getNavigationProperties(entitySetName);
- if (navigationProperties.get(linkName).isFeed()) {
+ if (navigationProperties.get(linkName).isEntitySet()) {
try {
final Map.Entry<String, List<String>> currents = extractLinkURIs(entitySetName, entityKey, linkName);
uris.addAll(currents.getValue());
@@ -540,7 +540,7 @@ public abstract class AbstractUtilities {
return builder.build();
}
- public InputStream writeFeed(final Accept accept, final ResWrap<AtomFeedImpl> container)
+ public InputStream writeFeed(final Accept accept, final ResWrap<AtomEntitySetImpl> container)
throws XMLStreamException, IOException {
final StringWriter writer = new StringWriter();
@@ -551,31 +551,31 @@ public abstract class AbstractUtilities {
} else {
mapper.writeValue(
writer, new JSONFeedContainer(container.getContextURL(),
- container.getMetadataETag(), dataBinder.toJSONFeed(container.getPayload())));
+ container.getMetadataETag(), dataBinder.toJSONEntitySet(container.getPayload())));
}
return IOUtils.toInputStream(writer.toString(), Constants.ENCODING);
}
- public AtomEntryImpl readEntry(final Accept accept, final InputStream entity)
+ public AtomEntityImpl readEntry(final Accept accept, final InputStream entity)
throws XMLStreamException, IOException {
- final AtomEntryImpl entry;
+ final AtomEntityImpl entry;
if (accept == Accept.ATOM || accept == Accept.XML) {
- final ResWrap<AtomEntryImpl> container = atomDeserializer.read(entity, AtomEntryImpl.class);
+ final ResWrap<AtomEntityImpl> container = atomDeserializer.read(entity, AtomEntityImpl.class);
entry = container.getPayload();
} else {
- final ResWrap<JSONEntryImpl> container =
- mapper.readValue(entity, new TypeReference<JSONEntryImpl>() {
+ final ResWrap<JSONEntityImpl> container =
+ mapper.readValue(entity, new TypeReference<JSONEntityImpl>() {
});
- entry = dataBinder.toAtomEntry(container.getPayload());
+ entry = dataBinder.toAtomEntity(container.getPayload());
}
return entry;
}
- public InputStream writeEntry(final Accept accept, final ResWrap<AtomEntryImpl> container)
+ public InputStream writeEntry(final Accept accept, final ResWrap<AtomEntityImpl> container)
throws XMLStreamException, IOException {
final StringWriter writer = new StringWriter();
@@ -584,7 +584,7 @@ public abstract class AbstractUtilities {
} else {
mapper.writeValue(
writer, new JSONEntryContainer(container.getContextURL(), container.getMetadataETag(),
- dataBinder.toJSONEntry(container.getPayload())));
+ dataBinder.toJSONEntityType(container.getPayload())));
}
return IOUtils.toInputStream(writer.toString(), Constants.ENCODING);
@@ -620,7 +620,7 @@ public abstract class AbstractUtilities {
return IOUtils.toInputStream(writer.toString(), Constants.ENCODING);
}
- private String getDefaultEntryKey(final String entitySetName, final AtomEntryImpl entry, final String propertyName)
+ private String getDefaultEntryKey(final String entitySetName, final AtomEntityImpl entry, final String propertyName)
throws Exception {
String res;
@@ -638,7 +638,7 @@ public abstract class AbstractUtilities {
return res;
}
- public String getDefaultEntryKey(final String entitySetName, final AtomEntryImpl entry) throws IOException {
+ public String getDefaultEntryKey(final String entitySetName, final AtomEntityImpl entry) throws IOException {
try {
String res;
@@ -734,7 +734,7 @@ public abstract class AbstractUtilities {
final Metadata metadata = Commons.getMetadata(version);
final Map<String, NavigationProperty> navigationProperties = metadata.getNavigationProperties(entitySetName);
- linkInfo.setFeed(navigationProperties.get(linkName.replaceAll("\\(.*\\)", "")).isFeed());
+ linkInfo.setFeed(navigationProperties.get(linkName.replaceAll("\\(.*\\)", "")).isEntitySet());
return linkInfo;
}
@@ -800,7 +800,7 @@ public abstract class AbstractUtilities {
links.getValue(),
linkName,
links.getKey(),
- navigationProperties.get(linkName).isFeed());
+ navigationProperties.get(linkName).isEntitySet());
}
public InputStream expandEntity(
@@ -832,8 +832,8 @@ public abstract class AbstractUtilities {
InputStream stream = fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
stream = replaceProperty(stream, changes, path, justValue);
- final AtomEntryImpl entry = readEntry(acceptType, stream);
- final ResWrap<AtomEntryImpl> container = new ResWrap<AtomEntryImpl>((URI) null, null, entry);
+ final AtomEntityImpl entry = readEntry(acceptType, stream);
+ final ResWrap<AtomEntityImpl> container = new ResWrap<AtomEntityImpl>((URI) null, null, entry);
fsManager.putInMemory(writeEntry(Accept.ATOM, container),
fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.ENTITY), Accept.ATOM));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java b/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
index c9b3646..2b69f39 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/DataBinder.java
@@ -18,25 +18,24 @@
*/
package org.apache.olingo.fit.utils;
-import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-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.data.Value;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.AtomFeedImpl;
+import org.apache.olingo.commons.core.data.AtomEntityImpl;
+import org.apache.olingo.commons.core.data.AtomEntitySetImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
import org.apache.olingo.commons.core.data.CollectionValueImpl;
import org.apache.olingo.commons.core.data.ComplexValueImpl;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONEntityImpl;
+import org.apache.olingo.commons.core.data.JSONEntitySetImpl;
import org.apache.olingo.commons.core.data.JSONPropertyImpl;
import org.apache.olingo.commons.core.data.LinkImpl;
import org.apache.olingo.fit.metadata.EntityType;
@@ -52,157 +51,157 @@ public class DataBinder {
this.version = version;
}
- public JSONFeedImpl toJSONFeed(final AtomFeedImpl atomfeed) {
- final JSONFeedImpl jsonfeed = new JSONFeedImpl();
+ public JSONEntitySetImpl toJSONEntitySet(final AtomEntitySetImpl atomEntitySet) {
+ final JSONEntitySetImpl jsonEntitySet = new JSONEntitySetImpl();
- BeanUtils.copyProperties(atomfeed, jsonfeed, "baseURI", "metadataContextURL");
- jsonfeed.setMetadataContextURL(atomfeed.getBaseURI() == null
+ BeanUtils.copyProperties(atomEntitySet, jsonEntitySet, "baseURI", "metadataContextURL");
+ jsonEntitySet.setBaseURI(atomEntitySet.getBaseURI() == null
? null
- : URI.create(atomfeed.getBaseURI().toASCIIString() + "/$metadata").normalize());
+ : atomEntitySet.getBaseURI().toASCIIString() + "/$metadata");
- final Collection<Entry> entries = jsonfeed.getEntries();
- for (Entry entry : atomfeed.getEntries()) {
- entries.add(toJSONEntry((AtomEntryImpl) entry));
+ final Collection<Entity> entries = jsonEntitySet.getEntities();
+ for (Entity entity : atomEntitySet.getEntities()) {
+ entries.add(toJSONEntityType((AtomEntityImpl) entity));
}
- return jsonfeed;
+ return jsonEntitySet;
}
- public AtomFeedImpl toAtomFeed(final JSONFeedImpl jsonfeed) {
- final AtomFeedImpl atomfeed = new AtomFeedImpl();
+ public AtomEntitySetImpl toAtomEntitySet(final JSONEntitySetImpl jsonEntitySet) {
+ final AtomEntitySetImpl atomEntitySet = new AtomEntitySetImpl();
- BeanUtils.copyProperties(jsonfeed, atomfeed, "baseURI", "metadataContextURL");
- atomfeed.setBaseURI(jsonfeed.getBaseURI() == null
+ BeanUtils.copyProperties(jsonEntitySet, atomEntitySet, "baseURI", "metadataContextURL");
+ atomEntitySet.setBaseURI(jsonEntitySet.getBaseURI() == null
? null
- : jsonfeed.getBaseURI().toASCIIString() + "/$metadata");
+ : jsonEntitySet.getBaseURI().toASCIIString() + "/$metadata");
- final Collection<Entry> entries = atomfeed.getEntries();
- for (Entry entry : jsonfeed.getEntries()) {
- entries.add(toAtomEntry((JSONEntryImpl) entry));
+ final Collection<Entity> entries = atomEntitySet.getEntities();
+ for (Entity entity : jsonEntitySet.getEntities()) {
+ entries.add(toAtomEntity((JSONEntityImpl) entity));
}
- return atomfeed;
+ return atomEntitySet;
}
- public JSONEntryImpl toJSONEntry(final AtomEntryImpl atomentry) {
- final JSONEntryImpl jsonentry = new JSONEntryImpl();
+ public JSONEntityImpl toJSONEntityType(final AtomEntityImpl atomEntity) {
+ final JSONEntityImpl jsonEntity = new JSONEntityImpl();
- BeanUtils.copyProperties(atomentry, jsonentry, "baseURI", "properties", "links");
- jsonentry.setBaseURI(atomentry.getBaseURI() == null ? null : atomentry.getBaseURI().toASCIIString());
- jsonentry.getOperations().addAll(atomentry.getOperations());
+ BeanUtils.copyProperties(atomEntity, jsonEntity, "baseURI", "properties", "links");
+ jsonEntity.setBaseURI(atomEntity.getBaseURI() == null ? null : atomEntity.getBaseURI().toASCIIString());
+ jsonEntity.getOperations().addAll(atomEntity.getOperations());
- for (Link link : atomentry.getNavigationLinks()) {
+ for (Link link : atomEntity.getNavigationLinks()) {
final Link jlink = new LinkImpl();
jlink.setHref(link.getHref());
jlink.setTitle(link.getTitle());
jlink.setType(link.getType());
jlink.setRel(link.getRel());
- if (link.getInlineEntry() instanceof AtomEntryImpl) {
- final Entry inlineEntry = link.getInlineEntry();
- if (inlineEntry instanceof AtomEntryImpl) {
- jlink.setInlineEntry(toJSONEntry((AtomEntryImpl) link.getInlineEntry()));
+ if (link.getInlineEntity() instanceof AtomEntityImpl) {
+ final Entity inlineEntity = link.getInlineEntity();
+ if (inlineEntity instanceof AtomEntityImpl) {
+ jlink.setInlineEntity(toJSONEntityType((AtomEntityImpl) link.getInlineEntity()));
}
- } else if (link.getInlineFeed() instanceof AtomFeedImpl) {
- final Feed inlineFeed = link.getInlineFeed();
- if (inlineFeed instanceof AtomFeedImpl) {
- jlink.setInlineFeed(toJSONFeed((AtomFeedImpl) link.getInlineFeed()));
+ } else if (link.getInlineEntitySet() instanceof AtomEntitySetImpl) {
+ final EntitySet inlineEntitySet = link.getInlineEntitySet();
+ if (inlineEntitySet instanceof AtomEntitySetImpl) {
+ jlink.setInlineEntitySet(toJSONEntitySet((AtomEntitySetImpl) link.getInlineEntitySet()));
}
}
- jsonentry.getNavigationLinks().add(jlink);
+ jsonEntity.getNavigationLinks().add(jlink);
}
- final Collection<Property> properties = jsonentry.getProperties();
- for (Property property : atomentry.getProperties()) {
+ final Collection<Property> properties = jsonEntity.getProperties();
+ for (Property property : atomEntity.getProperties()) {
properties.add(toJSONProperty((AtomPropertyImpl) property));
}
- return jsonentry;
+ return jsonEntity;
}
- public AtomEntryImpl toAtomEntry(final JSONEntryImpl jsonentry) {
- final AtomEntryImpl atomentry = new AtomEntryImpl();
+ public AtomEntityImpl toAtomEntity(final JSONEntityImpl jsonEntity) {
+ final AtomEntityImpl atomEntity = new AtomEntityImpl();
final Metadata metadata = Commons.getMetadata(version);
- BeanUtils.copyProperties(jsonentry, atomentry, "baseURI", "properties", "links");
- atomentry.setBaseURI(jsonentry.getBaseURI() == null ? null : jsonentry.getBaseURI().toASCIIString());
+ BeanUtils.copyProperties(jsonEntity, atomEntity, "baseURI", "properties", "links");
+ atomEntity.setBaseURI(jsonEntity.getBaseURI() == null ? null : jsonEntity.getBaseURI().toASCIIString());
- for (Link link : jsonentry.getNavigationLinks()) {
+ for (Link link : jsonEntity.getNavigationLinks()) {
final Link alink = new LinkImpl();
alink.setHref(link.getHref());
alink.setTitle(link.getTitle());
final NavigationProperty navPropDetails =
- metadata.getEntityType(jsonentry.getType()).getNavigationProperty(link.getTitle());
+ metadata.getEntityType(jsonEntity.getType()).getNavigationProperty(link.getTitle());
- alink.setType(navPropDetails != null && navPropDetails.isFeed()
+ alink.setType(navPropDetails != null && navPropDetails.isEntitySet()
? Constants.get(ConstantKey.ATOM_LINK_FEED) : Constants.get(ConstantKey.ATOM_LINK_ENTRY));
alink.setRel(link.getRel());
- if (link.getInlineEntry() instanceof JSONEntryImpl) {
- final Entry inlineEntry = link.getInlineEntry();
- if (inlineEntry instanceof JSONEntryImpl) {
- alink.setInlineEntry(toAtomEntry((JSONEntryImpl) link.getInlineEntry()));
+ if (link.getInlineEntity() instanceof JSONEntityImpl) {
+ final Entity inlineEntity = link.getInlineEntity();
+ if (inlineEntity instanceof JSONEntityImpl) {
+ alink.setInlineEntity(toAtomEntity((JSONEntityImpl) link.getInlineEntity()));
}
- } else if (link.getInlineFeed() instanceof JSONFeedImpl) {
- final Feed inlineFeed = link.getInlineFeed();
- if (inlineFeed instanceof JSONFeedImpl) {
- alink.setInlineFeed(toAtomFeed((JSONFeedImpl) link.getInlineFeed()));
+ } else if (link.getInlineEntitySet() instanceof JSONEntitySetImpl) {
+ final EntitySet inlineEntitySet = link.getInlineEntitySet();
+ if (inlineEntitySet instanceof JSONEntitySetImpl) {
+ alink.setInlineEntitySet(toAtomEntitySet((JSONEntitySetImpl) link.getInlineEntitySet()));
}
}
- atomentry.getNavigationLinks().add(alink);
+ atomEntity.getNavigationLinks().add(alink);
}
- final EntityType entityType = StringUtils.isBlank(jsonentry.getType())
- ? null : metadata.getEntityType(jsonentry.getType());
+ final EntityType entityType = StringUtils.isBlank(jsonEntity.getType())
+ ? null : metadata.getEntityType(jsonEntity.getType());
final Map<String, NavigationProperty> navProperties = entityType == null
? Collections.<String, NavigationProperty>emptyMap() : entityType.getNavigationPropertyMap();
- final List<Property> properties = atomentry.getProperties();
+ final List<Property> properties = atomEntity.getProperties();
- for (Property property : jsonentry.getProperties()) {
+ for (Property property : jsonEntity.getProperties()) {
if (navProperties.containsKey(property.getName())) {
final Link alink = new LinkImpl();
alink.setTitle(property.getName());
- alink.setType(navProperties.get(property.getName()).isFeed()
+ alink.setType(navProperties.get(property.getName()).isEntitySet()
? Constants.get(version, ConstantKey.ATOM_LINK_FEED)
: Constants.get(version, ConstantKey.ATOM_LINK_ENTRY));
alink.setRel(Constants.get(version, ConstantKey.ATOM_LINK_REL) + property.getName());
if (property.getValue().isComplex()) {
- final Entry inline = new AtomEntryImpl();
+ final Entity inline = new AtomEntityImpl();
inline.setType(navProperties.get(property.getName()).getType());
for (Property prop : property.getValue().asComplex().get()) {
inline.getProperties().add(prop);
}
- alink.setInlineEntry(inline);
+ alink.setInlineEntity(inline);
} else if (property.getValue().isCollection()) {
- final Feed inline = new AtomFeedImpl();
- for (Value entry : property.getValue().asCollection().get()) {
- final Entry inlineEntry = new AtomEntryImpl();
- inlineEntry.setType(navProperties.get(property.getName()).getType());
- for (Property prop : entry.asComplex().get()) {
- inlineEntry.getProperties().add(toAtomProperty((JSONPropertyImpl) prop, inlineEntry.getType()));
+ final EntitySet inline = new AtomEntitySetImpl();
+ for (Value value : property.getValue().asCollection().get()) {
+ final Entity inlineEntity = new AtomEntityImpl();
+ inlineEntity.setType(navProperties.get(property.getName()).getType());
+ for (Property prop : value.asComplex().get()) {
+ inlineEntity.getProperties().add(toAtomProperty((JSONPropertyImpl) prop, inlineEntity.getType()));
}
- inline.getEntries().add(inlineEntry);
+ inline.getEntities().add(inlineEntity);
}
- alink.setInlineFeed(inline);
+ alink.setInlineEntitySet(inline);
} else {
throw new IllegalStateException("Invalid navigation property " + property);
}
- atomentry.getNavigationLinks().add(alink);
+ atomEntity.getNavigationLinks().add(alink);
} else {
- properties.add(toAtomProperty((JSONPropertyImpl) property, atomentry.getType()));
+ properties.add(toAtomProperty((JSONPropertyImpl) property, atomEntity.getType()));
}
}
- return atomentry;
+ return atomEntity;
}
public JSONPropertyImpl toJSONProperty(final AtomPropertyImpl atomproperty) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
index 9304454..ae89ec4 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/FSManager.java
@@ -38,7 +38,7 @@ import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.VFS;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.AtomEntityImpl;
import org.apache.olingo.commons.core.data.AtomSerializer;
import org.apache.olingo.fit.serializer.JSONEntryContainer;
import org.slf4j.Logger;
@@ -98,7 +98,7 @@ public class FSManager {
return memObject;
}
- public void putInMemory(final ResWrap<AtomEntryImpl> container, final String relativePath)
+ public void putInMemory(final ResWrap<AtomEntityImpl> container, final String relativePath)
throws IOException {
try {
final AtomSerializer atomSerializer = Commons.getAtomSerializer(version);
@@ -117,7 +117,7 @@ public class FSManager {
writer, new JSONEntryContainer(
container.getContextURL(),
container.getMetadataETag(),
- new DataBinder(version).toJSONEntry(container.getPayload())));
+ new DataBinder(version).toJSONEntityType(container.getPayload())));
putInMemory(new ByteArrayInputStream(content.toByteArray()), getAbsolutePath(relativePath, Accept.JSON_FULLMETA));
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
index 162221a..0b38524 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/XMLUtilities.java
@@ -159,7 +159,7 @@ public class XMLUtilities extends AbstractUtilities {
attributes.add(eventFactory.createAttribute(new QName("rel"),
Constants.get(version, ConstantKey.ATOM_LINK_REL) + link));
attributes.add(eventFactory.createAttribute(new QName("type"),
- navigationProperties.get(link).isFeed()
+ navigationProperties.get(link).isEntitySet()
? Constants.get(version, ConstantKey.ATOM_LINK_FEED)
: Constants.get(version, ConstantKey.ATOM_LINK_ENTRY)));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java
index 2b5478f..4967fc6 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonEdmEnabledODataClient.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.api;
-import java.net.URI;
import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType;
import org.apache.olingo.commons.api.edm.Edm;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/v4/AsyncRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/v4/AsyncRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/v4/AsyncRequestFactory.java
index 17b510f..45dfc11 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/v4/AsyncRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/v4/AsyncRequestFactory.java
@@ -22,7 +22,6 @@ import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.batch.v4.ODataBatchRequest;
import org.apache.olingo.client.api.communication.response.ODataResponse;
-@SuppressWarnings("unchecked")
public interface AsyncRequestFactory {
<R extends ODataResponse> AsyncRequestWrapper<R> getAsyncRequestWrapper(final ODataRequest odataRequest);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 8002845..f51285d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -30,7 +30,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
@@ -62,11 +62,11 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
private final ODataPubFormat format;
- private ResWrap<Entry> cached;
+ private ResWrap<Entity> cached;
private ES entitySet;
- private final ByteArrayOutputStream osFeed;
+ private final ByteArrayOutputStream osEntitySet;
private final String namespaces;
@@ -85,21 +85,21 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
this.odataClient = odataClient;
this.stream = stream;
this.format = format;
- this.osFeed = new ByteArrayOutputStream();
+ this.osEntitySet = new ByteArrayOutputStream();
if (format == ODataPubFormat.ATOM) {
- namespaces = getAllElementAttributes(stream, "feed", osFeed);
+ namespaces = getAllElementAttributes(stream, "feed", osEntitySet);
} else {
namespaces = null;
try {
- if (consume(stream, "\"value\":", osFeed, true) >= 0) {
+ if (consume(stream, "\"value\":", osEntitySet, true) >= 0) {
int c = 0;
while (c != '[' && (c = stream.read()) >= 0) {
- osFeed.write(c);
+ osEntitySet.write(c);
}
}
} catch (IOException e) {
- LOG.error("Error parsing feed", e);
+ LOG.error("Error parsing entity set", e);
throw new IllegalStateException(e);
}
}
@@ -113,15 +113,15 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
public boolean hasNext() {
if (available && cached == null) {
if (format == ODataPubFormat.ATOM) {
- cached = nextAtomEntryFromFeed(stream, osFeed, namespaces);
+ cached = nextAtomEntityFromEntitySet(stream, osEntitySet, namespaces);
} else {
- cached = nextJsonEntryFromFeed(stream, osFeed);
+ cached = nextJSONEntityFromEntitySet(stream, osEntitySet);
}
if (cached == null) {
available = false;
entitySet = (ES) odataClient.getReader().
- readEntitySet(new ByteArrayInputStream(osFeed.toByteArray()), format);
+ readEntitySet(new ByteArrayInputStream(osEntitySet.toByteArray()), format);
close();
}
}
@@ -157,7 +157,7 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
*/
public void close() {
IOUtils.closeQuietly(stream);
- IOUtils.closeQuietly(osFeed);
+ IOUtils.closeQuietly(osEntitySet);
}
/**
@@ -172,10 +172,10 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
return entitySet.getNext();
}
- private ResWrap<Entry> nextJsonEntryFromFeed(final InputStream input, final OutputStream osFeed) {
- final ByteArrayOutputStream entry = new ByteArrayOutputStream();
+ private ResWrap<Entity> nextJSONEntityFromEntitySet(final InputStream input, final OutputStream osEntitySet) {
+ final ByteArrayOutputStream entity = new ByteArrayOutputStream();
- ResWrap<Entry> jsonEntry = null;
+ ResWrap<Entity> jsonEntity = null;
try {
int c;
@@ -184,12 +184,12 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
do {
c = input.read();
if (c == '{') {
- entry.write(c);
+ entity.write(c);
c = -1;
foundNewOne = true;
}
if (c == ']') {
- osFeed.write(c);
+ osEntitySet.write(c);
c = -1;
}
} while (c >= 0);
@@ -205,55 +205,48 @@ public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends C
} else if (c == '}') {
count--;
}
- entry.write(c);
+ entity.write(c);
}
if (c >= 0) {
- jsonEntry = odataClient.getDeserializer().toEntry(
- new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.JSON);
+ jsonEntity = odataClient.getDeserializer().toEntity(
+ new ByteArrayInputStream(entity.toByteArray()), ODataPubFormat.JSON);
}
} else {
while ((c = input.read()) >= 0) {
- osFeed.write(c);
+ osEntitySet.write(c);
}
}
} catch (Exception e) {
LOG.error("Error retrieving entities from EntitySet", e);
}
- return jsonEntry;
+ return jsonEntity;
}
- /**
- * De-Serializes a stream into an OData entity set.
- *
- * @param input stream to de-serialize.
- * @param format de-serialize as AtomFeed or JSONFeed
- * @return de-serialized entity set.
- */
- private ResWrap<Entry> nextAtomEntryFromFeed(
- final InputStream input, final OutputStream osFeed, final String namespaces) {
+ private ResWrap<Entity> nextAtomEntityFromEntitySet(
+ final InputStream input, final OutputStream osEntitySet, final String namespaces) {
- final ByteArrayOutputStream entry = new ByteArrayOutputStream();
+ final ByteArrayOutputStream entity = new ByteArrayOutputStream();
- ResWrap<Entry> atomEntry = null;
+ ResWrap<Entity> atomEntity = null;
try {
- if (consume(input, "<entry>", osFeed, false) >= 0) {
- entry.write("<entry ".getBytes(Constants.UTF8));
- entry.write(namespaces.getBytes(Constants.UTF8));
- entry.write(">".getBytes(Constants.UTF8));
-
- if (consume(input, "</entry>", entry, true) >= 0) {
- atomEntry = odataClient.getDeserializer().
- toEntry(new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.ATOM);
+ if (consume(input, "<entry>", osEntitySet, false) >= 0) {
+ entity.write("<entry ".getBytes(Constants.UTF8));
+ entity.write(namespaces.getBytes(Constants.UTF8));
+ entity.write(">".getBytes(Constants.UTF8));
+
+ if (consume(input, "</entry>", entity, true) >= 0) {
+ atomEntity = odataClient.getDeserializer().
+ toEntity(new ByteArrayInputStream(entity.toByteArray()), ODataPubFormat.ATOM);
}
}
} catch (Exception e) {
LOG.error("Error retrieving entities from EntitySet", e);
}
- return atomEntry;
+ return atomEntity;
}
private String getAllElementAttributes(final InputStream input, final String name, final OutputStream os) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
index acb08ae..08ee08d 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
@@ -19,8 +19,8 @@
package org.apache.olingo.client.api.op;
import java.io.Serializable;
-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.client.api.data.ServiceDocument;
@@ -34,22 +34,22 @@ import org.apache.olingo.commons.api.domain.ODataServiceDocument;
public interface CommonODataBinder extends Serializable {
/**
- * Gets a <tt>Feed</tt> from the given OData entity set.
+ * Gets a <tt>EntitySet</tt> from the given OData entity set.
*
- * @param feed OData entity set.
+ * @param entitySet OData entity set.
* @param reference reference class.
- * @return <tt>Feed</tt> object.
+ * @return {@link EntitySet} object.
*/
- Feed getFeed(CommonODataEntitySet feed, Class<? extends Feed> reference);
+ EntitySet getEntitySet(CommonODataEntitySet entitySet, Class<? extends EntitySet> reference);
/**
- * Gets an <tt>Entry</tt> from the given OData entity.
+ * Gets an <tt>Entity</tt> from the given OData entity.
*
* @param entity OData entity.
* @param reference reference class.
- * @return <tt>Entry</tt> object.
+ * @return {@link Entity} object.
*/
- Entry getEntry(CommonODataEntity entity, Class<? extends Entry> reference);
+ Entity getEntity(CommonODataEntity entity, Class<? extends Entity> reference);
/**
* Gets a <tt>Link</tt> from the given OData link.
@@ -67,7 +67,7 @@ public interface CommonODataBinder extends Serializable {
* @param reference reference class.
* @return <tt>Property</tt> object.
*/
- Property getProperty(CommonODataProperty property, Class<? extends Entry> reference);
+ Property getProperty(CommonODataProperty property, Class<? extends Entity> reference);
/**
* Adds the given property to the given entity.
@@ -87,20 +87,20 @@ public interface CommonODataBinder extends Serializable {
ODataServiceDocument getODataServiceDocument(ServiceDocument resource);
/**
- * Gets <tt>ODataEntitySet</tt> from the given feed resource.
+ * Gets <tt>ODataEntitySet</tt> from the given entity set resource.
*
- * @param resource feed resource.
+ * @param resource entity set resource.
* @return {@link CommonODataEntitySet} object.
*/
- CommonODataEntitySet getODataEntitySet(ResWrap<Feed> resource);
+ CommonODataEntitySet getODataEntitySet(ResWrap<EntitySet> resource);
/**
- * Gets <tt>ODataEntity</tt> from the given entry resource.
+ * Gets <tt>ODataEntity</tt> from the given entity resource.
*
- * @param resource entry resource.
+ * @param resource entity resource.
* @return {@link CommonODataEntity} object.
*/
- CommonODataEntity getODataEntity(ResWrap<Entry> resource);
+ CommonODataEntity getODataEntity(ResWrap<Entity> resource);
/**
* Gets an <tt>ODataProperty</tt> from the given property resource.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/118b779b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index 0f1335a..eea1567 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
* <br/>
* Use this class to de-serialize an OData response body.
* <br/>
- * This class provides method helpers to de-serialize an entire feed, a set of entities and a single entity as well.
+ * This class provides method helpers to de-serialize an entire entity set, a set of entities or a single entity.
*/
public interface CommonODataReader extends Serializable {
@@ -71,7 +71,7 @@ public interface CommonODataReader extends Serializable {
* De-Serializes a stream into an OData entity set.
*
* @param input stream to de-serialize.
- * @param format de-serialize as AtomFeed or JSONFeed
+ * @param format de-serialize format
* @return de-serialized entity set.
*/
CommonODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
@@ -80,7 +80,7 @@ public interface CommonODataReader extends Serializable {
* Parses a stream taking care to de-serializes the first OData entity found.
*
* @param input stream to de-serialize.
- * @param format de-serialize as AtomEntry or JSONEntry
+ * @param format de-serialize format
* @return entity de-serialized.
*/
CommonODataEntity readEntity(InputStream input, ODataPubFormat format);