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 a57f11b34..01f0d924a 100644 --- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java +++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java @@ -70,7 +70,7 @@ import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.apache.cxf.jaxrs.ext.multipart.MultipartBody; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; @@ -997,7 +997,7 @@ public abstract class AbstractServices { final InputStream feed = FSManager.instance(version).readFile(builder.toString(), Accept.ATOM); - final ResWrap container = atomDeserializer.toEntitySet(feed); + final ResWrap container = atomDeserializer.toEntitySet(feed); setInlineCount(container.getPayload(), count); @@ -1040,7 +1040,7 @@ public abstract class AbstractServices { } } - protected abstract void setInlineCount(final EntitySet feed, final String count); + protected abstract void setInlineCount(final EntityCollection feed, final String count); @GET @Path("/Person({entityId})") @@ -1256,7 +1256,7 @@ public abstract class AbstractServices { rep.setInlineEntity(inline); } else if (link.getType().equals(Constants.get(ConstantKey.ATOM_LINK_FEED))) { // inline feed - final EntitySet inline = atomDeserializer.toEntitySet( + final EntityCollection inline = atomDeserializer.toEntitySet( xml.expandEntity(entitySetName, entityId, link.getTitle())).getPayload(); rep.setInlineEntitySet(inline); } @@ -1911,7 +1911,7 @@ public abstract class AbstractServices { alink.setRel(Constants.get(ConstantKey.ATOM_LINK_REL) + property.getName()); if (property.isCollection()) { - EntitySet inline = new EntitySet(); + EntityCollection inline = new EntityCollection(); for (Object value : property.asCollection()) { Entity inlineEntity = new Entity(); inlineEntity.setType(navProperties.get(property.getName()).getType()); 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 6c1038ddd..4a4100266 100644 --- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java +++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java @@ -64,7 +64,7 @@ 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.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; @@ -283,7 +283,7 @@ public class V4Services extends AbstractServices { } @Override - protected void setInlineCount(final EntitySet entitySet, final String count) { + protected void setInlineCount(final EntityCollection entitySet, final String count) { if ("true".equals(count)) { entitySet.setCount(entitySet.getEntities().size()); } @@ -456,14 +456,14 @@ public class V4Services extends AbstractServices { if (StringUtils.isBlank(deltatoken)) { final InputStream input = (InputStream) getEntitySet( uriInfo, accept, "Customers", null, null, format, null, null, null, null).getEntity(); - final EntitySet entitySet = xml.readEntitySet(acceptType, input); + final EntityCollection entitySet = xml.readEntitySet(acceptType, input); boolean trackChanges = prefer.contains("odata.track-changes"); if (trackChanges) { entitySet.setDeltaLink(URI.create("Customers?$deltatoken=8015")); } - output = xml.writeEntitySet(acceptType, new ResWrap( + output = xml.writeEntitySet(acceptType, new ResWrap( URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + "Customers"), null, entitySet)); @@ -580,10 +580,10 @@ public class V4Services extends AbstractServices { + "ProductDetails(ProductID=6,ProductDetailID=1)").toASCIIString()); entry.setEditLink(link); - final EntitySet feed = new EntitySet(); + final EntityCollection feed = new EntityCollection(); feed.getEntities().add(entry); - final ResWrap container = new ResWrap( + final ResWrap container = new ResWrap( URI.create(Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + "ProductDetail"), null, feed); @@ -934,7 +934,7 @@ 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 feedContainer = atomDeserializer.toEntitySet(feedIS); + final ResWrap feedContainer = atomDeserializer.toEntitySet(feedIS); feedContainer.getPayload().getEntities().add(entry); final ByteArrayOutputStream content = new ByteArrayOutputStream(); @@ -1050,7 +1050,7 @@ 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 feedContainer = atomDeserializer.toEntitySet(feedIS); + final ResWrap feedContainer = atomDeserializer.toEntitySet(feedIS); feedContainer.getPayload().getEntities().remove(container.getPayload()); final ByteArrayOutputStream content = new ByteArrayOutputStream(); @@ -1103,7 +1103,7 @@ public class V4Services extends AbstractServices { final InputStream feed = FSManager.instance(version). readFile(containedPath(entityId, tempContainedESName).toString(), Accept.ATOM); - final ResWrap container = atomDeserializer.toEntitySet(feed); + final ResWrap container = atomDeserializer.toEntitySet(feed); if (derivedType != null) { final List nonMatching = new ArrayList(); 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 126a0b60b..6639f7f5e 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,7 +43,7 @@ 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.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; @@ -507,14 +507,14 @@ public abstract class AbstractUtilities { return builder.build(); } - public EntitySet readEntitySet(final Accept accept, final InputStream entitySet) + public EntityCollection readEntitySet(final Accept accept, final InputStream entitySet) throws ODataDeserializerException { return (accept == Accept.ATOM || accept == Accept.XML ? atomDeserializer.toEntitySet(entitySet) : jsonDeserializer. toEntitySet(entitySet)) .getPayload(); } - public InputStream writeEntitySet(final Accept accept, final ResWrap container) + public InputStream writeEntitySet(final Accept accept, final ResWrap container) throws ODataSerializerException, IOException { final StringWriter writer = new StringWriter(); diff --git a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java index baadf20db..e915f3f59 100644 --- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java @@ -31,7 +31,7 @@ import org.apache.catalina.LifecycleException; import org.apache.commons.io.IOUtils; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.domain.ODataEntity; import org.apache.olingo.commons.api.domain.ODataProperty; import org.apache.olingo.commons.api.domain.ODataValue; @@ -81,7 +81,7 @@ public abstract class AbstractBaseTestITCase { } } - protected void debugEntitySet(final EntitySet entitySet, final String message) { + protected void debugEntitySet(final EntityCollection entitySet, final String message) { if (LOG.isDebugEnabled()) { final StringWriter writer = new StringWriter(); try { diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java index b7a65e84c..1af92d68a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/JSONFormatConformanceTestITCase.java @@ -27,7 +27,7 @@ import org.apache.commons.io.IOUtils; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataAnnotation; import org.apache.olingo.commons.api.domain.ODataEntity; @@ -240,7 +240,7 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { + " \"@odata.deltaLink\": \"Customers?$expand=Orders&$deltatoken=8015\"" + "}"; - final ResWrap entitySet = + final ResWrap entitySet = client.getDeserializer(ODataFormat.JSON).toEntitySet(IOUtils.toInputStream(fromSection45_2)); assertEquals(5, entitySet.getPayload().getCount(), 0); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java index 289c0cb90..6dc57dd08 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/serialization/ODataBinder.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.api.serialization; import org.apache.olingo.client.api.data.ServiceDocument; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; @@ -38,9 +38,9 @@ public interface ODataBinder { * Gets a EntitySet from the given OData entity set. * * @param entitySet OData entity set. - * @return {@link EntitySet} object. + * @return {@link EntityCollection} object. */ - EntitySet getEntitySet(ODataEntitySet entitySet); + EntityCollection getEntitySet(ODataEntitySet entitySet); /** * Gets an Entity from the given OData entity. @@ -89,7 +89,7 @@ public interface ODataBinder { * @param resource entity set resource. * @return {@link org.apache.olingo.commons.api.domain.ODataEntitySet} object. */ - ODataEntitySet getODataEntitySet(ResWrap resource); + ODataEntitySet getODataEntitySet(ResWrap resource); /** * Gets ODataEntity from the given entity resource. diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java index d552e75fa..20d75b743 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -25,7 +25,7 @@ import org.apache.http.client.HttpClient; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest; import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataEntitySet; import org.apache.olingo.commons.api.format.ODataFormat; @@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException; * @param concrete ODataEntitySet implementation */ public class ODataEntitySetRequestImpl - extends AbstractODataRetrieveRequest implements ODataEntitySetRequest { + extends AbstractODataRetrieveRequest implements ODataEntitySetRequest { private ES entitySet = null; @@ -68,7 +68,7 @@ public class ODataEntitySetRequestImpl protected class ODataEntitySetResponseImpl extends AbstractODataRetrieveResponse { private ODataEntitySetResponseImpl(final ODataClient odataClient, final HttpClient httpClient, - final HttpResponse res) { + final HttpResponse res) { super(odataClient, httpClient, res); } @@ -78,7 +78,8 @@ public class ODataEntitySetRequestImpl public ES getBody() { if (entitySet == null) { try { - final ResWrap resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())). + final ResWrap resource = + odataClient.getDeserializer(ODataFormat.fromString(getContentType())). toEntitySet(getRawResponse()); entitySet = (ES) odataClient.getBinder().getODataEntitySet(resource); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java index cd5003d88..32cd72647 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ClientODataDeserializerImpl.java @@ -32,7 +32,7 @@ import org.apache.olingo.client.core.edm.xml.EdmxImpl; import org.apache.olingo.client.core.edm.xml.XMLMetadataImpl; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataError; @@ -71,7 +71,7 @@ public class ClientODataDeserializerImpl implements ClientODataDeserializer { } @Override - public ResWrap toEntitySet(final InputStream input) throws ODataDeserializerException { + public ResWrap toEntitySet(final InputStream input) throws ODataDeserializerException { return deserializer.toEntitySet(input); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java index 54823e0c4..fc295a0d0 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java @@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.data.DeletedEntity; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.DeltaLink; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Linked; import org.apache.olingo.commons.api.data.Property; @@ -192,8 +192,8 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public EntitySet getEntitySet(final ODataEntitySet odataEntitySet) { - final EntitySet entitySet = new EntitySet(); + public EntityCollection getEntitySet(final ODataEntitySet odataEntitySet) { + final EntityCollection entitySet = new EntityCollection(); entitySet.setCount(odataEntitySet.getCount()); @@ -387,7 +387,7 @@ public class ODataBinderImpl implements ODataBinder { } @Override - public ODataEntitySet getODataEntitySet(final ResWrap resource) { + public ODataEntitySet getODataEntitySet(final ResWrap resource) { if (LOG.isDebugEnabled()) { final StringWriter writer = new StringWriter(); try { @@ -432,7 +432,7 @@ public class ODataBinderImpl implements ODataBinder { final String href = link.getHref(); final String title = link.getTitle(); final Entity inlineEntity = link.getInlineEntity(); - final EntitySet inlineEntitySet = link.getInlineEntitySet(); + final EntityCollection inlineEntitySet = link.getInlineEntitySet(); if (inlineEntity == null && inlineEntitySet == null) { ODataLinkType linkType = null; if (edmType instanceof EdmStructuredType) { @@ -476,10 +476,10 @@ public class ODataBinderImpl implements ODataBinder { inlineEntity))); } - private ODataInlineEntitySet createODataInlineEntitySet(final EntitySet inlineEntitySet, + private ODataInlineEntitySet createODataInlineEntitySet(final EntityCollection inlineEntitySet, final URI uri, final String title, final String metadataETag) { return new ODataInlineEntitySet(uri, ODataLinkType.ENTITY_SET_NAVIGATION, title, - getODataEntitySet(new ResWrap( + getODataEntitySet(new ResWrap( inlineEntitySet.getBaseURI() == null ? null : inlineEntitySet.getBaseURI(), metadataETag, inlineEntitySet))); } @@ -567,7 +567,7 @@ public class ODataBinderImpl implements ODataBinder { private ODataLink createLinkFromNavigationProperty(final Property property, final String propertyTypeName) { if (property.isCollection()) { - EntitySet inlineEntitySet = new EntitySet(); + EntityCollection inlineEntitySet = new EntityCollection(); for (final Object inlined : property.asCollection()) { Entity inlineEntity = new Entity(); inlineEntity.setType(propertyTypeName); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java index 253df782a..39b1177d4 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataReaderImpl.java @@ -30,7 +30,7 @@ import org.apache.olingo.client.api.edm.xml.XMLMetadata; import org.apache.olingo.client.api.serialization.ODataReader; import org.apache.olingo.client.core.edm.ClientEdmProvider; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataEntity; @@ -98,7 +98,7 @@ public class ODataReaderImpl implements ODataReader { reference.cast(new ODataEntitySetIterator( client, src, ODataFormat.fromString(format)))); } else if (ODataEntitySet.class.isAssignableFrom(reference)) { - final ResWrap resource = client.getDeserializer(ODataFormat.fromString(format)) + final ResWrap resource = client.getDeserializer(ODataFormat.fromString(format)) .toEntitySet(src); res = new ResWrap( resource.getContextURL(), diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java index b8282e20b..5d5671a75 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * 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 - * + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -20,7 +20,7 @@ package org.apache.olingo.client.core.v4; import org.apache.olingo.client.api.ODataClient; import org.apache.olingo.client.core.AbstractTest; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataEntity; import org.apache.olingo.commons.api.domain.ODataEntitySet; @@ -46,13 +46,14 @@ public class EntitySetTest extends AbstractTest { private void read(final ODataFormat format) throws IOException, ODataDeserializerException { final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(format)); final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet( - getClient().getDeserializer(format).toEntitySet(input)); + getClient().getDeserializer(format).toEntitySet(input)); assertNotNull(entitySet); assertEquals(2, entitySet.getEntities().size()); assertNull(entitySet.getNext()); - final ODataEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap((URI) null, null, + final ODataEntitySet written = + getClient().getBinder().getODataEntitySet(new ResWrap((URI) null, null, getClient().getBinder().getEntitySet(entitySet))); assertEquals(entitySet, written); } @@ -70,7 +71,7 @@ public class EntitySetTest extends AbstractTest { private void ref(final ODataFormat format) throws ODataDeserializerException { final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(format)); final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet( - getClient().getDeserializer(format).toEntitySet(input)); + getClient().getDeserializer(format).toEntitySet(input)); assertNotNull(entitySet); for (ODataEntity entity : entitySet.getEntities()) { @@ -78,7 +79,8 @@ public class EntitySetTest extends AbstractTest { } entitySet.setCount(entitySet.getEntities().size()); - final ODataEntitySet written = getClient().getBinder().getODataEntitySet(new ResWrap((URI) null, null, + final ODataEntitySet written = + getClient().getBinder().getODataEntitySet(new ResWrap((URI) null, null, getClient().getBinder().getEntitySet(entitySet))); assertEquals(entitySet, written); } 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 index 5fe36f7e0..b87c05f9e 100644 --- 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 @@ -21,7 +21,7 @@ package org.apache.olingo.commons.api.data; import java.util.ArrayList; import java.util.List; -public class Delta extends EntitySet { +public class Delta extends EntityCollection { private final List deletedEntities = new ArrayList(); private final List addedLinks = new ArrayList(); 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/EntityCollection.java similarity index 97% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntityCollection.java index 8f2cfb7b0..0946bea72 100644 --- 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/EntityCollection.java @@ -22,7 +22,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.List; -public class EntitySet extends AbstractODataObject { +public class EntityCollection extends AbstractODataObject { private Integer count; 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 dff1069eb..8278633fe 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 @@ -29,7 +29,7 @@ public class Link extends Annotatable { private String type; private String mediaETag; private Entity entity; - private EntitySet entitySet; + private EntityCollection entitySet; private String bindingLink; private List bindingLinks = new ArrayList(); @@ -147,7 +147,7 @@ public class Link extends Annotatable { * * @return in-line entity set. */ - public EntitySet getInlineEntitySet() { + public EntityCollection getInlineEntitySet() { return entitySet; } @@ -156,7 +156,7 @@ public class Link extends Annotatable { * * @param entitySet entity set. */ - public void setInlineEntitySet(final EntitySet entitySet) { + public void setInlineEntitySet(final EntityCollection entitySet) { this.entitySet = entitySet; } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java index e3b3759c2..8e313b105 100755 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/serialization/ODataDeserializer.java @@ -19,7 +19,7 @@ package org.apache.olingo.commons.api.serialization; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.domain.ODataError; @@ -35,9 +35,9 @@ public interface ODataDeserializer { * Gets an entity set object from the given InputStream. * * @param input stream to be de-serialized. - * @return {@link EntitySet} instance. + * @return {@link EntityCollection} instance. */ - ResWrap toEntitySet(InputStream input) throws ODataDeserializerException; + ResWrap toEntitySet(InputStream input) throws ODataDeserializerException; /** * Gets an entity object from the given InputStream. diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java index cd5210a37..84795bf1f 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomDeserializer.java @@ -44,7 +44,7 @@ import org.apache.olingo.commons.api.data.DeletedEntity.Reason; import org.apache.olingo.commons.api.data.Delta; import org.apache.olingo.commons.api.data.DeltaLink; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; @@ -712,7 +712,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } } - private void count(final XMLEventReader reader, final StartElement start, final EntitySet entitySet) + private void count(final XMLEventReader reader, final StartElement start, final EntityCollection entitySet) throws XMLStreamException { boolean foundEndElement = false; @@ -729,12 +729,12 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } } - private EntitySet entitySet(final XMLEventReader reader, final StartElement start) + private EntityCollection entitySet(final XMLEventReader reader, final StartElement start) throws XMLStreamException, EdmPrimitiveTypeException { if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) { return null; } - final EntitySet entitySet = new EntitySet(); + final EntityCollection entitySet = new EntityCollection(); final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE); if (xmlBase != null) { entitySet.setBaseURI(xmlBase.getValue()); @@ -788,7 +788,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria } @Override - public ResWrap toEntitySet(final InputStream input) throws ODataDeserializerException { + public ResWrap toEntitySet(final InputStream input) throws ODataDeserializerException { try { final XMLEventReader reader = getReader(input); final StartElement start = skipBeforeFirstStartElement(reader); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java index 196a46e27..fb187feab 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/AtomSerializer.java @@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.data.Annotation; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.ContextURL; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ResWrap; @@ -393,7 +393,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize writer.flush(); } - private void entitySet(final XMLStreamWriter writer, final EntitySet entitySet) + private void entitySet(final XMLStreamWriter writer, final EntityCollection entitySet) throws XMLStreamException, EdmPrimitiveTypeException { if (entitySet.getBaseURI() != null) { writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entitySet.getBaseURI().toASCIIString()); @@ -442,7 +442,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize } } - private void entitySet(final Writer outWriter, final EntitySet entitySet) + private void entitySet(final Writer outWriter, final EntityCollection entitySet) throws XMLStreamException, EdmPrimitiveTypeException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); @@ -455,7 +455,7 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize writer.flush(); } - private void entitySet(final Writer outWriter, final ResWrap entitySet) + private void entitySet(final Writer outWriter, final ResWrap entitySet) throws XMLStreamException, EdmPrimitiveTypeException { final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter); @@ -491,8 +491,8 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize @Override public void write(final Writer writer, final T obj) throws ODataSerializerException { try { - if (obj instanceof EntitySet) { - entitySet(writer, (EntitySet) obj); + if (obj instanceof EntityCollection) { + entitySet(writer, (EntityCollection) obj); } else if (obj instanceof Entity) { entity(writer, (Entity) obj); } else if (obj instanceof Property) { @@ -527,8 +527,8 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize final T obj = container == null ? null : container.getPayload(); try { - if (obj instanceof EntitySet) { - this.entitySet(writer, (ResWrap) container); + if (obj instanceof EntityCollection) { + this.entitySet(writer, (ResWrap) container); } else if (obj instanceof Entity) { entity(writer, (ResWrap) container); } else if (obj instanceof Property) { @@ -551,8 +551,8 @@ public class AtomSerializer extends AbstractAtomDealer implements ODataSerialize if (container.getContextURL() != null) { final ContextURL contextURL = ContextURLParser.parse(container.getContextURL()); String base = contextURL.getServiceRoot().toASCIIString(); - if (container.getPayload() instanceof EntitySet) { - ((EntitySet) container.getPayload()).setBaseURI(base); + if (container.getPayload() instanceof EntityCollection) { + ((EntityCollection) container.getPayload()).setBaseURI(base); } if (container.getPayload() instanceof Entity) { ((Entity) container.getPayload()).setBaseURI(base); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java index 1db725be2..34394bb4d 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonDeserializer.java @@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.data.Annotatable; import org.apache.olingo.commons.api.data.Annotation; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Linked; import org.apache.olingo.commons.api.data.Property; @@ -106,7 +106,7 @@ public class JsonDeserializer implements ODataDeserializer { } else if (inline instanceof ArrayNode) { link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); - final EntitySet entitySet = new EntitySet(); + final EntityCollection entitySet = new EntityCollection(); for (final Iterator entries = inline.elements(); entries.hasNext();) { entitySet.getEntities().add(entityDeserializer.doDeserialize(entries.next().traverse(codec)).getPayload()); } @@ -381,7 +381,7 @@ public class JsonDeserializer implements ODataDeserializer { } @Override - public ResWrap toEntitySet(final InputStream input) throws ODataDeserializerException { + public ResWrap toEntitySet(final InputStream input) throws ODataDeserializerException { try { parser = new JsonFactory(new ObjectMapper()).createParser(input); return new JsonEntitySetDeserializer(serverMode).doDeserialize(parser); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java index f2603696e..abf131b3b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetDeserializer.java @@ -26,7 +26,7 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.Annotation; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; @@ -45,7 +45,7 @@ public class JsonEntitySetDeserializer extends JsonDeserializer { super(serverMode); } - protected ResWrap doDeserialize(final JsonParser parser) throws IOException { + protected ResWrap doDeserialize(final JsonParser parser) throws IOException { final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser); @@ -53,7 +53,7 @@ public class JsonEntitySetDeserializer extends JsonDeserializer { return null; } - final EntitySet entitySet = new EntitySet(); + final EntityCollection entitySet = new EntityCollection(); URI contextURL; if (tree.hasNonNull(Constants.JSON_CONTEXT)) { @@ -115,6 +115,6 @@ public class JsonEntitySetDeserializer extends JsonDeserializer { } } - return new ResWrap(contextURL, metadataETag, entitySet); + return new ResWrap(contextURL, metadataETag, entitySet); } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java index 3c67055a2..02af3cf38 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonEntitySetSerializer.java @@ -24,7 +24,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.Annotation; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; @@ -36,15 +36,15 @@ public class JsonEntitySetSerializer extends JsonSerializer { super(serverMode); } - protected void doSerialize(final EntitySet entitySet, final JsonGenerator jgen) + protected void doSerialize(final EntityCollection entitySet, final JsonGenerator jgen) throws IOException, EdmPrimitiveTypeException { - doContainerSerialize(new ResWrap(null, null, entitySet), jgen); + doContainerSerialize(new ResWrap(null, null, entitySet), jgen); } - protected void doContainerSerialize(final ResWrap container, final JsonGenerator jgen) + protected void doContainerSerialize(final ResWrap container, final JsonGenerator jgen) throws IOException, EdmPrimitiveTypeException { - final EntitySet entitySet = container.getPayload(); + final EntityCollection entitySet = container.getPayload(); jgen.writeStartObject(); diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java index e749736c9..0dd8dd4c6 100755 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/serialization/JsonSerializer.java @@ -33,7 +33,7 @@ import org.apache.olingo.commons.api.data.Annotatable; import org.apache.olingo.commons.api.data.Annotation; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Linked; import org.apache.olingo.commons.api.data.Property; @@ -81,8 +81,8 @@ public class JsonSerializer implements ODataSerializer { public void write(final Writer writer, final T obj) throws ODataSerializerException { try { final JsonGenerator json = new JsonFactory().createGenerator(writer); - if (obj instanceof EntitySet) { - new JsonEntitySetSerializer(serverMode).doSerialize((EntitySet) obj, json); + if (obj instanceof EntityCollection) { + new JsonEntitySetSerializer(serverMode).doSerialize((EntityCollection) obj, json); } else if (obj instanceof Entity) { new JsonEntitySerializer(serverMode, format).doSerialize((Entity) obj, json); } else if (obj instanceof Property) { @@ -113,8 +113,8 @@ public class JsonSerializer implements ODataSerializer { final T obj = container == null ? null : container.getPayload(); try { final JsonGenerator json = new JsonFactory().createGenerator(writer); - if (obj instanceof EntitySet) { - new JsonEntitySetSerializer(serverMode).doContainerSerialize((ResWrap) container, json); + if (obj instanceof EntityCollection) { + new JsonEntitySetSerializer(serverMode).doContainerSerialize((ResWrap) container, json); } else if (obj instanceof Entity) { new JsonEntitySerializer(serverMode).doContainerSerialize((ResWrap) container, json); } else if (obj instanceof Property) { diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java index 062f46b18..2c5087ba2 100644 --- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java +++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/serialization/AtomDeserializerTest.java @@ -26,7 +26,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.ResWrap; import org.junit.Test; @@ -230,7 +230,7 @@ public class AtomDeserializerTest { final ResWrap entity = deserializer.toEntity(in); assertNotNull(entity); - final EntitySet inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet(); + final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet(); assertNotNull(inlineEntitySet); assertEquals(0, inlineEntitySet.getEntities().size()); } @@ -321,7 +321,7 @@ public class AtomDeserializerTest { final ResWrap entity = deserializer.toEntity(in); assertNotNull(entity); - final EntitySet inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet(); + final EntityCollection inlineEntitySet = entity.getPayload().getNavigationLink("Supplier").getInlineEntitySet(); assertNotNull(inlineEntitySet); assertEquals(1, inlineEntitySet.getEntities().size()); } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java index 3f369394b..9fcc3fcbc 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerResult.java @@ -22,7 +22,7 @@ import java.net.URI; import java.util.List; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Parameter; import org.apache.olingo.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.commons.api.data.Property; @@ -39,9 +39,9 @@ public interface DeserializerResult { /** * Returns a entity set - * @return an {@link EntitySet} or null + * @return an {@link EntityCollection} or null */ - EntitySet getEntityCollection(); + EntityCollection getEntityCollection(); /** * Returns the ExpandOptions for serialized entities diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java index f014ad61a..5a927ed37 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java @@ -21,7 +21,7 @@ package org.apache.olingo.server.api.deserializer; import java.io.InputStream; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmProperty; @@ -43,7 +43,7 @@ public interface ODataDeserializer { DeserializerResult entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException; /** - * Deserializes an entity collection stream into an {@link EntitySet} object. + * Deserializes an entity collection stream into an {@link EntityCollection} object. * @param stream * @param edmEntityType * @return {@link DeserializerResult#getEntityCollection()} diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java index 01db1a45c..3a2fbe0f8 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java @@ -21,7 +21,7 @@ package org.apache.olingo.server.api.serializer; import java.io.InputStream; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmComplexType; @@ -64,7 +64,7 @@ public interface ODataSerializer { * @param options options for the serializer */ SerializerResult entityCollection(ServiceMetadata metadata, EdmEntityType entityType, - EntitySet entitySet, EntityCollectionSerializerOptions options) throws SerializerException; + EntityCollection entitySet, EntityCollectionSerializerOptions options) throws SerializerException; /** * Writes entity data into an InputStream. diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/DeserializerResultImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/DeserializerResultImpl.java index 84d64ea7a..1c85f3e7b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/DeserializerResultImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/DeserializerResultImpl.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Parameter; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.server.api.deserializer.DeserializerResult; @@ -31,7 +31,7 @@ import org.apache.olingo.server.api.uri.queryoption.ExpandOption; public class DeserializerResultImpl implements DeserializerResult { private Entity entity; - private EntitySet entitySet; + private EntityCollection entitySet; private ExpandOption expandOption; private Property property; private List actionParametes; @@ -45,7 +45,7 @@ public class DeserializerResultImpl implements DeserializerResult { } @Override - public EntitySet getEntityCollection() { + public EntityCollection getEntityCollection() { return entitySet; } @@ -75,7 +75,7 @@ public class DeserializerResultImpl implements DeserializerResult { public static class DeserializerResultBuilder { private Entity entity; - private EntitySet entitySet; + private EntityCollection entitySet; private ExpandOption expandOption; private Property property; private List actionParametes; @@ -98,7 +98,7 @@ public class DeserializerResultImpl implements DeserializerResult { return this; } - public DeserializerResultBuilder entityCollection(final EntitySet entitySet) { + public DeserializerResultBuilder entityCollection(final EntityCollection entitySet) { this.entitySet = entitySet; return this; } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java index fa2f6a5fb..d92ac0c68 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java @@ -31,7 +31,7 @@ import java.util.Map.Entry; import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Parameter; import org.apache.olingo.commons.api.data.Property; @@ -92,9 +92,9 @@ public class ODataJsonDeserializer implements ODataDeserializer { } } - private EntitySet consumeEntitySetNode(EdmEntityType edmEntityType, final ObjectNode tree, + private EntityCollection consumeEntitySetNode(EdmEntityType edmEntityType, final ObjectNode tree, final ExpandTreeBuilder expandBuilder) throws DeserializerException { - EntitySet entitySet = new EntitySet(); + EntityCollection entitySet = new EntityCollection(); // Consume entities JsonNode jsonNode = tree.get(Constants.VALUE); @@ -339,7 +339,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { expandBuilder.expand(edmNavigationProperty) : null; if (jsonNode.isArray() && edmNavigationProperty.isCollection()) { link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); - EntitySet inlineEntitySet = new EntitySet(); + EntityCollection inlineEntitySet = new EntityCollection(); inlineEntitySet.getEntities().addAll(consumeEntitySetArray(edmNavigationProperty.getType(), jsonNode, childExpandBuilder)); link.setInlineEntitySet(inlineEntitySet); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java index c9944c716..ff7eff2ad 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java @@ -27,7 +27,7 @@ import org.apache.olingo.commons.api.Constants; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.ContextURL; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Linked; import org.apache.olingo.commons.api.data.Property; @@ -130,7 +130,7 @@ public class ODataJsonSerializer implements ODataSerializer { @Override public SerializerResult entityCollection(final ServiceMetadata metadata, - final EdmEntityType entityType, final EntitySet entitySet, + final EdmEntityType entityType, final EntityCollection entitySet, final EntityCollectionSerializerOptions options) throws SerializerException { CircleStreamBuffer buffer = new CircleStreamBuffer(); try { @@ -194,7 +194,7 @@ public class ODataJsonSerializer implements ODataSerializer { } protected void writeEntitySet(final ServiceMetadata metadata, final EdmEntityType entityType, - final EntitySet entitySet, final ExpandOption expand, final SelectOption select, + final EntityCollection entitySet, final ExpandOption expand, final SelectOption select, final boolean onlyReference, final JsonGenerator json) throws IOException, SerializerException { json.writeStartArray(); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java index 6143727ac..2213c5a2b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java @@ -23,7 +23,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmComplexType; @@ -95,7 +95,7 @@ public class ODataXmlSerializerImpl implements ODataSerializer { @Override public SerializerResult entityCollection(final ServiceMetadata metadata, - final EdmEntityType entityType, final EntitySet entitySet, + final EdmEntityType entityType, final EntityCollection entitySet, final EntityCollectionSerializerOptions options) throws SerializerException { throw new SerializerException("Entityset serialization not implemented for XML format", SerializerException.MessageKeys.NOT_IMPLEMENTED); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java index 06da1765c..b48d05173 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java @@ -31,7 +31,7 @@ import java.util.UUID; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; @@ -41,10 +41,10 @@ public class DataCreator { private static final UUID GUID = UUID.fromString("01234567-89ab-cdef-0123-456789abcdef"); - private final Map data; + private final Map data; public DataCreator() { - data = new HashMap(); + data = new HashMap(); data.put("ESTwoPrim", createESTwoPrim()); data.put("ESAllPrim", createESAllPrim()); data.put("ESCompAllPrim", createESCompAllPrim()); @@ -59,19 +59,19 @@ public class DataCreator { data.put("ESServerSidePaging", createESServerSidePaging()); // No data available but to allow an insert operation create empty EntitySets - data.put("ESAllNullable", new EntitySet()); - data.put("ESMixEnumDefCollComp", new EntitySet()); - data.put("ESTwoBase", new EntitySet()); - data.put("ESBaseTwoKeyNav", new EntitySet()); - data.put("ESBaseTwoKeyTwoPrim", new EntitySet()); - data.put("ESTwoKeyTwoPrim", new EntitySet()); - data.put("ESCompCollAllPrim", new EntitySet()); - data.put("ESKeyTwoKeyComp", new EntitySet()); - data.put("ESFourKeyAlias", new EntitySet()); - data.put("ESBase", new EntitySet()); - data.put("ESTwoBaseTwoKeyTwoPrim", new EntitySet()); - data.put("ESInvisible", new EntitySet()); - data.put("ESCompMixPrimCollComp", new EntitySet()); + data.put("ESAllNullable", new EntityCollection()); + data.put("ESMixEnumDefCollComp", new EntityCollection()); + data.put("ESTwoBase", new EntityCollection()); + data.put("ESBaseTwoKeyNav", new EntityCollection()); + data.put("ESBaseTwoKeyTwoPrim", new EntityCollection()); + data.put("ESTwoKeyTwoPrim", new EntityCollection()); + data.put("ESCompCollAllPrim", new EntityCollection()); + data.put("ESKeyTwoKeyComp", new EntityCollection()); + data.put("ESFourKeyAlias", new EntityCollection()); + data.put("ESBase", new EntityCollection()); + data.put("ESTwoBaseTwoKeyTwoPrim", new EntityCollection()); + data.put("ESInvisible", new EntityCollection()); + data.put("ESCompMixPrimCollComp", new EntityCollection()); linkESTwoPrim(data); linkESAllPrim(data); @@ -79,12 +79,12 @@ public class DataCreator { linkESTwoKeyNav(data); } - protected Map getData() { + protected Map getData() { return data; } - private EntitySet createESServerSidePaging() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESServerSidePaging() { + EntityCollection entitySet = new EntityCollection(); for (int i = 1; i <= 503; i++) { entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", i)) @@ -94,8 +94,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESKeyNav() { - final EntitySet entitySet = new EntitySet(); + private EntityCollection createESKeyNav() { + final EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(createETKeyNavEntity(1, "I am String Property 1")); entitySet.getEntities().add(createETKeyNavEntity(2, "I am String Property 2")); @@ -123,8 +123,8 @@ public class DataCreator { createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1)))); } - private EntitySet createESTwoKeyNav() { - final EntitySet entitySet = new EntitySet(); + private EntityCollection createESTwoKeyNav() { + final EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(createESTwoKeyNavEntity(1, "1")); entitySet.getEntities().add(createESTwoKeyNavEntity(1, "2")); @@ -174,8 +174,8 @@ public class DataCreator { } @SuppressWarnings("unchecked") - private EntitySet createESCompCollComp() { - final EntitySet entitySet = new EntitySet(); + private EntityCollection createESCompCollComp() { + final EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) .addProperty(createComplex("PropertyComp", createComplexCollection("CollPropertyComp", Arrays @@ -198,8 +198,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESTwoPrim() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESTwoPrim() { + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 32766)) .addProperty(createPrimitive("PropertyString", "Test String1"))); @@ -216,8 +216,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESAllPrim() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESAllPrim() { + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) .addProperty(createPrimitive("PropertyString", "First Resource - positive values")) @@ -266,8 +266,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESCompAllPrim() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESCompAllPrim() { + EntityCollection entitySet = new EntityCollection(); Entity entity = new Entity(); entity.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)); @@ -318,8 +318,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESCollAllPrim() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESCollAllPrim() { + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", 1)).addProperty( createPrimitiveCollection("CollPropertyString", "Employee1@company.example", "Employee2@company.example", @@ -361,13 +361,13 @@ public class DataCreator { return entitySet; } - private EntitySet createESMixPrimCollComp() { + private EntityCollection createESMixPrimCollComp() { @SuppressWarnings("unchecked") final Property complexCollection = createComplexCollection("CollPropertyComp", Arrays.asList(createPrimitive("PropertyInt16", 123), createPrimitive("PropertyString", "TEST 1")), Arrays.asList(createPrimitive("PropertyInt16", 456), createPrimitive("PropertyString", "TEST 2")), Arrays.asList(createPrimitive("PropertyInt16", 789), createPrimitive("PropertyString", "TEST 3"))); - EntitySet entitySet = new EntitySet(); + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) .addProperty( @@ -391,8 +391,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESAllKey() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESAllKey() { + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity().addProperty(createPrimitive("PropertyString", "First")) .addProperty(createPrimitive("PropertyBoolean", true)).addProperty(createPrimitive("PropertyByte", 255)) @@ -420,8 +420,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESCompComp() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESCompComp() { + EntityCollection entitySet = new EntityCollection(); Entity entity = new Entity(); entity.addProperty(createPrimitive("PropertyInt16", 1)); @@ -440,8 +440,8 @@ public class DataCreator { return entitySet; } - private EntitySet createESMedia() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createESMedia() { + EntityCollection entitySet = new EntityCollection(); Entity entity = new Entity().addProperty(createPrimitive("PropertyInt16", 1)) .addProperty(createPrimitive(DataProvider.MEDIA_PROPERTY_NAME, createImage("darkturquoise"))); @@ -473,8 +473,8 @@ public class DataCreator { + " \n" + " \n" + "\n").getBytes(Charset.forName("UTF-8")); } - private void linkESTwoPrim(Map data) { - final EntitySet entitySet = data.get("ESTwoPrim"); + private void linkESTwoPrim(Map data) { + final EntityCollection entitySet = data.get("ESTwoPrim"); final List targetEntities = data.get("ESAllPrim").getEntities(); setLinks(entitySet.getEntities().get(1), "NavPropertyETAllPrimMany", targetEntities.get(1), targetEntities.get(2)); @@ -482,8 +482,8 @@ public class DataCreator { setLink(entitySet.getEntities().get(3), "NavPropertyETAllPrimOne", targetEntities.get(0)); } - private void linkESAllPrim(Map data) { - final EntitySet entitySet = data.get("ESAllPrim"); + private void linkESAllPrim(Map data) { + final EntityCollection entitySet = data.get("ESAllPrim"); final List targetEntities = data.get("ESTwoPrim").getEntities(); setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoPrimMany", targetEntities.get(1)); @@ -493,8 +493,8 @@ public class DataCreator { targetEntities.get(3)); } - private void linkESKeyNav(Map data) { - final EntitySet entitySet = data.get("ESKeyNav"); + private void linkESKeyNav(Map data) { + final EntityCollection entitySet = data.get("ESKeyNav"); final List esKeyNavTargets = data.get("ESKeyNav").getEntities(); final List esTwoKeyNavTargets = data.get("ESTwoKeyNav").getEntities(); final List esMediaTargets = data.get("ESMedia").getEntities(); @@ -524,8 +524,8 @@ public class DataCreator { setLink(entitySet.getEntities().get(2), "NavPropertyETMediaOne", esMediaTargets.get(2)); } - private void linkESTwoKeyNav(Map data) { - final EntitySet entitySet = data.get("ESTwoKeyNav"); + private void linkESTwoKeyNav(Map data) { + final EntityCollection entitySet = data.get("ESTwoKeyNav"); final List esKeyNavTargets = data.get("ESKeyNav").getEntities(); final List esTwoKeyNavTargets = data.get("ESTwoKeyNav").getEntities(); @@ -619,7 +619,7 @@ public class DataCreator { link = new Link(); link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString()); link.setTitle(navigationPropertyName); - EntitySet target = new EntitySet(); + EntityCollection target = new EntityCollection(); target.getEntities().addAll(Arrays.asList(targets)); link.setInlineEntitySet(target); entity.getNavigationLinks().add(link); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java index a20375032..6bf79fa3b 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java @@ -29,7 +29,7 @@ import java.util.Map; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.Edm; @@ -55,7 +55,7 @@ public class DataProvider { protected static final String MEDIA_PROPERTY_NAME = "$value"; - final private Map data; + final private Map data; private Edm edm; private OData odata; @@ -63,16 +63,16 @@ public class DataProvider { data = new DataCreator().getData(); } - public EntitySet readAll(final EdmEntitySet edmEntitySet) throws DataProviderException { + public EntityCollection readAll(final EdmEntitySet edmEntitySet) throws DataProviderException { return data.get(edmEntitySet.getName()); } public Entity read(final EdmEntitySet edmEntitySet, final List keys) throws DataProviderException { - final EntitySet entitySet = readAll(edmEntitySet); + final EntityCollection entitySet = readAll(edmEntitySet); return entitySet == null ? null : read(edmEntitySet.getEntityType(), entitySet, keys); } - public Entity read(final EdmEntityType edmEntityType, final EntitySet entitySet, final List keys) + public Entity read(final EdmEntityType edmEntityType, final EntityCollection entitySet, final List keys) throws DataProviderException { try { for (final Entity entity : entitySet.getEntities()) { @@ -129,7 +129,7 @@ public class DataProvider { public Entity create(final EdmEntitySet edmEntitySet) throws DataProviderException { final EdmEntityType edmEntityType = edmEntitySet.getEntityType(); - final EntitySet entitySet = readAll(edmEntitySet); + final EntityCollection entitySet = readAll(edmEntitySet); final List entities = entitySet.getEntities(); final Map newKey = findFreeComposedKey(entities, edmEntitySet.getEntityType()); final Entity newEntity = new Entity(); @@ -349,7 +349,7 @@ public class DataProvider { } private List createInlineEntities(final String rawBaseUri, final EdmEntitySet targetEntitySet, - final EntitySet changedEntitySet) throws DataProviderException { + final EntityCollection changedEntitySet) throws DataProviderException { List entities = new ArrayList(); for (final Entity newEntity : changedEntitySet.getEntities()) { @@ -473,7 +473,7 @@ public class DataProvider { entity.setMediaContentType(type); } - public EntitySet readFunctionEntitySet(final EdmFunction function, final List parameters) + public EntityCollection readFunctionEntitySet(final EdmFunction function, final List parameters) throws DataProviderException { return FunctionData.entityCollectionFunction(function.getName(), parameters, data); } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java index 1028cd852..7e126a0d0 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/FunctionData.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -33,11 +33,11 @@ import org.apache.olingo.server.tecsvc.data.DataProvider.DataProviderException; public class FunctionData { - protected static EntitySet entityCollectionFunction(final String name, final List parameters, - final Map data) throws DataProviderException { + protected static EntityCollection entityCollectionFunction(final String name, final List parameters, + final Map data) throws DataProviderException { if (name.equals("UFCRTCollETTwoKeyNavParam")) { final List esTwoKeyNav = data.get("ESTwoKeyNav").getEntities(); - EntitySet result = new EntitySet(); + EntityCollection result = new EntityCollection(); final int endIndex = parameters.isEmpty() ? 0 : Short.valueOf(parameters.get(0).getText()); result.getEntities().addAll( esTwoKeyNav.subList(0, @@ -53,7 +53,7 @@ public class FunctionData { } protected static Entity entityFunction(final String name, final List parameters, - final Map data) throws DataProviderException { + final Map data) throws DataProviderException { final List esTwoKeyNav = data.get("ESTwoKeyNav").getEntities(); if (name.equals("UFCRTETTwoKeyNav")) { return esTwoKeyNav.get(0); @@ -71,7 +71,7 @@ public class FunctionData { @SuppressWarnings("unchecked") protected static Property primitiveComplexFunction(final String name, final List parameters, - final Map data) throws DataProviderException { + final Map data) throws DataProviderException { if (name.equals("UFNRTInt16")) { return DataCreator.createPrimitive(name, 12345); } else if (name.equals("UFCRTString")) { diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java index 113b252e6..c2e9da4a6 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Linked; import org.apache.olingo.commons.api.data.Property; @@ -140,7 +140,7 @@ public class RequestValidator { } if(edmProperty.isCollection()) { - final EntitySet inlineEntitySet = navigationLink.getInlineEntitySet(); + final EntityCollection inlineEntitySet = navigationLink.getInlineEntitySet(); if(!isInsert && inlineEntitySet.getEntities().size() > 0) { throw new DataProvider.DataProviderException("Deep update is not allowed", HttpStatusCode.BAD_REQUEST); } else { diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java index 858963ddb..01f2c903b 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java @@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.data.ContextURL; import org.apache.olingo.commons.api.data.ContextURL.Builder; import org.apache.olingo.commons.api.data.ContextURL.Suffix; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.edm.EdmAction; import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmEntityType; @@ -91,13 +91,13 @@ public class TechnicalEntityProcessor extends TechnicalProcessor .get(uriInfo.getUriResourceParts().size() - 1)).getType() : edmEntitySet.getEntityType(); - final EntitySet entitySetInitial = readEntityCollection(uriInfo); + final EntityCollection entitySetInitial = readEntityCollection(uriInfo); if (entitySetInitial == null) { throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT); } else { // Modifying the original entitySet means modifying the "database", so we have to make a shallow // copy of the entity set (new EntitySet, but exactly the same data) - EntitySet entitySet = new EntitySet(); + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().addAll(entitySetInitial.getEntities()); // Apply system query options @@ -121,7 +121,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor // Create a shallow copy of each entity. So the expanded navigation properties can be modified for serialization, // without affecting the data stored in the database. final ExpandSystemQueryOptionHandler expandHandler = new ExpandSystemQueryOptionHandler(); - final EntitySet entitySetSerialization = expandHandler.transformEntitySetGraphToTree(entitySet, + final EntityCollection entitySetSerialization = expandHandler.transformEntitySetGraphToTree(entitySet, edmEntitySet, expand); expandHandler.applyExpandQueryOptions(entitySetSerialization, edmEntitySet, expand); @@ -155,7 +155,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor throws ODataApplicationException, SerializerException { validateOptions(uriInfo.asUriInfoResource()); getEdmEntitySet(uriInfo); // including checks - EntitySet entitySet = readEntityCollection(uriInfo); + EntityCollection entitySet = readEntityCollection(uriInfo); if (entitySet == null) { throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT); } else { @@ -330,7 +330,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode()); } - private void setCount(EntitySet entitySet) { + private void setCount(EntityCollection entitySet) { if (entitySet.getCount() == null) { entitySet.setCount(entitySet.getEntities().size()); } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java index 33cd98fbc..d826b19ff 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Locale; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.edm.EdmBindingTarget; import org.apache.olingo.commons.api.edm.EdmEntitySet; @@ -163,7 +163,7 @@ public abstract class TechnicalProcessor implements Processor { return entity; } - protected EntitySet readEntityCollection(final UriInfoResource uriInfo) throws ODataApplicationException { + protected EntityCollection readEntityCollection(final UriInfoResource uriInfo) throws ODataApplicationException { final List resourcePaths = uriInfo.getUriResourceParts(); if (resourcePaths.size() > 1 && resourcePaths.get(1) instanceof UriResourceNavigation) { final Entity entity = readEntity(uriInfo); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java index e6b984908..f68af3b79 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/ExpandSystemQueryOptionHandler.java @@ -24,7 +24,7 @@ import java.util.Locale; import java.util.Set; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.edm.EdmBindingTarget; import org.apache.olingo.commons.api.edm.EdmEntitySet; @@ -48,7 +48,7 @@ import org.apache.olingo.server.tecsvc.processor.queryoptions.options.TopHandler public class ExpandSystemQueryOptionHandler { - public void applyExpandQueryOptions(final EntitySet entitySet, final EdmEntitySet edmEntitySet, + public void applyExpandQueryOptions(final EntityCollection entitySet, final EdmEntitySet edmEntitySet, final ExpandOption expandOption) throws ODataApplicationException { if (expandOption == null) { return; @@ -80,14 +80,14 @@ public class ExpandSystemQueryOptionHandler { final Link link = entity.getNavigationLink(navPropertyName); if (link != null && entityType.getNavigationProperty(navPropertyName).isCollection()) { - applyOptionsToEntityCollection(link.getInlineEntitySet(), - targetEdmEntitySet, - item.getFilterOption(), - item.getOrderByOption(), - item.getCountOption(), - item.getSkipOption(), - item.getTopOption(), - item.getExpandOption()); + applyOptionsToEntityCollection(link.getInlineEntitySet(), + targetEdmEntitySet, + item.getFilterOption(), + item.getOrderByOption(), + item.getCountOption(), + item.getSkipOption(), + item.getTopOption(), + item.getExpandOption()); } } else { throw new ODataApplicationException("Not supported resource part in expand system query option", @@ -96,83 +96,84 @@ public class ExpandSystemQueryOptionHandler { } } - private void applyOptionsToEntityCollection(final EntitySet entitySet, final EdmBindingTarget edmBindingTarget, + private void applyOptionsToEntityCollection(final EntityCollection entitySet, + final EdmBindingTarget edmBindingTarget, final FilterOption filterOption, final OrderByOption orderByOption, final CountOption countOption, - final SkipOption skipOption, final TopOption topOption, final ExpandOption expandOption) - throws ODataApplicationException { + final SkipOption skipOption, final TopOption topOption, final ExpandOption expandOption) + throws ODataApplicationException { FilterHandler.applyFilterSystemQuery(filterOption, entitySet, edmBindingTarget); OrderByHandler.applyOrderByOption(orderByOption, entitySet, edmBindingTarget); // TODO Add CountHandler SkipHandler.applySkipSystemQueryHandler(skipOption, entitySet); TopHandler.applyTopSystemQueryOption(topOption, entitySet); - + // Apply nested expand system query options to remaining entities - if(expandOption != null) { - for(final Entity entity : entitySet.getEntities()) { + if (expandOption != null) { + for (final Entity entity : entitySet.getEntities()) { applyExpandOptionToEntity(entity, edmBindingTarget, expandOption); } } } - public EntitySet transformEntitySetGraphToTree(final EntitySet entitySet, final EdmBindingTarget edmBindingTarget, - final ExpandOption expand) throws ODataApplicationException { - - final EntitySet newEntitySet = newEntitySet(entitySet); - - for(final Entity entity : entitySet.getEntities()) { + public EntityCollection transformEntitySetGraphToTree(final EntityCollection entitySet, + final EdmBindingTarget edmBindingTarget, final ExpandOption expand) throws ODataApplicationException { + + final EntityCollection newEntitySet = newEntitySet(entitySet); + + for (final Entity entity : entitySet.getEntities()) { newEntitySet.getEntities().add(transformEntityGraphToTree(entity, edmBindingTarget, expand)); } - + return newEntitySet; } - - public Entity transformEntityGraphToTree(final Entity entity, EdmBindingTarget edmEntitySet, + + public Entity transformEntityGraphToTree(final Entity entity, EdmBindingTarget edmEntitySet, final ExpandOption expand) throws ODataApplicationException { final Entity newEntity = newEntity(entity); if (hasExpandItems(expand)) { final boolean expandAll = expandAll(expand); final Set expanded = expandAll ? null : getExpandedPropertyNames(expand.getExpandItems()); final EdmEntityType edmType = edmEntitySet.getEntityType(); - + for (final Link link : entity.getNavigationLinks()) { final String propertyName = link.getTitle(); - + if (expandAll || expanded.contains(propertyName)) { final EdmNavigationProperty edmNavigationProperty = edmType.getNavigationProperty(propertyName); final EdmBindingTarget edmBindingTarget = edmEntitySet.getRelatedBindingTarget(propertyName); final Link newLink = newLink(link); newEntity.getNavigationLinks().add(newLink); final ExpandOption innerExpandOption = getInnerExpandOption(expand, propertyName); - - if(edmNavigationProperty.isCollection()) { - newLink.setInlineEntitySet(transformEntitySetGraphToTree(link.getInlineEntitySet(), - edmBindingTarget, - innerExpandOption)); + + if (edmNavigationProperty.isCollection()) { + newLink.setInlineEntitySet(transformEntitySetGraphToTree(link.getInlineEntitySet(), + edmBindingTarget, + innerExpandOption)); } else { - newLink.setInlineEntity(transformEntityGraphToTree(link.getInlineEntity(), - edmBindingTarget, - innerExpandOption)); + newLink.setInlineEntity(transformEntityGraphToTree(link.getInlineEntity(), + edmBindingTarget, + innerExpandOption)); } } } - + } return newEntity; } - - public EntitySet newEntitySet(final EntitySet entitySet) { - final EntitySet newEntitySet = new EntitySet(); + + public EntityCollection newEntitySet(final EntityCollection entitySet) { + final EntityCollection newEntitySet = new EntityCollection(); newEntitySet.setCount(entitySet.getCount()); newEntitySet.setDeltaLink(entitySet.getDeltaLink()); newEntitySet.setNext(entitySet.getNext()); - + return newEntitySet; } - + private Entity newEntity(final Entity entity) { final Entity newEntity = new Entity(); - + newEntity.getProperties().addAll(entity.getProperties()); newEntity.getAnnotations().addAll(entity.getAnnotations()); newEntity.getAssociationLinks().addAll(entity.getAssociationLinks()); @@ -185,24 +186,24 @@ public class ExpandSystemQueryOptionHandler { newEntity.setSelfLink(entity.getSelfLink()); newEntity.setType(entity.getType()); newEntity.getNavigationBindings().addAll(entity.getNavigationBindings()); - + return newEntity; } - + private Link newLink(Link link) { final Link newLink = new Link(); newLink.setMediaETag(link.getMediaETag()); newLink.setTitle(link.getTitle()); newLink.setType(link.getType()); newLink.setRel(link.getRel()); - + return newLink; } - + private boolean hasExpandItems(ExpandOption expand) { return expand != null && expand.getExpandItems() != null && !expand.getExpandItems().isEmpty(); } - + private boolean expandAll(ExpandOption expand) { for (final ExpandItem item : expand.getExpandItems()) { if (item.isStar()) { @@ -211,7 +212,7 @@ public class ExpandSystemQueryOptionHandler { } return false; } - + private Set getExpandedPropertyNames(List expandItems) throws ODataApplicationException { Set expanded = new HashSet(); for (final ExpandItem item : expandItems) { @@ -230,14 +231,14 @@ public class ExpandSystemQueryOptionHandler { } private ExpandOption getInnerExpandOption(final ExpandOption expand, final String propertyName) { - for(final ExpandItem item : expand.getExpandItems()) { + for (final ExpandItem item : expand.getExpandItems()) { final UriResource resource = item.getResourcePath().getUriResourceParts().get(0); - if(resource instanceof UriResourceNavigation + if (resource instanceof UriResourceNavigation && propertyName.equals(((UriResourceNavigation) resource).getProperty().getName())) { return item.getExpandOption(); } } - + return null; } } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/CountHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/CountHandler.java index 59f6a4e34..cfe79ec36 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/CountHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/CountHandler.java @@ -18,11 +18,11 @@ */ package org.apache.olingo.server.tecsvc.processor.queryoptions.options; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.server.api.uri.queryoption.CountOption; public class CountHandler { - public static void applyCountSystemQueryOption(final CountOption countOption, final EntitySet entitySet) { + public static void applyCountSystemQueryOption(final CountOption countOption, final EntityCollection entitySet) { if(countOption != null && countOption.getValue()) { entitySet.setCount(entitySet.getEntities().size()); } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java index 69fa2e4f2..3db6b988c 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/FilterHandler.java @@ -22,7 +22,7 @@ import java.util.Iterator; import java.util.Locale; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.edm.EdmBindingTarget; import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; @@ -45,7 +45,7 @@ public class FilterHandler { primBoolean = oData.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Boolean); } - public static void applyFilterSystemQuery(FilterOption filterOption, EntitySet entitySet, + public static void applyFilterSystemQuery(FilterOption filterOption, EntityCollection entitySet, EdmBindingTarget edmEntitySet) throws ODataApplicationException { if (filterOption == null) { diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/OrderByHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/OrderByHandler.java index d166c4eb9..ce472ba2a 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/OrderByHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/OrderByHandler.java @@ -23,7 +23,7 @@ import java.util.Comparator; import java.util.Locale; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.edm.EdmBindingTarget; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; @@ -34,7 +34,7 @@ import org.apache.olingo.server.tecsvc.processor.queryoptions.expression.Express import org.apache.olingo.server.tecsvc.processor.queryoptions.expression.operand.TypedOperand; public class OrderByHandler { - public static void applyOrderByOption(final OrderByOption orderByOption, final EntitySet entitySet, + public static void applyOrderByOption(final OrderByOption orderByOption, final EntityCollection entitySet, final EdmBindingTarget edmBindingTarget) throws ODataApplicationException { if (orderByOption == null) { @@ -54,7 +54,7 @@ public class OrderByHandler { } } - private static void applyOrderByOptionInternal(final OrderByOption orderByOption, final EntitySet entitySet, + private static void applyOrderByOptionInternal(final OrderByOption orderByOption, final EntityCollection entitySet, final EdmBindingTarget edmBindingTarget) throws ODataApplicationException { Collections.sort(entitySet.getEntities(), new Comparator() { @Override diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java index a945edb4f..0871a33e6 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/ServerSidePagingHandler.java @@ -22,7 +22,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Locale; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; @@ -34,7 +34,7 @@ public class ServerSidePagingHandler { private static final int MAX_PAGE_SIZE = 10; private static final String ES_SERVER_SIDE_PAGING = "ESServerSidePaging"; - public static void applyServerSidePaging(final SkipTokenOption skipTokenOption, final EntitySet entitySet, + public static void applyServerSidePaging(final SkipTokenOption skipTokenOption, final EntityCollection entitySet, final EdmEntitySet edmEntitySet, final String rawRequestUri) throws ODataApplicationException { if (edmEntitySet != null && shouldApplyServerSidePaging(edmEntitySet)) { diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SkipHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SkipHandler.java index 48414ea6b..835657b30 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SkipHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SkipHandler.java @@ -22,13 +22,13 @@ import java.util.Iterator; import java.util.Locale; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.uri.queryoption.SkipOption; public class SkipHandler { - public static void applySkipSystemQueryHandler(final SkipOption skipOption, final EntitySet entitySet) + public static void applySkipSystemQueryHandler(final SkipOption skipOption, final EntityCollection entitySet) throws ODataApplicationException { if (skipOption != null) { @@ -41,7 +41,7 @@ public class SkipHandler { } } - static void popAtMost(final EntitySet entitySet, final int n) { + static void popAtMost(final EntityCollection entitySet, final int n) { final Iterator iter = entitySet.getEntities().iterator(); int i = 0; diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/TopHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/TopHandler.java index 7edc105d0..3177f44b0 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/TopHandler.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/TopHandler.java @@ -20,13 +20,13 @@ package org.apache.olingo.server.tecsvc.processor.queryoptions.options; import java.util.Locale; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.http.HttpStatusCode; import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.uri.queryoption.TopOption; public class TopHandler { - public static void applyTopSystemQueryOption(final TopOption topOption, final EntitySet entitySet) + public static void applyTopSystemQueryOption(final TopOption topOption, final EntityCollection entitySet) throws ODataApplicationException { if (topOption != null) { @@ -39,7 +39,7 @@ public class TopHandler { } } - static void reduceToSize(final EntitySet entitySet, final int n) { + static void reduceToSize(final EntityCollection entitySet, final int n) { while (entitySet.getEntities().size() > n) { entitySet.getEntities().remove(entitySet.getEntities().size() - 1); } diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java index 4549a0349..c9a8e65ee 100644 --- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java +++ b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java @@ -24,7 +24,7 @@ import java.util.List; import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmEntityContainer; @@ -88,14 +88,14 @@ public class DataProviderTest { @Test public void esAllPrim() throws Exception { final DataProvider data = new DataProvider(); - EntitySet outSet = data.readAll(esAllPrim); + EntityCollection outSet = data.readAll(esAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Entity first = outSet.getEntities().get(0); Assert.assertEquals(16, first.getProperties().size()); Assert.assertEquals(2, first.getNavigationLinks().size()); - final EntitySet target = first.getNavigationLink("NavPropertyETTwoPrimMany").getInlineEntitySet(); + final EntityCollection target = first.getNavigationLink("NavPropertyETTwoPrimMany").getInlineEntitySet(); Assert.assertNotNull(target); Assert.assertEquals(1, target.getEntities().size()); Assert.assertEquals(data.readAll(entityContainer.getEntitySet("ESTwoPrim")).getEntities().get(1), @@ -107,7 +107,7 @@ public class DataProviderTest { @Test public void esCollAllPrim() throws Exception { - EntitySet outSet = new DataProvider().readAll(esCollAllPrim); + EntityCollection outSet = new DataProvider().readAll(esCollAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Assert.assertEquals(17, outSet.getEntities().get(0).getProperties().size()); @@ -120,7 +120,7 @@ public class DataProviderTest { @Test public void esCompAllPrim() throws Exception { - EntitySet outSet = new DataProvider().readAll(esCompAllPrim); + EntityCollection outSet = new DataProvider().readAll(esCompAllPrim); Assert.assertEquals(3, outSet.getEntities().size()); Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size()); @@ -133,7 +133,7 @@ public class DataProviderTest { @Test public void esMixPrimCollComp() throws Exception { - EntitySet outSet = new DataProvider().readAll(esMixPrimCollComp); + EntityCollection outSet = new DataProvider().readAll(esMixPrimCollComp); Assert.assertEquals(3, outSet.getEntities().size()); Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size()); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java index 4864d24f5..0a593dc4b 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; import java.util.List; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -43,7 +43,7 @@ public class ODataDeserializerEntityCollectionTest extends AbstractODataDeserial public void esAllPrim() throws Exception { EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")); InputStream stream = getFileAsStream("ESAllPrim.json"); - EntitySet entitySet = + EntityCollection entitySet = OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType) .getEntityCollection(); @@ -78,7 +78,7 @@ public class ODataDeserializerEntityCollectionTest extends AbstractODataDeserial public void eSCompCollComp() throws Exception { EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCompCollComp")); InputStream stream = getFileAsStream("ESCompCollComp.json"); - EntitySet entitySet = + EntityCollection entitySet = OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType) .getEntityCollection(); @@ -100,7 +100,7 @@ public class ODataDeserializerEntityCollectionTest extends AbstractODataDeserial String entityCollectionString = "{\"value\" : []}"; InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes()); EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")); - EntitySet entityCollection = + EntityCollection entityCollection = OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType) .getEntityCollection(); assertNotNull(entityCollection.getEntities()); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java index 801377ef4..8d44be385 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java @@ -27,7 +27,7 @@ import org.apache.commons.io.IOUtils; import org.apache.olingo.commons.api.data.ContextURL; import org.apache.olingo.commons.api.data.ContextURL.Suffix; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; import org.apache.olingo.commons.api.edm.Edm; @@ -159,7 +159,7 @@ public class ODataJsonSerializerTest { @Test public void entitySetAllPrim() throws Exception { final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim"); - EntitySet entitySet = data.readAll(edmEntitySet); + EntityCollection entitySet = data.readAll(edmEntitySet); entitySet.setCount(entitySet.getEntities().size()); entitySet.setNext(URI.create("/next")); CountOption countOption = Mockito.mock(CountOption.class); @@ -305,7 +305,7 @@ public class ODataJsonSerializerTest { @Test public void entitySetTwoPrimNoMetadata() throws Exception { final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim"); - final EntitySet entitySet = data.readAll(edmEntitySet); + final EntityCollection entitySet = data.readAll(edmEntitySet); InputStream result = new ODataJsonSerializer(ODataFormat.JSON_NO_METADATA) .entityCollection(metadata, edmEntitySet.getEntityType(), entitySet, EntityCollectionSerializerOptions.with() @@ -338,7 +338,7 @@ public class ODataJsonSerializerTest { @Test public void entitySetMedia() throws Exception { final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMedia"); - final EntitySet entitySet = data.readAll(edmEntitySet); + final EntityCollection entitySet = data.readAll(edmEntitySet); final String resultString = IOUtils.toString(serializer.entityCollection(metadata, edmEntitySet.getEntityType(), entitySet, EntityCollectionSerializerOptions.with() @@ -398,7 +398,7 @@ public class ODataJsonSerializerTest { public void selectComplex() throws Exception { final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp"); final EdmEntityType entityType = edmEntitySet.getEntityType(); - final EntitySet entitySet = data.readAll(edmEntitySet); + final EntityCollection entitySet = data.readAll(edmEntitySet); final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList( ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp", "PropertyString"))); InputStream result = serializer @@ -422,7 +422,7 @@ public class ODataJsonSerializerTest { public void selectComplexTwice() throws Exception { final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp"); final EdmEntityType entityType = edmEntitySet.getEntityType(); - final EntitySet entitySet = data.readAll(edmEntitySet); + final EntityCollection entitySet = data.readAll(edmEntitySet); final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList( ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp", "PropertyString"), ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp"))); diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java b/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java index b8789bddc..c2a1b1c50 100644 --- a/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java +++ b/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java @@ -25,7 +25,7 @@ import java.util.Map; import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; import org.apache.olingo.commons.api.edm.EdmEntitySet; @@ -38,21 +38,21 @@ import org.apache.olingo.server.sample.edmprovider.CarsEdmProvider; public class DataProvider { - private final Map data; + private final Map data; public DataProvider() { - data = new HashMap(); + data = new HashMap(); data.put("Cars", createCars()); data.put("Manufacturers", createManufacturers()); } - public EntitySet readAll(EdmEntitySet edmEntitySet) { + public EntityCollection readAll(EdmEntitySet edmEntitySet) { return data.get(edmEntitySet.getName()); } public Entity read(final EdmEntitySet edmEntitySet, final List keys) throws DataProviderException { final EdmEntityType entityType = edmEntitySet.getEntityType(); - final EntitySet entitySet = data.get(edmEntitySet.getName()); + final EntityCollection entitySet = data.get(edmEntitySet.getName()); if (entitySet == null) { return null; } else { @@ -93,8 +93,8 @@ public class DataProvider { } } - private EntitySet createCars() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createCars() { + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity() .addProperty(createPrimitive("Id", 1)) @@ -137,8 +137,8 @@ public class DataProvider { return entitySet; } - private EntitySet createManufacturers() { - EntitySet entitySet = new EntitySet(); + private EntityCollection createManufacturers() { + EntityCollection entitySet = new EntityCollection(); entitySet.getEntities().add(new Entity() .addProperty(createPrimitive("Id", 1)) diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java b/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java index 90df22483..4305415c1 100644 --- a/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java +++ b/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java @@ -27,7 +27,7 @@ import java.util.Locale; import org.apache.olingo.commons.api.data.ContextURL; import org.apache.olingo.commons.api.data.ContextURL.Suffix; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.EntitySet; +import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntitySet; @@ -97,7 +97,7 @@ public class CarsProcessor implements EntityCollectionProcessor, EntityProcessor // Second we fetch the data for this specific entity set from the mock database and transform it into an EntitySet // object which is understood by our serialization - EntitySet entitySet = dataProvider.readAll(edmEntitySet); + EntityCollection entitySet = dataProvider.readAll(edmEntitySet); // Next we create a serializer based on the requested format. This could also be a custom format but we do not // support them in this example