[OLINGO-935] API for EDM-assisted serializer
Signed-off-by: Christian Amend <christian.amend@sap.com>
This commit is contained in:
parent
a757436015
commit
be1228c821
|
@ -34,6 +34,7 @@ import org.apache.olingo.server.api.deserializer.ODataDeserializer;
|
||||||
import org.apache.olingo.server.api.etag.ETagHelper;
|
import org.apache.olingo.server.api.etag.ETagHelper;
|
||||||
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
|
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
|
||||||
import org.apache.olingo.server.api.prefer.Preferences;
|
import org.apache.olingo.server.api.prefer.Preferences;
|
||||||
|
import org.apache.olingo.server.api.serializer.EdmAssistedSerializer;
|
||||||
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
|
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
|
||||||
import org.apache.olingo.server.api.serializer.ODataSerializer;
|
import org.apache.olingo.server.api.serializer.ODataSerializer;
|
||||||
import org.apache.olingo.server.api.serializer.SerializerException;
|
import org.apache.olingo.server.api.serializer.SerializerException;
|
||||||
|
@ -175,4 +176,12 @@ public abstract class OData {
|
||||||
* @return a debug-response helper
|
* @return a debug-response helper
|
||||||
*/
|
*/
|
||||||
public abstract DebugResponseHelper createDebugResponseHelper(String debugFormat);
|
public abstract DebugResponseHelper createDebugResponseHelper(String debugFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new serializer object capable of working without EDM information
|
||||||
|
* for rendering content in the specified format.
|
||||||
|
* @param contentType a content type supported by Olingo
|
||||||
|
*/
|
||||||
|
public abstract EdmAssistedSerializer createEdmAssistedSerializer(final ContentType contentType)
|
||||||
|
throws SerializerException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.olingo.server.api.serializer;
|
||||||
|
|
||||||
|
import org.apache.olingo.commons.api.data.AbstractEntityCollection;
|
||||||
|
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||||
|
import org.apache.olingo.server.api.ServiceMetadata;
|
||||||
|
|
||||||
|
/** EDM-assisted serializer */
|
||||||
|
public interface EdmAssistedSerializer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes entity-collection data into an InputStream.
|
||||||
|
* Information from the EDM is used in addition to information from the data and preferred,
|
||||||
|
* but the serializer works without any EDM information as well.
|
||||||
|
* Linked data is always written as expanded items (so closed reference loops have to be avoided).
|
||||||
|
* @param metadata metadata for the service
|
||||||
|
* @param referencedEntityType the {@link EdmEntityType} or <code>null</code> if not available
|
||||||
|
* @param entityCollection the data of the entity collection
|
||||||
|
* @param options options for the serializer
|
||||||
|
*/
|
||||||
|
SerializerResult entityCollection(ServiceMetadata metadata, EdmEntityType referencedEntityType,
|
||||||
|
AbstractEntityCollection entityCollection, EdmAssistedSerializerOptions options) throws SerializerException;
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.olingo.server.api.serializer;
|
||||||
|
|
||||||
|
import org.apache.olingo.commons.api.data.ContextURL;
|
||||||
|
|
||||||
|
/** Options for the EDM-assisted serializer. */
|
||||||
|
public class EdmAssistedSerializerOptions {
|
||||||
|
|
||||||
|
private ContextURL contextURL;
|
||||||
|
|
||||||
|
/** Gets the {@link ContextURL}. */
|
||||||
|
public ContextURL getContextURL() {
|
||||||
|
return contextURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes the options builder. */
|
||||||
|
public static Builder with() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Builder of serializer options. */
|
||||||
|
public static final class Builder {
|
||||||
|
|
||||||
|
private final EdmAssistedSerializerOptions options;
|
||||||
|
|
||||||
|
private Builder() {
|
||||||
|
options = new EdmAssistedSerializerOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the {@link ContextURL}. */
|
||||||
|
public Builder contextURL(final ContextURL contextURL) {
|
||||||
|
options.contextURL = contextURL;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Builds the OData serializer options. */
|
||||||
|
public EdmAssistedSerializerOptions build() {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ import org.apache.olingo.server.api.deserializer.ODataDeserializer;
|
||||||
import org.apache.olingo.server.api.etag.ETagHelper;
|
import org.apache.olingo.server.api.etag.ETagHelper;
|
||||||
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
|
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
|
||||||
import org.apache.olingo.server.api.prefer.Preferences;
|
import org.apache.olingo.server.api.prefer.Preferences;
|
||||||
|
import org.apache.olingo.server.api.serializer.EdmAssistedSerializer;
|
||||||
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
|
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
|
||||||
import org.apache.olingo.server.api.serializer.ODataSerializer;
|
import org.apache.olingo.server.api.serializer.ODataSerializer;
|
||||||
import org.apache.olingo.server.api.serializer.SerializerException;
|
import org.apache.olingo.server.api.serializer.SerializerException;
|
||||||
|
@ -50,6 +51,7 @@ import org.apache.olingo.server.core.deserializer.xml.ODataXmlDeserializer;
|
||||||
import org.apache.olingo.server.core.etag.ETagHelperImpl;
|
import org.apache.olingo.server.core.etag.ETagHelperImpl;
|
||||||
import org.apache.olingo.server.core.prefer.PreferencesImpl;
|
import org.apache.olingo.server.core.prefer.PreferencesImpl;
|
||||||
import org.apache.olingo.server.core.serializer.FixedFormatSerializerImpl;
|
import org.apache.olingo.server.core.serializer.FixedFormatSerializerImpl;
|
||||||
|
import org.apache.olingo.server.core.serializer.json.EdmAssistedJsonSerializer;
|
||||||
import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
|
import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
|
||||||
import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializer;
|
import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializer;
|
||||||
import org.apache.olingo.server.core.uri.UriHelperImpl;
|
import org.apache.olingo.server.core.uri.UriHelperImpl;
|
||||||
|
@ -86,6 +88,15 @@ public class ODataImpl extends OData {
|
||||||
return new FixedFormatSerializerImpl();
|
return new FixedFormatSerializerImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdmAssistedSerializer createEdmAssistedSerializer(final ContentType contentType) throws SerializerException {
|
||||||
|
if (contentType.isCompatible(ContentType.APPLICATION_JSON)) {
|
||||||
|
return new EdmAssistedJsonSerializer(contentType);
|
||||||
|
}
|
||||||
|
throw new SerializerException("Unsupported format: " + contentType.toContentTypeString(),
|
||||||
|
SerializerException.MessageKeys.UNSUPPORTED_FORMAT, contentType.toContentTypeString());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ODataHttpHandler createHandler(final ServiceMetadata serviceMetadata) {
|
public ODataHttpHandler createHandler(final ServiceMetadata serviceMetadata) {
|
||||||
return new ODataHttpHandlerImpl(this, serviceMetadata);
|
return new ODataHttpHandlerImpl(this, serviceMetadata);
|
||||||
|
@ -165,5 +176,4 @@ public class ODataImpl extends OData {
|
||||||
// TODO: Support more debug formats
|
// TODO: Support more debug formats
|
||||||
return new DebugResponseHelperImpl(debugFormat);
|
return new DebugResponseHelperImpl(debugFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@ import org.apache.olingo.commons.api.format.ContentType;
|
||||||
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
|
||||||
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
|
||||||
import org.apache.olingo.server.api.ServiceMetadata;
|
import org.apache.olingo.server.api.ServiceMetadata;
|
||||||
|
import org.apache.olingo.server.api.serializer.EdmAssistedSerializer;
|
||||||
|
import org.apache.olingo.server.api.serializer.EdmAssistedSerializerOptions;
|
||||||
import org.apache.olingo.server.api.serializer.SerializerException;
|
import org.apache.olingo.server.api.serializer.SerializerException;
|
||||||
import org.apache.olingo.server.api.serializer.SerializerException.MessageKeys;
|
import org.apache.olingo.server.api.serializer.SerializerException.MessageKeys;
|
||||||
import org.apache.olingo.server.api.serializer.SerializerResult;
|
import org.apache.olingo.server.api.serializer.SerializerResult;
|
||||||
|
@ -58,7 +60,7 @@ import org.apache.olingo.server.core.serializer.utils.ContextURLBuilder;
|
||||||
import com.fasterxml.jackson.core.JsonFactory;
|
import com.fasterxml.jackson.core.JsonFactory;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
|
||||||
public class EdmAssistedJsonSerializer {
|
public class EdmAssistedJsonSerializer implements EdmAssistedSerializer {
|
||||||
|
|
||||||
private static final String IO_EXCEPTION_TEXT = "An I/O exception occurred.";
|
private static final String IO_EXCEPTION_TEXT = "An I/O exception occurred.";
|
||||||
|
|
||||||
|
@ -70,14 +72,16 @@ public class EdmAssistedJsonSerializer {
|
||||||
this.isODataMetadataNone = ContentTypeHelper.isODataMetadataNone(contentType);
|
this.isODataMetadataNone = ContentTypeHelper.isODataMetadataNone(contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SerializerResult entityCollection(final ServiceMetadata metadata, final EdmEntityType entityType,
|
public SerializerResult entityCollection(final ServiceMetadata metadata, final EdmEntityType entityType,
|
||||||
final AbstractEntityCollection entityCollection, final ContextURL contextURL) throws SerializerException {
|
final AbstractEntityCollection entityCollection, final EdmAssistedSerializerOptions options)
|
||||||
return serialize(metadata, entityType, entityCollection, contextURL);
|
throws SerializerException {
|
||||||
|
return serialize(metadata, entityType, entityCollection, options == null ? null : options.getContextURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType, final Entity entity,
|
public SerializerResult entity(final ServiceMetadata metadata, final EdmEntityType entityType, final Entity entity,
|
||||||
final ContextURL contextURL) throws SerializerException {
|
final EdmAssistedSerializerOptions options) throws SerializerException {
|
||||||
return serialize(metadata, entityType, entity, contextURL);
|
return serialize(metadata, entityType, entity, options == null ? null : options.getContextURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SerializerResult serialize(final ServiceMetadata metadata, final EdmEntityType entityType,
|
protected SerializerResult serialize(final ServiceMetadata metadata, final EdmEntityType entityType,
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.olingo.server.core.serializer.json;
|
package org.apache.olingo.server.core.serializer.json;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -27,9 +28,9 @@ import java.util.TimeZone;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.olingo.commons.api.data.AbstractEntityCollection;
|
||||||
import org.apache.olingo.commons.api.data.ComplexValue;
|
import org.apache.olingo.commons.api.data.ComplexValue;
|
||||||
import org.apache.olingo.commons.api.data.ContextURL;
|
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.Entity;
|
||||||
import org.apache.olingo.commons.api.data.EntityCollection;
|
import org.apache.olingo.commons.api.data.EntityCollection;
|
||||||
import org.apache.olingo.commons.api.data.Link;
|
import org.apache.olingo.commons.api.data.Link;
|
||||||
|
@ -41,6 +42,8 @@ import org.apache.olingo.commons.api.edmx.EdmxReference;
|
||||||
import org.apache.olingo.commons.api.format.ContentType;
|
import org.apache.olingo.commons.api.format.ContentType;
|
||||||
import org.apache.olingo.server.api.OData;
|
import org.apache.olingo.server.api.OData;
|
||||||
import org.apache.olingo.server.api.ServiceMetadata;
|
import org.apache.olingo.server.api.ServiceMetadata;
|
||||||
|
import org.apache.olingo.server.api.serializer.EdmAssistedSerializer;
|
||||||
|
import org.apache.olingo.server.api.serializer.EdmAssistedSerializerOptions;
|
||||||
import org.apache.olingo.server.api.serializer.SerializerException;
|
import org.apache.olingo.server.api.serializer.SerializerException;
|
||||||
import org.apache.olingo.server.tecsvc.MetadataETagSupport;
|
import org.apache.olingo.server.tecsvc.MetadataETagSupport;
|
||||||
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
|
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
|
||||||
|
@ -52,46 +55,38 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
private static final ServiceMetadata metadata = oData.createServiceMetadata(
|
private static final ServiceMetadata metadata = oData.createServiceMetadata(
|
||||||
new EdmTechProvider(), Collections.<EdmxReference> emptyList(), null);
|
new EdmTechProvider(), Collections.<EdmxReference> emptyList(), null);
|
||||||
private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
|
private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
|
||||||
private final EdmAssistedJsonSerializer serializer = new EdmAssistedJsonSerializer(ContentType.JSON);
|
private final EdmAssistedSerializer serializer;
|
||||||
|
|
||||||
@Test
|
public EdmAssistedJsonSerializerTest() throws SerializerException {
|
||||||
public void entity() throws Exception {
|
serializer = oData.createEdmAssistedSerializer(ContentType.JSON);
|
||||||
Entity entity = new Entity();
|
|
||||||
entity.setId(null);
|
|
||||||
entity.addProperty(new Property(null, "Property1", ValueType.PRIMITIVE, 1.25F));
|
|
||||||
final String resultString = IOUtils.toString(
|
|
||||||
serializer.entity(metadata, null, entity,
|
|
||||||
ContextURL.with().entitySetOrSingletonOrType("EntitySet").selectList("Property1")
|
|
||||||
.suffix(Suffix.ENTITY)
|
|
||||||
.build())
|
|
||||||
.getContent());
|
|
||||||
final String expectedResult =
|
|
||||||
"{\"@odata.context\":\"$metadata#EntitySet(Property1)/$entity\","
|
|
||||||
+ "\"@odata.id\":null,"
|
|
||||||
+ "\"Property1@odata.type\":\"Single\",\"Property1\":1.25"
|
|
||||||
+ "}";
|
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void entityWithEdm() throws Exception {
|
public void entityCollectionSimple() throws Exception {
|
||||||
|
Entity entity = new Entity();
|
||||||
|
entity.setId(null);
|
||||||
|
entity.addProperty(new Property(null, "Property1", ValueType.PRIMITIVE, 1.25F));
|
||||||
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
|
entityCollection.getEntities().add(entity);
|
||||||
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#EntitySet(Property1)\","
|
||||||
|
+ "\"value\":[{\"@odata.id\":null,\"Property1@odata.type\":\"Single\",\"Property1\":1.25}]}",
|
||||||
|
serialize(serializer, metadata, null, entityCollection, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void entityCollectionWithEdm() throws Exception {
|
||||||
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
|
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
|
||||||
Entity entity = new Entity();
|
Entity entity = new Entity();
|
||||||
entity.setId(null);
|
entity.setId(null);
|
||||||
entity.addProperty(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, (short) 1))
|
entity.addProperty(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, (short) 1))
|
||||||
.addProperty(new Property(null, "PropertyString", ValueType.PRIMITIVE, "test"))
|
.addProperty(new Property(null, "PropertyString", ValueType.PRIMITIVE, "test"))
|
||||||
.addProperty(new Property(null, "AdditionalProperty", ValueType.PRIMITIVE, (byte) 42));
|
.addProperty(new Property(null, "AdditionalProperty", ValueType.PRIMITIVE, (byte) 42));
|
||||||
final String resultString = IOUtils.toString(
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
serializer.entity(metadata, entitySet.getEntityType(), entity,
|
entityCollection.getEntities().add(entity);
|
||||||
ContextURL.with().entitySet(entitySet).suffix(Suffix.ENTITY).build())
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#ESTwoPrim\",\"value\":[{\"@odata.id\":null,"
|
||||||
.getContent());
|
|
||||||
final String expectedResult =
|
|
||||||
"{\"@odata.context\":\"$metadata#ESTwoPrim/$entity\","
|
|
||||||
+ "\"@odata.id\":null,"
|
|
||||||
+ "\"PropertyInt16\":1,\"PropertyString\":\"test\","
|
+ "\"PropertyInt16\":1,\"PropertyString\":\"test\","
|
||||||
+ "\"AdditionalProperty@odata.type\":\"SByte\",\"AdditionalProperty\":42"
|
+ "\"AdditionalProperty@odata.type\":\"SByte\",\"AdditionalProperty\":42}]}",
|
||||||
+ "}";
|
serialize(serializer, metadata, entitySet, entityCollection, null));
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -111,13 +106,7 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
entityCollection.getEntities().add(entity);
|
entityCollection.getEntities().add(entity);
|
||||||
entityCollection.setCount(2);
|
entityCollection.setCount(2);
|
||||||
entityCollection.setNext(URI.create("nextLink"));
|
entityCollection.setNext(URI.create("nextLink"));
|
||||||
final String resultString = IOUtils.toString(
|
Assert.assertEquals(
|
||||||
serializer.entityCollection(metadata, null, entityCollection,
|
|
||||||
ContextURL.with().entitySetOrSingletonOrType("EntitySet")
|
|
||||||
.selectList("Property0,Property1,Property2,Property3,Property4")
|
|
||||||
.build())
|
|
||||||
.getContent());
|
|
||||||
final String expectedResult =
|
|
||||||
"{\"@odata.context\":\"$metadata#EntitySet(Property0,Property1,Property2,Property3,Property4)\","
|
"{\"@odata.context\":\"$metadata#EntitySet(Property0,Property1,Property2,Property3,Property4)\","
|
||||||
+ "\"@odata.count\":2,"
|
+ "\"@odata.count\":2,"
|
||||||
+ "\"value\":[{\"@odata.id\":null,"
|
+ "\"value\":[{\"@odata.id\":null,"
|
||||||
|
@ -125,11 +114,9 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
+ "\"Property1@odata.type\":\"Int32\",\"Property1\":1,"
|
+ "\"Property1@odata.type\":\"Int32\",\"Property1\":1,"
|
||||||
+ "\"Property2@odata.type\":\"Date\",\"Property2\":\"2000-02-29\","
|
+ "\"Property2@odata.type\":\"Date\",\"Property2\":\"2000-02-29\","
|
||||||
+ "\"Property3@odata.type\":\"DateTimeOffset\",\"Property3\":\"2000-02-29T00:00:00Z\","
|
+ "\"Property3@odata.type\":\"DateTimeOffset\",\"Property3\":\"2000-02-29T00:00:00Z\","
|
||||||
+ "\"Property4@odata.type\":\"#Collection(Boolean)\",\"Property4\":[true,false,null]"
|
+ "\"Property4@odata.type\":\"#Collection(Boolean)\",\"Property4\":[true,false,null]}],"
|
||||||
+ "}],"
|
+ "\"@odata.nextLink\":\"nextLink\"}",
|
||||||
+ "\"@odata.nextLink\":\"nextLink\""
|
serialize(serializer, metadata, null, entityCollection, null));
|
||||||
+ "}";
|
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -147,14 +134,10 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
+ "\"Property1@odata.type\":\"Int64\",\"Property1\":\"-9223372036854775808\","
|
+ "\"Property1@odata.type\":\"Int64\",\"Property1\":\"-9223372036854775808\","
|
||||||
+ "\"Property2@odata.type\":\"Decimal\",\"Property2\":\"922337203.6854775807\","
|
+ "\"Property2@odata.type\":\"Decimal\",\"Property2\":\"922337203.6854775807\","
|
||||||
+ "\"Property3@odata.type\":\"Byte\",\"Property3\":20}]}",
|
+ "\"Property3@odata.type\":\"Byte\",\"Property3\":20}]}",
|
||||||
IOUtils.toString(
|
serialize(
|
||||||
new EdmAssistedJsonSerializer(
|
oData.createEdmAssistedSerializer(
|
||||||
ContentType.create(ContentType.JSON, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true"))
|
ContentType.create(ContentType.JSON, ContentType.PARAMETER_IEEE754_COMPATIBLE, "true")),
|
||||||
.entityCollection(metadata, null, entityCollection,
|
metadata, null, entityCollection, null));
|
||||||
ContextURL.with().entitySetOrSingletonOrType("EntitySet")
|
|
||||||
.selectList("Property1,Property2,Property3")
|
|
||||||
.build())
|
|
||||||
.getContent()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -174,23 +157,17 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
entity.addProperty(new Property("Namespace.ComplexType", "Property2", ValueType.COMPLEX, complexValue));
|
entity.addProperty(new Property("Namespace.ComplexType", "Property2", ValueType.COMPLEX, complexValue));
|
||||||
EntityCollection entityCollection = new EntityCollection();
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
entityCollection.getEntities().add(entity);
|
entityCollection.getEntities().add(entity);
|
||||||
final String resultString = IOUtils.toString(
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#EntitySet(Property1,Property2)\","
|
||||||
serializer.entityCollection(metadata, null, entityCollection,
|
|
||||||
ContextURL.with().entitySetOrSingletonOrType("EntitySet").selectList("Property1,Property2").build())
|
|
||||||
.getContent());
|
|
||||||
final String expectedResult = "{\"@odata.context\":\"$metadata#EntitySet(Property1,Property2)\","
|
|
||||||
+ "\"value\":[{\"@odata.id\":null,"
|
+ "\"value\":[{\"@odata.id\":null,"
|
||||||
+ "\"Property1@odata.type\":\"Int64\",\"Property1\":1,"
|
+ "\"Property1@odata.type\":\"Int64\",\"Property1\":1,"
|
||||||
+ "\"Property2\":{"
|
+ "\"Property2\":{\"@odata.type\":\"#Namespace.ComplexType\","
|
||||||
+ "\"@odata.type\":\"#Namespace.ComplexType\","
|
|
||||||
+ "\"Inner1@odata.type\":\"Decimal\",\"Inner1\":0.00010,"
|
+ "\"Inner1@odata.type\":\"Decimal\",\"Inner1\":0.00010,"
|
||||||
+ "\"Inner2@odata.type\":\"TimeOfDay\",\"Inner2\":\"13:00:59.999\""
|
+ "\"Inner2@odata.type\":\"TimeOfDay\",\"Inner2\":\"13:00:59.999\"}}]}",
|
||||||
+ "}}]}";
|
serialize(serializer, metadata, null, entityCollection, null));
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void entityWithComplexCollection() throws Exception {
|
public void entityCollectionWithComplexCollection() throws Exception {
|
||||||
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
|
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
|
||||||
ComplexValue complexValue1 = new ComplexValue();
|
ComplexValue complexValue1 = new ComplexValue();
|
||||||
complexValue1.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 1));
|
complexValue1.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 1));
|
||||||
|
@ -201,35 +178,30 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
ComplexValue complexValue3 = new ComplexValue();
|
ComplexValue complexValue3 = new ComplexValue();
|
||||||
complexValue3.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 3));
|
complexValue3.getValue().add(new Property(null, "PropertyInt16", ValueType.PRIMITIVE, 3));
|
||||||
complexValue3.getValue().add(new Property(null, "PropertyString", ValueType.PRIMITIVE, "three"));
|
complexValue3.getValue().add(new Property(null, "PropertyString", ValueType.PRIMITIVE, "three"));
|
||||||
final Entity entity = new Entity()
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
|
entityCollection.getEntities().add(new Entity()
|
||||||
.addProperty(new Property(null, "CollPropertyComp", ValueType.COLLECTION_COMPLEX,
|
.addProperty(new Property(null, "CollPropertyComp", ValueType.COLLECTION_COMPLEX,
|
||||||
Arrays.asList(complexValue1, complexValue2, complexValue3)));
|
Arrays.asList(complexValue1, complexValue2, complexValue3))));
|
||||||
final String resultString = IOUtils.toString(
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#ESMixPrimCollComp(CollPropertyComp)\","
|
||||||
serializer.entity(metadata, entitySet.getEntityType(), entity,
|
+ "\"value\":[{\"@odata.id\":null,"
|
||||||
ContextURL.with().entitySet(entitySet).selectList("CollPropertyComp").build())
|
|
||||||
.getContent());
|
|
||||||
final String expectedResult = "{\"@odata.context\":\"$metadata#ESMixPrimCollComp(CollPropertyComp)\","
|
|
||||||
+ "\"@odata.id\":null,"
|
|
||||||
+ "\"CollPropertyComp\":["
|
+ "\"CollPropertyComp\":["
|
||||||
+ "{\"PropertyInt16\":1,\"PropertyString\":\"one\"},"
|
+ "{\"PropertyInt16\":1,\"PropertyString\":\"one\"},"
|
||||||
+ "{\"PropertyInt16\":2,\"PropertyString\":\"two\"},"
|
+ "{\"PropertyInt16\":2,\"PropertyString\":\"two\"},"
|
||||||
+ "{\"PropertyInt16\":3,\"PropertyString\":\"three\"}]}";
|
+ "{\"PropertyInt16\":3,\"PropertyString\":\"three\"}]}]}",
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
serialize(serializer, metadata, entitySet, entityCollection, "CollPropertyComp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void entityWithEmptyCollection() throws Exception {
|
public void entityCollectionWithEmptyCollection() throws Exception {
|
||||||
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
|
final EdmEntitySet entitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
|
||||||
final Entity entity = new Entity()
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
|
entityCollection.getEntities().add(new Entity()
|
||||||
.addProperty(new Property(null, "CollPropertyString", ValueType.COLLECTION_PRIMITIVE,
|
.addProperty(new Property(null, "CollPropertyString", ValueType.COLLECTION_PRIMITIVE,
|
||||||
Collections.emptyList()));
|
Collections.emptyList())));
|
||||||
Assert.assertEquals(
|
Assert.assertEquals(
|
||||||
"{\"@odata.context\":\"$metadata#ESMixPrimCollComp(CollPropertyString)\","
|
"{\"@odata.context\":\"$metadata#ESMixPrimCollComp(CollPropertyString)\","
|
||||||
+ "\"@odata.id\":null,\"CollPropertyString\":[]}",
|
+ "\"value\":[{\"@odata.id\":null,\"CollPropertyString\":[]}]}",
|
||||||
IOUtils.toString(
|
serialize(serializer, metadata, entitySet, entityCollection, "CollPropertyString"));
|
||||||
serializer.entity(metadata, entitySet.getEntityType(), entity,
|
|
||||||
ContextURL.with().entitySet(entitySet).selectList("CollPropertyString").build())
|
|
||||||
.getContent()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -248,20 +220,13 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
entity.getNavigationLinks().add(link);
|
entity.getNavigationLinks().add(link);
|
||||||
EntityCollection entityCollection = new EntityCollection();
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
entityCollection.getEntities().add(entity);
|
entityCollection.getEntities().add(entity);
|
||||||
final String resultString = IOUtils.toString(
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#EntitySet(Property1,NavigationProperty(Related1))\","
|
||||||
serializer.entityCollection(metadata, null, entityCollection,
|
|
||||||
ContextURL.with().entitySetOrSingletonOrType("EntitySet")
|
|
||||||
.selectList("Property1,NavigationProperty(Related1)").build())
|
|
||||||
.getContent());
|
|
||||||
final String expectedResult =
|
|
||||||
"{\"@odata.context\":\"$metadata#EntitySet(Property1,NavigationProperty(Related1))\","
|
|
||||||
+ "\"value\":[{\"@odata.id\":null,"
|
+ "\"value\":[{\"@odata.id\":null,"
|
||||||
+ "\"Property1@odata.type\":\"Int16\",\"Property1\":1,"
|
+ "\"Property1@odata.type\":\"Int16\",\"Property1\":1,"
|
||||||
+ "\"NavigationProperty\":["
|
+ "\"NavigationProperty\":["
|
||||||
+ "{\"@odata.id\":null,\"Related1@odata.type\":\"Double\",\"Related1\":1.5},"
|
+ "{\"@odata.id\":null,\"Related1@odata.type\":\"Double\",\"Related1\":1.5},"
|
||||||
+ "{\"@odata.id\":null,\"Related1@odata.type\":\"Double\",\"Related1\":2.75}"
|
+ "{\"@odata.id\":null,\"Related1@odata.type\":\"Double\",\"Related1\":2.75}]}]}",
|
||||||
+ "]}]}";
|
serialize(serializer, metadata, null, entityCollection, "Property1,NavigationProperty(Related1)"));
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -277,17 +242,12 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
link.setTitle("NavPropertyETAllPrimOne");
|
link.setTitle("NavPropertyETAllPrimOne");
|
||||||
link.setInlineEntity(target);
|
link.setInlineEntity(target);
|
||||||
entity.getNavigationLinks().add(link);
|
entity.getNavigationLinks().add(link);
|
||||||
final String resultString = IOUtils.toString(
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
serializer.entity(metadata, entitySet.getEntityType(), entity,
|
entityCollection.getEntities().add(entity);
|
||||||
ContextURL.with().entitySet(entitySet).suffix(Suffix.ENTITY).build())
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#ESTwoPrim\",\"value\":[{\"@odata.id\":null,"
|
||||||
.getContent());
|
|
||||||
final String expectedResult =
|
|
||||||
"{\"@odata.context\":\"$metadata#ESTwoPrim/$entity\","
|
|
||||||
+ "\"@odata.id\":null,"
|
|
||||||
+ "\"PropertyInt16\":42,\"PropertyString\":\"test\","
|
+ "\"PropertyInt16\":42,\"PropertyString\":\"test\","
|
||||||
+ "\"NavPropertyETAllPrimOne\":{\"@odata.id\":null,\"PropertyInt16\":2,\"PropertyByte\":3}"
|
+ "\"NavPropertyETAllPrimOne\":{\"@odata.id\":null,\"PropertyInt16\":2,\"PropertyByte\":3}}]}",
|
||||||
+ "}";
|
serialize(serializer, metadata, entitySet, entityCollection, null));
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -304,64 +264,70 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
entity.setMediaContentSource(URI.create("media"));
|
entity.setMediaContentSource(URI.create("media"));
|
||||||
entity.addProperty(new Property(null, "Property1", ValueType.PRIMITIVE,
|
entity.addProperty(new Property(null, "Property1", ValueType.PRIMITIVE,
|
||||||
UUID.fromString("12345678-ABCD-1234-CDEF-123456789012")));
|
UUID.fromString("12345678-ABCD-1234-CDEF-123456789012")));
|
||||||
final ContextURL contextURL = ContextURL.with().entitySetOrSingletonOrType("EntitySet").selectList("Property1")
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
.suffix(Suffix.ENTITY).build();
|
entityCollection.getEntities().add(entity);
|
||||||
final String resultString = IOUtils.toString(serializer.entity(metadata, null, entity, contextURL).getContent());
|
Assert.assertEquals("{\"@odata.context\":\"$metadata#EntitySet(Property1)\","
|
||||||
final String expectedResult =
|
+ "\"@odata.metadataEtag\":\"W/\\\"42\\\"\",\"value\":[{"
|
||||||
"{\"@odata.context\":\"$metadata#EntitySet(Property1)/$entity\","
|
|
||||||
+ "\"@odata.metadataEtag\":\"W/\\\"42\\\"\","
|
|
||||||
+ "\"@odata.etag\":\"W/\\\"1000\\\"\","
|
+ "\"@odata.etag\":\"W/\\\"1000\\\"\","
|
||||||
+ "\"@odata.type\":\"#Namespace.EntityType\","
|
+ "\"@odata.type\":\"#Namespace.EntityType\","
|
||||||
+ "\"@odata.id\":\"ID\","
|
+ "\"@odata.id\":\"ID\","
|
||||||
+ "\"Property1@odata.type\":\"Guid\",\"Property1\":\"12345678-abcd-1234-cdef-123456789012\","
|
+ "\"Property1@odata.type\":\"Guid\",\"Property1\":\"12345678-abcd-1234-cdef-123456789012\","
|
||||||
+ "\"@odata.editLink\":\"editLink\","
|
+ "\"@odata.editLink\":\"editLink\","
|
||||||
+ "\"@odata.mediaReadLink\":\"editLink/$value\""
|
+ "\"@odata.mediaReadLink\":\"editLink/$value\"}]}",
|
||||||
+ "}";
|
serialize(serializer, metadata, null, entityCollection, null));
|
||||||
Assert.assertEquals(expectedResult, resultString);
|
|
||||||
|
|
||||||
Assert.assertEquals("{\"Property1\":\"12345678-abcd-1234-cdef-123456789012\"}",
|
Assert.assertEquals("{\"value\":[{\"Property1\":\"12345678-abcd-1234-cdef-123456789012\"}]}",
|
||||||
IOUtils.toString(new EdmAssistedJsonSerializer(ContentType.JSON_NO_METADATA)
|
serialize(oData.createEdmAssistedSerializer(ContentType.JSON_NO_METADATA), metadata,
|
||||||
.entity(metadata, null, entity, contextURL).getContent()));
|
null, entityCollection, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SerializerException.class)
|
@Test(expected = SerializerException.class)
|
||||||
public void enumType() throws Exception {
|
public void enumType() throws Exception {
|
||||||
serializer.entity(metadata, null,
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
new Entity().addProperty(new Property(null, "Property1", ValueType.ENUM, 42)), null);
|
entityCollection.getEntities().add(
|
||||||
|
new Entity().addProperty(new Property(null, "Property1", ValueType.ENUM, 42)));
|
||||||
|
serializer.entityCollection(metadata, null, entityCollection, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SerializerException.class)
|
@Test(expected = SerializerException.class)
|
||||||
public void collectionEnumType() throws Exception {
|
public void collectionEnumType() throws Exception {
|
||||||
serializer.entity(metadata, null,
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
new Entity().addProperty(new Property(null, "Property1", ValueType.COLLECTION_ENUM, Arrays.asList(42))),
|
entityCollection.getEntities().add(
|
||||||
null);
|
new Entity().addProperty(new Property(null, "Property1", ValueType.COLLECTION_ENUM, Arrays.asList(42))));
|
||||||
|
serializer.entityCollection(metadata, null, entityCollection, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SerializerException.class)
|
@Test(expected = SerializerException.class)
|
||||||
public void geoType() throws Exception {
|
public void geoType() throws Exception {
|
||||||
serializer.entity(metadata, null,
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
new Entity().addProperty(new Property(null, "Property1", ValueType.GEOSPATIAL, 1)), null);
|
entityCollection.getEntities().add(
|
||||||
|
new Entity().addProperty(new Property(null, "Property1", ValueType.GEOSPATIAL, 1)));
|
||||||
|
serializer.entityCollection(metadata, null, entityCollection, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SerializerException.class)
|
@Test(expected = SerializerException.class)
|
||||||
public void unsupportedType() throws Exception {
|
public void unsupportedType() throws Exception {
|
||||||
serializer.entity(metadata, null,
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
new Entity().addProperty(new Property(null, "Property1", ValueType.PRIMITIVE, TimeZone.getDefault())),
|
entityCollection.getEntities().add(
|
||||||
null);
|
new Entity().addProperty(new Property(null, "Property1", ValueType.PRIMITIVE, TimeZone.getDefault())));
|
||||||
|
serializer.entityCollection(metadata, null, entityCollection, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SerializerException.class)
|
@Test(expected = SerializerException.class)
|
||||||
public void wrongValueForType() throws Exception {
|
public void wrongValueForType() throws Exception {
|
||||||
serializer.entity(metadata, null,
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
new Entity().addProperty(new Property("Edm.SByte", "Property1", ValueType.PRIMITIVE, "-1")),
|
entityCollection.getEntities().add(
|
||||||
null);
|
new Entity().addProperty(new Property("Edm.SByte", "Property1", ValueType.PRIMITIVE, "-1")));
|
||||||
|
serializer.entityCollection(metadata, null, entityCollection, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SerializerException.class)
|
@Test(expected = SerializerException.class)
|
||||||
public void wrongValueForPropertyFacet() throws Exception {
|
public void wrongValueForPropertyFacet() throws Exception {
|
||||||
serializer.entity(metadata, entityContainer.getEntitySet("ESAllPrim").getEntityType(),
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
|
entityCollection.getEntities().add(
|
||||||
new Entity().addProperty(
|
new Entity().addProperty(
|
||||||
new Property(null, "PropertyDecimal", ValueType.PRIMITIVE, BigDecimal.ONE.scaleByPowerOfTen(-11))),
|
new Property(null, "PropertyDecimal", ValueType.PRIMITIVE, BigDecimal.ONE.scaleByPowerOfTen(-11))));
|
||||||
|
serializer.entityCollection(metadata, entityContainer.getEntitySet("ESAllPrim").getEntityType(), entityCollection,
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,10 +339,38 @@ public class EdmAssistedJsonSerializerTest {
|
||||||
ComplexValue complexValue = new ComplexValue();
|
ComplexValue complexValue = new ComplexValue();
|
||||||
complexValue.getValue().add(new Property(null, "PropertyComp", ValueType.COMPLEX,
|
complexValue.getValue().add(new Property(null, "PropertyComp", ValueType.COMPLEX,
|
||||||
innerComplexValue));
|
innerComplexValue));
|
||||||
serializer.entity(metadata, entityContainer.getEntitySet("ESKeyNav").getEntityType(),
|
EntityCollection entityCollection = new EntityCollection();
|
||||||
|
entityCollection.getEntities().add(
|
||||||
new Entity().addProperty(
|
new Entity().addProperty(
|
||||||
new Property(null, "CollPropertyComp", ValueType.COLLECTION_COMPLEX,
|
new Property(null, "CollPropertyComp", ValueType.COLLECTION_COMPLEX,
|
||||||
Collections.singletonList(complexValue))),
|
Collections.singletonList(complexValue))));
|
||||||
|
serializer.entityCollection(metadata, entityContainer.getEntitySet("ESKeyNav").getEntityType(), entityCollection,
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String serialize(final EdmAssistedSerializer serializer, final ServiceMetadata metadata,
|
||||||
|
final EdmEntitySet edmEntitySet, final AbstractEntityCollection entityCollection, final String selectList)
|
||||||
|
throws SerializerException, IOException {
|
||||||
|
ContextURL.Builder contextURLBuilder = ContextURL.with();
|
||||||
|
contextURLBuilder = edmEntitySet == null ?
|
||||||
|
contextURLBuilder.entitySetOrSingletonOrType("EntitySet") :
|
||||||
|
contextURLBuilder.entitySet(edmEntitySet);
|
||||||
|
if (selectList == null) {
|
||||||
|
if (edmEntitySet == null) {
|
||||||
|
StringBuilder names = new StringBuilder();
|
||||||
|
for (final Property property : entityCollection.iterator().next().getProperties()) {
|
||||||
|
names.append(names.length() > 0 ? ',' : "").append(property.getName());
|
||||||
|
}
|
||||||
|
contextURLBuilder = contextURLBuilder.selectList(names.toString());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contextURLBuilder = contextURLBuilder.selectList(selectList);
|
||||||
|
}
|
||||||
|
return IOUtils.toString(
|
||||||
|
serializer.entityCollection(metadata,
|
||||||
|
edmEntitySet == null ? null : edmEntitySet.getEntityType(),
|
||||||
|
entityCollection,
|
||||||
|
EdmAssistedSerializerOptions.with().contextURL(contextURLBuilder.build()).build())
|
||||||
|
.getContent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue