diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java index 0eab6998a..c1f9869a2 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java @@ -30,7 +30,7 @@ public class EntityCollectionSerializerOptions { private CountOption count; private ExpandOption expand; private SelectOption select; - private boolean onlyReferences; + private boolean writeOnlyReferences; private String id; /** Gets the {@link ContextURL}. */ @@ -54,8 +54,8 @@ public class EntityCollectionSerializerOptions { } /** only writes the references of the entities */ - public boolean onlyReferences() { - return onlyReferences; + public boolean getWriteOnlyReferences() { + return writeOnlyReferences; } /** Gets the id of the entity collection */ @@ -102,13 +102,13 @@ public class EntityCollectionSerializerOptions { } /** Sets to serialize only references */ - public Builder setWriteOnlyReferences(final boolean ref) { - options.onlyReferences = ref; + public Builder writeOnlyReferences(final boolean ref) { + options.writeOnlyReferences = ref; return this; } /** Sets id of the collection */ - public Builder setId(final String id) { + public Builder id(final String id) { options.id = id; return this; } diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java index db73c431c..b6dfa4811 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java @@ -27,7 +27,7 @@ public class EntitySerializerOptions { private ContextURL contextURL; private ExpandOption expand; private SelectOption select; - private boolean onlyReferences; + private boolean writeOnlyReferences; /** Gets the {@link ContextURL}. */ public ContextURL getContextURL() { @@ -45,8 +45,8 @@ public class EntitySerializerOptions { } /** only writes the references of the entities */ - public boolean onlyReferences() { - return onlyReferences; + public boolean getWriteOnlyReferences() { + return writeOnlyReferences; } private EntitySerializerOptions() {} @@ -84,8 +84,8 @@ public class EntitySerializerOptions { } /** Sets to serialize only references */ - public Builder setWriteOnlyReferences(final boolean ref) { - options.onlyReferences = ref; + public Builder writeOnlyReferences(final boolean ref) { + options.writeOnlyReferences = ref; return this; } diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java index 7f3f234b4..8195b85d6 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceRequest.java @@ -147,13 +147,13 @@ public abstract class ServiceRequest { return (T) EntitySerializerOptions.with() .contextURL(isODataMetadataNone(getResponseContentType()) ? null : contextUrl) .expand(uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption()) - .setWriteOnlyReferences(references).build(); + .writeOnlyReferences(references).build(); } else if (serilizerOptions.isAssignableFrom(EntityCollectionSerializerOptions.class)) { return (T) EntityCollectionSerializerOptions.with() .contextURL(isODataMetadataNone(getResponseContentType()) ? null : contextUrl) .count(uriInfo.getCountOption()).expand(uriInfo.getExpandOption()) - .select(uriInfo.getSelectOption()).setWriteOnlyReferences(references) - .setId(getODataRequest().getRawBaseUri()+getODataRequest().getRawODataPath()).build(); + .select(uriInfo.getSelectOption()).writeOnlyReferences(references) + .id(getODataRequest().getRawBaseUri() + getODataRequest().getRawODataPath()).build(); } else if (serilizerOptions.isAssignableFrom(ComplexSerializerOptions.class)) { return (T) ComplexSerializerOptions.with().contextURL(contextUrl) .expand(this.uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption()).build(); 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 f9c0c8f99..642a91e2f 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 @@ -157,7 +157,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { writeEntitySet(metadata, entityType, entitySet, null, null, false, json); } else { writeEntitySet(metadata, entityType, entitySet, - options.getExpand(), options.getSelect(), options.onlyReferences(), json); + options.getExpand(), options.getSelect(), options.getWriteOnlyReferences(), json); } writeNextLink(entitySet, json); @@ -186,7 +186,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { writeEntity(metadata, entityType, entity, contextURL, options == null ? null : options.getExpand(), options == null ? null : options.getSelect(), - options == null ? false : options.onlyReferences(), + options == null ? false : options.getWriteOnlyReferences(), json); json.close(); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java index 57cdc9519..4e1ba568d 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializer.java @@ -213,7 +213,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer { final EntityCollectionSerializerOptions options) throws SerializerException { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); - if (options != null && options.onlyReferences()) { + if (options != null && options.getWriteOnlyReferences()) { ReferenceCollectionSerializerOptions rso = ReferenceCollectionSerializerOptions.with() .contextURL(contextURL).build(); return entityReferenceCollection(entitySet, rso); @@ -282,7 +282,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer { final Entity entity, final EntitySerializerOptions options) throws SerializerException { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); - if (options != null && options.onlyReferences()) { + if (options != null && options.getWriteOnlyReferences()) { return entityReference(entity, ReferenceSerializerOptions.with().contextURL(contextURL).build()); } 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 efa8dda9f..59d9a2ac0 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 @@ -536,7 +536,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, false, expand, select)) .count(countOption) .expand(expand).select(select) - .setId(id) + .id(id) .build()); } diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java index 9ef08451e..1feb17e36 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerTest.java @@ -270,7 +270,7 @@ public class ODataXmlSerializerTest { EntityCollectionSerializerOptions.with() .contextURL(ContextURL.with().serviceRoot(new URI("http://host:port")) .entitySet(edmEntitySet).build()) - .setId("http://host/svc/ESCompAllPrim") + .id("http://host/svc/ESCompAllPrim") .count(countOption) .build()).getContent(); final String resultString = IOUtils.toString(result); @@ -635,7 +635,7 @@ public class ODataXmlSerializerTest { edmEntitySet.getEntityType(), entitySet, EntityCollectionSerializerOptions.with() .contextURL(ContextURL.with().entitySet(edmEntitySet).build()) - .setId("http://host/svc/ESMedia") + .id("http://host/svc/ESMedia") .build()).getContent(); final String resultString = IOUtils.toString(content); @@ -732,7 +732,7 @@ public class ODataXmlSerializerTest { EntityCollectionSerializerOptions.with() .contextURL(ContextURL.with().serviceRoot(URI.create("http://host/svc")) .entitySet(edmEntitySet).build()) - .setId("http://host/svc/ESAllNullable") + .id("http://host/svc/ESAllNullable") .build()).getContent(); final String resultString = IOUtils.toString(content); String expected = "\n" + @@ -928,7 +928,7 @@ public class ODataXmlSerializerTest { .contextURL(ContextURL.with().entitySet(edmEntitySet) .selectList(helper.buildContextURLSelectList(entityType, null, select)) .build()) - .setId("http://host/svc/ESCompComp") + .id("http://host/svc/ESCompComp") .select(select) .build()).getContent(); final String resultString = IOUtils.toString(result); @@ -1002,7 +1002,7 @@ public class ODataXmlSerializerTest { .contextURL(ContextURL.with().entitySet(edmEntitySet) .selectList(helper.buildContextURLSelectList(entityType, null, select)) .build()) - .setId("http://host/svc/ESCompComp") + .id("http://host/svc/ESCompComp") .select(select) .build()).getContent(); final String resultString = IOUtils.toString(inputStream); diff --git a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java index 77614e3be..6eb4e2102 100755 --- a/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java +++ b/samples/tutorials/p3_write/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java @@ -82,7 +82,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName(); EntityCollectionSerializerOptions opts = - EntityCollectionSerializerOptions.with().setId(id).contextURL(contextUrl).build(); + EntityCollectionSerializerOptions.with().id(id).contextURL(contextUrl).build(); SerializerResult serializedContent = serializer.entityCollection(serviceMetadata, edmEntityType, entitySet, opts); // Finally: configure the response object: set the body, headers and status code diff --git a/samples/tutorials/p7_queryoptions-o/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p7_queryoptions-o/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java index 48f4660d0..c9119acf5 100644 --- a/samples/tutorials/p7_queryoptions-o/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java +++ b/samples/tutorials/p7_queryoptions-o/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java @@ -136,7 +136,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName(); EntityCollectionSerializerOptions opts = - EntityCollectionSerializerOptions.with().setId(id).contextURL(contextUrl).build(); + EntityCollectionSerializerOptions.with().id(id).contextURL(contextUrl).build(); SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType, entityCollection, opts); InputStream serializedContent = serializerResult.getContent(); diff --git a/samples/tutorials/p8_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java b/samples/tutorials/p8_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java index 140d0e760..349cb8c37 100644 --- a/samples/tutorials/p8_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java +++ b/samples/tutorials/p8_queryoptions-f/src/main/java/myservice/mynamespace/service/DemoEntityCollectionProcessor.java @@ -124,7 +124,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName(); EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with() - .contextURL(contextUrl).setId(id).build(); + .contextURL(contextUrl).id(id).build(); SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType, entityCollection, opts);