From 696c58645d3a82bcdea976c3d25e7f5fb9f93a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= <--global> Date: Fri, 23 May 2014 12:32:30 +0200 Subject: [PATCH] Bunch of client API review --- .../commons/EntitySetInvocationHandler.java | 2 +- .../olingo/fit/v3/QueryOptionsTestITCase.java | 22 --------- .../fit/v3/ServiceDocumentTestITCase.java | 2 +- .../v4/BoundOperationInvokeTestITCase.java | 6 +-- .../olingo/fit/v4/ConformanceTestITCase.java | 14 +++--- .../fit/v4/EntityRetrieveTestITCase.java | 8 ++-- .../v4/JSONFormatConformanceTestITCase.java | 2 +- .../olingo/fit/v4/PropertyTestITCase.java | 6 +-- .../olingo/fit/v4/SingletonTestITCase.java | 18 +++---- .../request/cud/v4/CUDRequestFactory.java | 8 ++-- .../retrieve/v4/RetrieveRequestFactory.java | 4 +- .../client/api/data/ServiceDocument.java | 34 +------------ .../client/api/data/ServiceDocumentItem.java | 7 +-- .../request/cud/v4/CUDRequestFactoryImpl.java | 10 ++-- .../v4/RetrieveRequestFactoryImpl.java | 6 +-- .../core/data/AbstractServiceDocument.java | 30 ------------ .../data/JSONServiceDocumentDeserializer.java | 5 +- .../core/data/ServiceDocumentItemImpl.java | 24 ++-------- .../data/XMLServiceDocumentDeserializer.java | 10 ++-- .../client/core/op/AbstractODataBinder.java | 6 +-- .../core/op/impl/v4/ODataBinderImpl.java | 16 +++---- .../client/core/v3/ServiceDocumentTest.java | 2 +- .../olingo/client/core/v4/EntitySetTest.java | 2 +- .../olingo/client/core/v4/EntityTest.java | 2 +- .../client/core/v4/ServiceDocumentTest.java | 2 +- .../olingo/client/core/v3/atom_cleanup.xsl | 1 + .../client/core/v4/serviceDocument.json | 5 +- .../olingo/client/core/v4/serviceDocument.xml | 2 +- .../olingo/commons/api/data/Entity.java | 4 +- .../olingo/commons/api/data/EntitySet.java | 2 +- .../api/domain/ODataServiceDocument.java | 48 +++++++++---------- .../commons/api/domain/v4/ODataEntity.java | 5 +- .../api/domain/v4/ODataObjectFactory.java | 2 +- .../{Singleton.java => ODataSingleton.java} | 2 +- .../core/data/AbstractODataObject.java | 28 ++--------- .../commons/core/data/AtomDeserializer.java | 2 +- .../commons/core/data/AtomSerializer.java | 19 +++----- .../core/data/JSONEntityDeserializer.java | 2 +- .../core/data/JSONEntitySerializer.java | 2 +- .../core/data/JSONEntitySetSerializer.java | 2 +- .../core/domain/v4/ODataEntityImpl.java | 17 +++---- .../domain/v4/ODataObjectFactoryImpl.java | 4 +- 42 files changed, 130 insertions(+), 265 deletions(-) rename lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/{Singleton.java => ODataSingleton.java} (94%) diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java index ba8582775..71d875567 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntitySetInvocationHandler.java @@ -301,7 +301,7 @@ class EntitySetInvocationHandler< final List annotations = new ArrayList(); if (isSingleton) { - final ODataRetrieveResponse res = + final ODataRetrieveResponse res = ((ODataClient) getClient()).getRetrieveRequestFactory().getSingletonRequest(uri).execute(); entities.add(res.getBody()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java index 1c0f8bd3b..1b15c3ff9 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java @@ -30,13 +30,11 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse; import org.apache.olingo.client.api.uri.v3.URIBuilder; import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount; -import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.domain.ODataInlineEntitySet; import org.apache.olingo.commons.api.domain.v3.ODataEntity; import org.apache.olingo.commons.api.domain.v3.ODataEntitySet; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.format.ODataPubFormat; -import org.apache.olingo.commons.core.data.AtomEntityImpl; import org.junit.Test; /** @@ -179,24 +177,4 @@ public class QueryOptionsTestITCase extends AbstractTestITCase { assertEquals(1, customer.getNavigationLinks().size()); assertTrue((customer.getNavigationLinks().get(0) instanceof ODataInlineEntitySet)); } - - @Test - public void issue131() { - final URIBuilder uriBuilder = client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Customer").appendKeySegment(-7).select("Name"); - - ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); - req.setFormat(ODataPubFormat.ATOM); - - final ODataEntity customer = req.execute().getBody(); - assertEquals(0, customer.getProperties().size()); - - req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build()); - req.setFormat(ODataPubFormat.ATOM); - - final Entity atomEntry = - client.getDeserializer().toEntity(req.execute().getRawResponse(), ODataPubFormat.ATOM).getPayload(); - assertEquals("remotingdestructorprinterswitcheschannelssatellitelanguageresolve", - ((AtomEntityImpl) atomEntry).getSummary()); - } } diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/ServiceDocumentTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/ServiceDocumentTestITCase.java index a66874c84..25a2b37f8 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v3/ServiceDocumentTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v3/ServiceDocumentTestITCase.java @@ -38,7 +38,7 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase { assertEquals(200, res.getStatusCode()); final ODataServiceDocument serviceDocument = res.getBody(); - assertEquals(24, serviceDocument.getEntitySetTitles().size()); + assertEquals(24, serviceDocument.getEntitySetNames().size()); assertEquals(URI.create(testStaticServiceRootURL + "/ComputerDetail"), serviceDocument.getEntitySetURI("ComputerDetail")); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java index 4a139436b..e2bf9f290 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/BoundOperationInvokeTestITCase.java @@ -38,7 +38,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity; import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; import org.apache.olingo.commons.api.domain.v4.ODataEnumValue; import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.FullQualifiedName; @@ -50,10 +50,10 @@ public class BoundOperationInvokeTestITCase extends AbstractTestITCase { private void functions(final ODataPubFormat format) throws EdmPrimitiveTypeException { // GetEmployeesCount URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company"); - final ODataEntityRequest singletonReq = + final ODataEntityRequest singletonReq = client.getRetrieveRequestFactory().getSingletonRequest(builder.build()); singletonReq.setFormat(format); - final Singleton company = singletonReq.execute().getBody(); + final ODataSingleton company = singletonReq.execute().getBody(); assertNotNull(company); ODataOperation boundOp = company.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetEmployeesCount"); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java index 776d49964..8f67cdff6 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/ConformanceTestITCase.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertFalse; import org.junit.Test; import java.net.URI; - import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; @@ -213,12 +212,12 @@ public class ConformanceTestITCase extends AbstractTestITCase { new FullQualifiedName("Microsoft.Test.OData.Services.OpenTypesServiceV4.RowIndex")); getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newPrimitiveProperty("Id", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); + getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id))); // add property not in metadata getClient().getBinder().add(rowIndex, getClient().getObjectFactory().newPrimitiveProperty("aString", - getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string"))); + getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("string"))); // add navigation property not in metadata rowIndex.addLink(client.getObjectFactory().newEntityNavigationLink( @@ -226,7 +225,7 @@ public class ConformanceTestITCase extends AbstractTestITCase { final ODataEntityCreateRequest createReq = getClient().getCUDRequestFactory(). getEntityCreateRequest(getClient().newURIBuilder(testOpenTypeServiceRootURL). - appendEntitySetSegment("RowIndex").build(), rowIndex); + appendEntitySetSegment("RowIndex").build(), rowIndex); final ODataEntityCreateResponse createRes = createReq.execute(); assertEquals(201, createRes.getStatusCode()); @@ -234,7 +233,6 @@ public class ConformanceTestITCase extends AbstractTestITCase { final URIBuilder builder = getClient().newURIBuilder(testOpenTypeServiceRootURL). appendEntitySetSegment("RowIndex").appendKeySegment(id); - rowIndex = read(ODataPubFormat.JSON_FULL_METADATA, builder.build()); assertNotNull(rowIndex); assertEquals(EdmPrimitiveTypeKind.Int32, rowIndex.getProperty("Id").getPrimitiveValue().getTypeKind()); @@ -310,10 +308,10 @@ public class ConformanceTestITCase extends AbstractTestITCase { final ODataEntity entity = res.getBody(); assertNotNull(entity); - assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); + assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); - final URI referenceURI = - client.newURIBuilder(testStaticServiceRootURL).appendEntityIdSegment(entity.getReference()).build(); + final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL). + appendEntityIdSegment(entity.getId().toASCIIString()).build(); req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI); req.setFormat(ODataPubFormat.JSON_FULL_METADATA); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java index fc3767a98..4e8afaa85 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntityRetrieveTestITCase.java @@ -180,7 +180,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { assertNull(entitySet); final ResWrap entity = res.getBodyAs(ODataEntity.class); - assertTrue(entity.getPayload().getReference().endsWith("/StaticService/V40/Static.svc/People(5)")); + assertTrue(entity.getPayload().getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/People(5)")); } @Test @@ -284,10 +284,10 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase { final ODataEntity entity = res.getBody(); assertNotNull(entity); - assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); + assertTrue(entity.getId().toASCIIString().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)")); - final URI referenceURI = - client.newURIBuilder(testStaticServiceRootURL).appendEntityIdSegment(entity.getReference()).build(); + final URI referenceURI = client.newURIBuilder(testStaticServiceRootURL). + appendEntityIdSegment(entity.getId().toASCIIString()).build(); req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI); req.setFormat(format); 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 9dcff7fc5..346a1443b 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 @@ -224,7 +224,7 @@ public class JSONFormatConformanceTestITCase extends AbstractTestITCase { assertEquals("W/\"A1FF3E230954908F\"", entity.getMetadataETag()); assertEquals("W/\"A1FF3E230954908G\"", entity.getPayload().getETag()); assertEquals("Model.VipCustomer", entity.getPayload().getType()); - assertEquals("http://host/service/Employees(PersonID=3)", entity.getPayload().getId()); + assertEquals("http://host/service/Employees(PersonID=3)", entity.getPayload().getId().toASCIIString()); assertEquals("People(976)", entity.getPayload().getEditLink().getHref()); assertEquals("Employees(1)/$value", entity.getPayload().getMediaContentSource().toASCIIString()); assertEquals("image/jpeg", entity.getPayload().getMediaContentType()); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java index abd4cd0b8..c3000872a 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/PropertyTestITCase.java @@ -176,12 +176,12 @@ public class PropertyTestITCase extends AbstractTestITCase { public void createAndDelete() { // 1. create final ODataEntity category = client.getObjectFactory().newEntity(null); - category.setReference(client.newURIBuilder(testStaticServiceRootURL). - appendEntitySetSegment("Categories").appendKeySegment(1).build().toASCIIString()); + category.setId(client.newURIBuilder(testStaticServiceRootURL). + appendEntitySetSegment("Categories").appendKeySegment(1).build()); final URIBuilder createBuilder = client.newURIBuilder(testStaticServiceRootURL). appendEntitySetSegment("Products").appendKeySegment(0).appendNavigationSegment("Categories"). - appendRefSegment(); + appendRefSegment(); final ODataEntityCreateRequest createReq = client.getCUDRequestFactory(). getEntityCreateRequest(createBuilder.build(), category); diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java index 46429c695..bebd92716 100644 --- a/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/v4/SingletonTestITCase.java @@ -32,7 +32,7 @@ import org.apache.olingo.client.api.uri.v4.URIBuilder; import org.apache.olingo.client.api.v4.ODataClient; import org.apache.olingo.commons.api.domain.v4.ODataAnnotation; import org.apache.olingo.commons.api.domain.v4.ODataValuable; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.format.ODataPubFormat; @@ -42,10 +42,10 @@ public class SingletonTestITCase extends AbstractTestITCase { private void read(final ODataClient client, final ODataPubFormat format) throws EdmPrimitiveTypeException { final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company"); - final ODataEntityRequest singleton = + final ODataEntityRequest singleton = client.getRetrieveRequestFactory().getSingletonRequest(builder.build()); singleton.setFormat(format); - final Singleton company = singleton.execute().getBody(); + final ODataSingleton company = singleton.execute().getBody(); assertNotNull(company); assertEquals(0, company.getProperty("CompanyID").getPrimitiveValue().toCastValue(Integer.class), 0); @@ -74,11 +74,11 @@ public class SingletonTestITCase extends AbstractTestITCase { throws EdmPrimitiveTypeException { final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss"); - final ODataEntityRequest singleton = + final ODataEntityRequest singleton = client.getRetrieveRequestFactory().getSingletonRequest(builder.build()); singleton.setFormat(format); singleton.setPrefer(client.newPreferences().includeAnnotations("*")); - final Singleton boss = singleton.execute().getBody(); + final ODataSingleton boss = singleton.execute().getBody(); assertNotNull(boss); assertFalse(boss.getAnnotations().isEmpty()); @@ -102,20 +102,20 @@ public class SingletonTestITCase extends AbstractTestITCase { } private void update(final ODataPubFormat format) throws EdmPrimitiveTypeException { - final Singleton changes = getClient().getObjectFactory().newSingleton( + final ODataSingleton changes = getClient().getObjectFactory().newSingleton( new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company")); changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Revenue", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt64(132520L))); final URI uri = client.newURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Company").build(); - final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). + final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory(). getSingletonUpdateRequest(uri, UpdateType.PATCH, changes); req.setFormat(format); - final ODataEntityUpdateResponse res = req.execute(); + final ODataEntityUpdateResponse res = req.execute(); assertEquals(204, res.getStatusCode()); - final Singleton updated = getClient().getRetrieveRequestFactory().getSingletonRequest(uri).execute().getBody(); + final ODataSingleton updated = getClient().getRetrieveRequestFactory().getSingletonRequest(uri).execute().getBody(); assertNotNull(updated); assertEquals(132520, updated.getProperty("Revenue").getPrimitiveValue().toCastValue(Integer.class), 0); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java index 975f06501..2c6964941 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/CUDRequestFactory.java @@ -21,12 +21,14 @@ package org.apache.olingo.client.api.communication.request.cud.v4; import java.net.URI; import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory; import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; public interface CUDRequestFactory extends CommonCUDRequestFactory { - ODataEntityUpdateRequest getSingletonUpdateRequest(URI targetURI, UpdateType type, Singleton changes); + ODataEntityUpdateRequest getSingletonUpdateRequest( + URI targetURI, UpdateType type, ODataSingleton changes); - ODataEntityUpdateRequest getSingletonUpdateRequest(UpdateType type, Singleton entity); + ODataEntityUpdateRequest getSingletonUpdateRequest( + UpdateType type, ODataSingleton entity); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java index 592cbd8c0..a705f8e3c 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java @@ -27,7 +27,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataProperty import org.apache.olingo.commons.api.domain.v4.ODataEntity; import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; @SuppressWarnings("unchecked") public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory { @@ -38,7 +38,7 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory { @Override ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri); - ODataEntityRequest getSingletonRequest(URI uri); + ODataEntityRequest getSingletonRequest(URI uri); @Override ODataEntityRequest getEntityRequest(URI uri); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java index a6deb49e4..f3ce7f34e 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java @@ -52,14 +52,6 @@ public interface ServiceDocument { */ ServiceDocumentItem getEntitySetByName(String name); - /** - * Gets top level entity set with given title. - * - * @param title entity set title - * @return entity set with given title if found, otherwise null - */ - ServiceDocumentItem getEntitySetByTitle(String title); - /** * Gets top level function imports. * @@ -67,7 +59,7 @@ public interface ServiceDocument { */ List getFunctionImports(); - /** + /* * Gets top level function import set with given name. * * @param name function import name @@ -75,14 +67,6 @@ public interface ServiceDocument { */ ServiceDocumentItem getFunctionImportByName(String name); - /** - * Gets top level function import with given title. - * - * @param title function import title - * @return function import with given title if found, otherwise null - */ - ServiceDocumentItem getFunctionImportByTitle(String title); - /** * Gets top level singletons. * @@ -98,26 +82,10 @@ public interface ServiceDocument { */ ServiceDocumentItem getSingletonByName(String name); - /** - * Gets top level singleton with given title. - * - * @param title singleton title - * @return singleton with given title if found, otherwise null - */ - ServiceDocumentItem getSingletonByTitle(String title); - /** * Gets related service documents. * * @return related service documents. */ List getRelatedServiceDocuments(); - - /** - * Gets related service document with given title. - * - * @param title related service document title - * @return related service document with given title if found, otherwise null - */ - ServiceDocumentItem getRelatedServiceDocumentByTitle(String title); } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocumentItem.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocumentItem.java index 684777123..31cca9435 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocumentItem.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocumentItem.java @@ -16,15 +16,12 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.olingo.client.api.data; public interface ServiceDocumentItem { - String getHref(); - String getName(); - String getTitle(); - + String getUrl(); + } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java index 7f1dee97b..db9813427 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/v4/CUDRequestFactoryImpl.java @@ -24,7 +24,7 @@ import org.apache.olingo.client.api.v4.ODataClient; import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory; import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType; import org.apache.olingo.client.core.communication.request.cud.AbstractCUDRequestFactory; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory implements CUDRequestFactory { @@ -36,15 +36,15 @@ public class CUDRequestFactoryImpl extends AbstractCUDRequestFactory } @Override - public ODataEntityUpdateRequest getSingletonUpdateRequest( - final UpdateType type, final Singleton entity) { + public ODataEntityUpdateRequest getSingletonUpdateRequest( + final UpdateType type, final ODataSingleton entity) { return super.getEntityUpdateRequest(type, entity); } @Override - public ODataEntityUpdateRequest getSingletonUpdateRequest( - final URI targetURI, final UpdateType type, final Singleton changes) { + public ODataEntityUpdateRequest getSingletonUpdateRequest( + final URI targetURI, final UpdateType type, final ODataSingleton changes) { return super.getEntityUpdateRequest(targetURI, type, changes); } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java index 5006e1a71..e2433dca0 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java @@ -35,7 +35,7 @@ import org.apache.olingo.client.core.communication.request.retrieve.ODataPropert import org.apache.olingo.commons.api.domain.v4.ODataEntity; import org.apache.olingo.commons.api.domain.v4.ODataEntitySet; import org.apache.olingo.commons.api.domain.v4.ODataProperty; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; @SuppressWarnings("unchecked") public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory @@ -64,8 +64,8 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory } @Override - public ODataEntityRequest getSingletonRequest(final URI uri) { - return new ODataEntityRequestImpl(client, uri); + public ODataEntityRequest getSingletonRequest(final URI uri) { + return new ODataEntityRequestImpl(client, uri); } @Override diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java index 83b3a1286..9631e8580 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java @@ -87,16 +87,6 @@ public abstract class AbstractServiceDocument implements ServiceDocument { return result; } - protected ServiceDocumentItem getByTitle(final List elements, final String title) { - ServiceDocumentItem result = null; - for (ServiceDocumentItem element : elements) { - if (title.equals(element.getTitle())) { - result = element; - } - } - return result; - } - @Override public List getEntitySets() { return entitySets; @@ -107,11 +97,6 @@ public abstract class AbstractServiceDocument implements ServiceDocument { return getByName(getEntitySets(), name); } - @Override - public ServiceDocumentItem getEntitySetByTitle(final String title) { - return getByTitle(getEntitySets(), title); - } - @Override public List getFunctionImports() { return Collections.emptyList(); @@ -122,11 +107,6 @@ public abstract class AbstractServiceDocument implements ServiceDocument { return getByName(getFunctionImports(), name); } - @Override - public ServiceDocumentItem getFunctionImportByTitle(final String title) { - return getByTitle(getFunctionImports(), title); - } - @Override public List getSingletons() { return Collections.emptyList(); @@ -137,21 +117,11 @@ public abstract class AbstractServiceDocument implements ServiceDocument { return getByName(getSingletons(), name); } - @Override - public ServiceDocumentItem getSingletonByTitle(final String title) { - return getByTitle(getSingletons(), title); - } - @Override public List getRelatedServiceDocuments() { return Collections.emptyList(); } - @Override - public ServiceDocumentItem getRelatedServiceDocumentByTitle(final String title) { - return getByTitle(getRelatedServiceDocuments(), title); - } - @Override public boolean equals(final Object obj) { return EqualsBuilder.reflectionEquals(this, obj); diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java index c7b62f410..4f84fc6dd 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java @@ -73,10 +73,7 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer> { - private String getTitle(final JsonParser jp) throws IOException { + private String getName(final JsonParser jp) throws IOException { String title = jp.nextTextValue(); if (title == null) { jp.nextToken(); @@ -56,11 +56,9 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer reference) { final Entity entity = super.getEntity(odataEntity, reference); - entity.setId(((ODataEntity) odataEntity).getReference()); + entity.setId(((ODataEntity) odataEntity).getId()); annotations((ODataEntity) odataEntity, entity, reference); return entity; } @@ -274,7 +274,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder public ODataEntity getODataEntity(final ResWrap resource) { final ODataEntity entity = (ODataEntity) super.getODataEntity(resource); - entity.setReference(resource.getPayload().getId()); + entity.setId(resource.getPayload().getId()); odataAnnotations(resource.getPayload(), entity); return entity; diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java index dd49fecf7..092974158 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ServiceDocumentTest.java @@ -43,7 +43,7 @@ public class ServiceDocumentTest extends AbstractTest { final ODataServiceDocument serviceDocument = getClient().getReader().readServiceDocument( getClass().getResourceAsStream("serviceDocument." + getFileExtension(format)), format); assertNotNull(serviceDocument); - assertTrue(serviceDocument.getEntitySetTitles().contains("Persons")); + assertTrue(serviceDocument.getEntitySetNames().contains("Persons")); } @Test 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 e213a54a5..5338e50e4 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 @@ -74,7 +74,7 @@ public class EntitySetTest extends AbstractTest { assertNotNull(entitySet); for (ODataEntity entity : entitySet.getEntities()) { - assertNotNull(entity.getReference()); + assertNotNull(entity.getId()); } entitySet.setCount(entitySet.getEntities().size()); diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java index 5f916251b..0fc349531 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java @@ -266,7 +266,7 @@ public class EntityTest extends AbstractTest { getClient().getDeserializer().toEntity(input, format)); assertNotNull(entity); - assertNotNull(entity.getReference()); + assertNotNull(entity.getId()); final ODataEntity written = getClient().getBinder().getODataEntity( new ResWrap((URI) null, null, getClient().getBinder(). diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java index c03619cde..f515bdc8b 100644 --- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java +++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java @@ -52,7 +52,7 @@ public class ServiceDocumentTest extends AbstractTest { final ODataServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getPayload()); assertNotNull(serviceDocument); - assertTrue(serviceDocument.getEntitySetTitles().contains("Order Details")); + assertTrue(serviceDocument.getEntitySetNames().contains("Order Details")); assertEquals(URI.create("http://host/service/TopProducts"), serviceDocument.getFunctionImportURI("TopProducts")); assertEquals(URI.create("http://host/HR/"), diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl index 49900e79a..b13222b97 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl @@ -25,6 +25,7 @@ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" version="1.0"> + diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json index a51cd309f..f07594d3f 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json @@ -8,19 +8,16 @@ "url": "Orders" }, { - "name": "OrderItems", - "title": "Order Details", + "name": "Order Details", "url": "OrderItems" }, { "name": "TopProducts", - "title": "Best-Selling Products", "kind": "FunctionImport", "url": "TopProducts" }, { "name": "Contoso", - "title": "Contoso Ltd.", "kind": "Singleton", "url": "Contoso" }, diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.xml index faddf9c6d..4450ef9b5 100644 --- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.xml +++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.xml @@ -34,7 +34,7 @@ Order Details - Best-Selling Products + TopProducts Contoso Ltd. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java index ab590a16e..6a598842a 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entity.java @@ -57,14 +57,14 @@ public interface Entity extends Linked, Annotatable { * * @return entity ID. */ - String getId(); + URI getId(); /** * Sets entity ID. * * @param id entity ID. */ - void setId(String id); + void setId(URI id); /** * Gets entity self link. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EntitySet.java index a4ccf42ad..f6b191cb2 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/EntitySet.java @@ -49,7 +49,7 @@ public interface EntitySet extends Annotatable { * * @return ID. */ - String getId(); + URI getId(); /** * Gets entities. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java index 281bd18eb..cc32bcd72 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java @@ -38,11 +38,11 @@ public class ODataServiceDocument { } /** - * Gets entity set titles. + * Gets entity set names. * - * @return entity set titles. + * @return entity set names. */ - public Collection getEntitySetTitles() { + public Collection getEntitySetNames() { return entitySets.keySet(); } @@ -58,11 +58,11 @@ public class ODataServiceDocument { /** * Gets URI about the given entity set. * - * @param title title. + * @param name name. * @return URI. */ - public URI getEntitySetURI(final String title) { - return entitySets.get(title); + public URI getEntitySetURI(final String name) { + return entitySets.get(name); } public Map getFunctionImports() { @@ -70,11 +70,11 @@ public class ODataServiceDocument { } /** - * Gets function import titles. + * Gets function import names. * - * @return function import titles. + * @return function import names. */ - public Collection getFunctionImportTitles() { + public Collection getFunctionImportNames() { return functionImports.keySet(); } @@ -90,11 +90,11 @@ public class ODataServiceDocument { /** * Gets URI of the given function import. * - * @param title title. + * @param name name. * @return URI. */ - public URI getFunctionImportURI(final String title) { - return functionImports.get(title); + public URI getFunctionImportURI(final String name) { + return functionImports.get(name); } public Map getSingletons() { @@ -102,11 +102,11 @@ public class ODataServiceDocument { } /** - * Gets singleton titles. + * Gets singleton names. * - * @return singleton titles. + * @return singleton names. */ - public Collection getSingletonTitles() { + public Collection getSingletonNames() { return singletons.keySet(); } @@ -122,11 +122,11 @@ public class ODataServiceDocument { /** * Gets URI of the given singleton. * - * @param title title. + * @param name name. * @return URI. */ - public URI getSingletonURI(final String title) { - return singletons.get(title); + public URI getSingletonURI(final String name) { + return singletons.get(name); } public Map getRelatedServiceDocuments() { @@ -134,11 +134,11 @@ public class ODataServiceDocument { } /** - * Gets related service documents titles. + * Gets related service documents names. * - * @return related service documents titles. + * @return related service documents names. */ - public Collection getRelatedServiceDocumentsTitles() { + public Collection getRelatedServiceDocumentsNames() { return relatedServiceDocuments.keySet(); } @@ -154,10 +154,10 @@ public class ODataServiceDocument { /** * Gets URI of the given related service documents. * - * @param title title. + * @param name name. * @return URI. */ - public URI getRelatedServiceDocumentURI(final String title) { - return relatedServiceDocuments.get(title); + public URI getRelatedServiceDocumentURI(final String name) { + return relatedServiceDocuments.get(name); } } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java index 2c1111b63..c55de0acf 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.commons.api.domain.v4; +import java.net.URI; import java.util.List; import org.apache.olingo.commons.api.domain.CommonODataEntity; @@ -45,8 +46,8 @@ public interface ODataEntity extends CommonODataEntity, ODataAnnotatable { * * @return entity reference. */ - String getReference(); + URI getId(); - void setReference(String reference); + void setId(URI id); } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java index 73b294429..07bc96174 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java @@ -40,7 +40,7 @@ public interface ODataObjectFactory extends CommonODataObjectFactory { @Override ODataEntity newEntity(FullQualifiedName typeName, URI link); - Singleton newSingleton(FullQualifiedName typeName); + ODataSingleton newSingleton(FullQualifiedName typeName); @Override ODataLink newEntitySetNavigationLink(String name, URI link); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/Singleton.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataSingleton.java similarity index 94% rename from lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/Singleton.java rename to lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataSingleton.java index 989b534b9..709405c11 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/Singleton.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataSingleton.java @@ -18,5 +18,5 @@ */ package org.apache.olingo.commons.api.domain.v4; -public interface Singleton extends ODataEntity { +public interface ODataSingleton extends ODataEntity { } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java index 10508674c..b3eb7f93b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java @@ -18,27 +18,19 @@ */ package org.apache.olingo.commons.core.data; -import com.fasterxml.jackson.databind.util.ISO8601DateFormat; import java.net.URI; import java.text.ParseException; -import java.util.Date; abstract class AbstractODataObject extends AbstractAnnotatedObject { private static final long serialVersionUID = -4391162864875546927L; - private static final ISO8601DateFormat ISO_DATEFORMAT = new ISO8601DateFormat(); - private URI baseURI; - private String id; + private URI id; private String title; - private String summary; - - private Date updated; - public URI getBaseURI() { return baseURI; } @@ -47,11 +39,11 @@ abstract class AbstractODataObject extends AbstractAnnotatedObject { this.baseURI = baseURI == null ? null : URI.create(baseURI); } - public String getId() { + public URI getId() { return id; } - public void setId(final String id) { + public void setId(final URI id) { this.id = id; } @@ -59,23 +51,11 @@ abstract class AbstractODataObject extends AbstractAnnotatedObject { return title; } - public String getSummary() { - return summary; - } - - public Date getUpdated() { - return updated; - } - public void setCommonProperty(final String key, final String value) throws ParseException { if ("id".equals(key)) { - this.id = value; + this.id = URI.create(value); } else if ("title".equals(key)) { this.title = value; - } else if ("summary".equals(key)) { - this.summary = value; - } else if ("updated".equals(key)) { - this.updated = ISO_DATEFORMAT.parse(value); } } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java index 9e1b22d48..51a54654e 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java @@ -567,7 +567,7 @@ public class AtomDeserializer extends AbstractAtomDealer { final Attribute entityRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID); if (entityRefId != null) { - entity.setId(entityRefId.getValue()); + entity.setId(URI.create(entityRefId.getValue())); } return entity; diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java index cfa83fb8d..200a4bff2 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java @@ -205,13 +205,6 @@ public class AtomSerializer extends AbstractAtomDealer { writer.writeCharacters(object.getTitle()); writer.writeEndElement(); } - - if (StringUtils.isNotBlank(object.getSummary())) { - writer.writeStartElement(Constants.ATOM_ELEM_SUMMARY); - writer.writeAttribute(Constants.ATTR_TYPE, "text"); - writer.writeCharacters(object.getSummary()); - writer.writeEndElement(); - } } private void properties(final XMLStreamWriter writer, final List properties) throws XMLStreamException { @@ -261,9 +254,9 @@ public class AtomSerializer extends AbstractAtomDealer { Constants.ATOM_ATTR_ETAG, entity.getETag()); } - if (StringUtils.isNotBlank(entity.getId())) { + if (entity.getId() != null) { writer.writeStartElement(Constants.ATOM_ELEM_ID); - writer.writeCharacters(entity.getId()); + writer.writeCharacters(entity.getId().toASCIIString()); writer.writeEndElement(); } @@ -332,14 +325,14 @@ public class AtomSerializer extends AbstractAtomDealer { private void entityRef(final XMLStreamWriter writer, final Entity entity) throws XMLStreamException { writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF); writer.writeNamespace(StringUtils.EMPTY, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA)); - writer.writeAttribute(Constants.ATOM_ATTR_ID, entity.getId()); + writer.writeAttribute(Constants.ATOM_ATTR_ID, entity.getId().toASCIIString()); } private void entityRef(final XMLStreamWriter writer, final ResWrap container) throws XMLStreamException { writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF); writer.writeNamespace(StringUtils.EMPTY, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA)); addContextInfo(writer, container); - writer.writeAttribute(Constants.ATOM_ATTR_ID, container.getPayload().getId()); + writer.writeAttribute(Constants.ATOM_ATTR_ID, container.getPayload().getId().toASCIIString()); } private void entity(final Writer outWriter, final Entity entity) throws XMLStreamException { @@ -396,9 +389,9 @@ public class AtomSerializer extends AbstractAtomDealer { writer.writeEndElement(); } - if (StringUtils.isNotBlank(entitySet.getId())) { + if (entitySet.getId() != null) { writer.writeStartElement(Constants.ATOM_ELEM_ID); - writer.writeCharacters(entitySet.getId()); + writer.writeCharacters(entitySet.getId().toASCIIString()); writer.writeEndElement(); } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java index 46413757e..61667acd4 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntityDeserializer.java @@ -96,7 +96,7 @@ public class JSONEntityDeserializer extends AbstractJsonDeserializer } if (entity.getId() != null) { - jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entity.getId()); + jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entity.getId().toASCIIString()); } for (Annotation annotation : entity.getAnnotations()) { diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java index 206e385c6..40eb8e68b 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntitySetSerializer.java @@ -64,7 +64,7 @@ public class JSONEntitySetSerializer extends AbstractJsonSerializer properties = new ArrayList(); @@ -45,13 +46,13 @@ public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity, } @Override - public String getReference() { - return reference; + public URI getId() { + return id; } @Override - public void setReference(final String reference) { - this.reference = reference; + public void setId(final URI id) { + this.id = id; } @Override diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java index a89682ebd..50aa26a41 100644 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java @@ -33,7 +33,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataLink; import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue; import org.apache.olingo.commons.api.domain.v4.ODataProperty; import org.apache.olingo.commons.api.domain.v4.ODataValue; -import org.apache.olingo.commons.api.domain.v4.Singleton; +import org.apache.olingo.commons.api.domain.v4.ODataSingleton; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory; @@ -67,7 +67,7 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement } @Override - public Singleton newSingleton(final FullQualifiedName typeName) { + public ODataSingleton newSingleton(final FullQualifiedName typeName) { return new ODataEntityImpl(typeName); }