http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java ---------------------------------------------------------------------- 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 9cce970..dabfea3 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 @@ -174,6 +174,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { final EntityCollectionSerializerOptions options) throws SerializerException { OutputStream outputStream = null; SerializerException cachedException = null; + boolean pagination = false; try { CircleStreamBuffer buffer = new CircleStreamBuffer(); outputStream = buffer.getOutputStream(); @@ -197,7 +198,8 @@ public class ODataJsonSerializer extends AbstractODataSerializer { writeEntitySet(metadata, entityType, entitySet, options.getExpand(), null, options.getSelect(), options.getWriteOnlyReferences(), null, name, json); } - writeNextLink(entitySet, json); + writeNextLink(entitySet, json, pagination); + writeDeltaLink(entitySet, json, pagination); json.close(); outputStream.close(); @@ -224,6 +226,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { throws SerializerException { SerializerException cachedException; + boolean pagination = false; try { JsonGenerator json = new JsonFactory().createGenerator(outputStream); json.writeStartObject(); @@ -245,7 +248,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { options.getExpand(), null, options.getSelect(), options.getWriteOnlyReferences(), null, name, json); } // next link support for streaming results - writeNextLink(entitySet, json); + writeNextLink(entitySet, json, pagination); json.close(); } catch (final IOException e) { @@ -1165,6 +1168,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { throws SerializerException { OutputStream outputStream = null; SerializerException cachedException = null; + boolean pagination = false ; try { final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL()); @@ -1187,7 +1191,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } json.writeEndArray(); - writeNextLink(entityCollection, json); + writeNextLink(entityCollection, json, pagination); json.writeEndObject(); @@ -1231,9 +1235,20 @@ public class ODataJsonSerializer extends AbstractODataSerializer { } } - void writeNextLink(final AbstractEntityCollection entitySet, final JsonGenerator json) throws IOException { + void writeNextLink(final AbstractEntityCollection entitySet, final JsonGenerator json, boolean pagination) + throws IOException { if (entitySet.getNext() != null) { + pagination = true; json.writeStringField(Constants.JSON_NEXT_LINK, entitySet.getNext().toASCIIString()); + }else{ + pagination = false; } } + + void writeDeltaLink(final AbstractEntityCollection entitySet, final JsonGenerator json, boolean pagination) + throws IOException { + if (entitySet.getDeltaLink() != null && !pagination) { + json.writeStringField(Constants.JSON_DELTA_LINK, entitySet.getDeltaLink().toASCIIString()); + } + } }
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java index e034e8b..aa1dfb5 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java @@ -40,6 +40,7 @@ import org.apache.olingo.server.api.uri.UriResource; import org.apache.olingo.server.api.uri.queryoption.AliasQueryOption; import org.apache.olingo.server.api.uri.queryoption.ApplyOption; import org.apache.olingo.server.api.uri.queryoption.CountOption; +import org.apache.olingo.server.api.uri.queryoption.DeltaTokenOption; import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption; import org.apache.olingo.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.server.api.uri.queryoption.FilterOption; @@ -189,6 +190,7 @@ public class UriInfoImpl implements UriInfo { case SELECT: case SKIP: case SKIPTOKEN: + case DELTATOKEN: case TOP: case LEVELS: case APPLY: @@ -310,4 +312,9 @@ public class UriInfoImpl implements UriInfo { public String getFragment() { return fragment; } + + @Override + public DeltaTokenOption getDeltaTokenOption() { + return (DeltaTokenOption) systemQueryOptions.get(SystemQueryOptionKind.DELTATOKEN); + } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java index 087aec1..4e09dd1 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java @@ -58,6 +58,7 @@ import org.apache.olingo.server.core.uri.parser.search.SearchParser; import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ApplyOptionImpl; import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl; +import org.apache.olingo.server.core.uri.queryoption.DeltaTokenOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl; import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl; import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl; @@ -332,6 +333,14 @@ public class Parser { } systemOption = new SkipTokenOptionImpl().setValue(optionValue); break; + case DELTATOKEN: + if (optionValue.isEmpty()) { + throw new UriParserSyntaxException("Illegal value of $deltatoken option!", + UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION, + optionName, optionValue); + } + systemOption = new DeltaTokenOptionImpl().setValue(optionValue); + break; case TOP: systemOption = new TopOptionImpl() .setValue(ParserHelper.parseNonNegativeInteger(optionName, optionValue, true)); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/DeltaTokenOptionImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/DeltaTokenOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/DeltaTokenOptionImpl.java new file mode 100644 index 0000000..679dedc --- /dev/null +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/DeltaTokenOptionImpl.java @@ -0,0 +1,39 @@ +/* + * 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.core.uri.queryoption; + +import org.apache.olingo.server.api.uri.queryoption.DeltaTokenOption; +import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; + +public class DeltaTokenOptionImpl extends SystemQueryOptionImpl implements DeltaTokenOption { + + public DeltaTokenOptionImpl() { + setKind(SystemQueryOptionKind.DELTATOKEN); + } + + @Override + public String getValue() { + return getText(); + } + + public DeltaTokenOptionImpl setValue(final String deltaTokenValue) { + setText(deltaTokenValue); + return this; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java index d523226..f94425f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java @@ -45,27 +45,27 @@ public class UriValidator { //CHECKSTYLE:OFF (Maven checkstyle) private static final boolean[][] decisionMatrix = { - /* 0-FILTER 1-FORMAT 2-EXPAND 3-ID 4-COUNT 5-ORDERBY 6-SEARCH 7-SELECT 8-SKIP 9-SKIPTOKEN 10-TOP 11-APPLY */ - /* all 0 */ { true , true , true , false, true , true , true , true , true , true , true , true }, - /* batch 1 */ { false, false, false, false, false, false, false, false, false, false, false, false }, - /* crossjoin 2 */ { true , true , true , false, true , true , true , true , true , true , true , true }, - /* entityId 3 */ { false, true , true , true , false, false, false, true , false, false, false, false }, - /* metadata 4 */ { false, true , false, false, false, false, false, false, false, false, false, false }, - /* service 5 */ { false, true , false, false, false, false, false, false, false, false, false, false }, - /* entitySet 6 */ { true , true , true , false, true , true , true , true , true , true , true , true }, - /* entitySetCount 7 */ { true , false, false, false, false, false, true , false, false, false, false, true }, - /* entity 8 */ { false, true , true , false, false, false, false, true , false, false, false, false }, - /* mediaStream 9 */ { false, false, false, false, false, false, false, false, false, false, false, false }, - /* references 10 */ { true , true , false, false, true , true , true , false, true , true , true , false }, - /* reference 11 */ { false, true , false, false, false, false, false, false, false, false, false, false }, - /* propertyComplex 12 */ { false, true , true , false, false, false, false, true , false, false, false, false }, - /* propertyComplexCollection 13 */ { true , true , true , false, true , true , false, true , true , true , true , true }, - /* propertyComplexCollectionCount 14 */ { true , false, false, false, false, false, false, false, false, false, false, true }, - /* propertyPrimitive 15 */ { false, true , false, false, false, false, false, false, false, false, false, false }, - /* propertyPrimitiveCollection 16 */ { true , true , false, false, true , true , false, false, true , true , true , false }, - /* propertyPrimitiveCollectionCount 17 */ { true , false, false, false, false, false, false, false, false, false, false, false }, - /* propertyPrimitiveValue 18 */ { false, true , false, false, false, false, false, false, false, false, false, false }, - /* none 19 */ { false, true , false, false, false, false, false, false, false, false, false, false } + /* 0-FILTER 1-FORMAT 2-EXPAND 3-ID 4-COUNT 5-ORDERBY 6-SEARCH 7-SELECT 8-SKIP 9-SKIPTOKEN 10-TOP 11-APPLY 12-DELTATOKEN */ + /* all 0 */ { true , true , true , false, true , true , true , true , true , true , true , true, true }, + /* batch 1 */ { false, false, false, false, false, false, false, false, false, false, false, false, false }, + /* crossjoin 2 */ { true , true , true , false, true , true , true , true , true , true , true , true, true }, + /* entityId 3 */ { false, true , true , true , false, false, false, true , false, false, false, false, false }, + /* metadata 4 */ { false, true , false, false, false, false, false, false, false, false, false, false, false }, + /* service 5 */ { false, true , false, false, false, false, false, false, false, false, false, false, false }, + /* entitySet 6 */ { true , true , true , false, true , true , true , true , true , true , true , true, true }, + /* entitySetCount 7 */ { true , false, false, false, false, false, true , false, false, false, false, true, true }, + /* entity 8 */ { false, true , true , false, false, false, false, true , false, false, false, false, false }, + /* mediaStream 9 */ { false, false, false, false, false, false, false, false, false, false, false, false, false }, + /* references 10 */ { true , true , false, false, true , true , true , false, true , true , true , false, true }, + /* reference 11 */ { false, true , false, false, false, false, false, false, false, false, false, false, false }, + /* propertyComplex 12 */ { false, true , true , false, false, false, false, true , false, false, false, false, false }, + /* propertyComplexCollection 13 */ { true , true , true , false, true , true , false, true , true , true , true , true , true }, + /* propertyComplexCollectionCount 14 */ { true , false, false, false, false, false, false, false, false, false, false, true , false }, + /* propertyPrimitive 15 */ { false, true , false, false, false, false, false, false, false, false, false, false, false }, + /* propertyPrimitiveCollection 16 */ { true , true , false, false, true , true , false, false, true , true , true , false, true }, + /* propertyPrimitiveCollectionCount 17 */ { true , false, false, false, false, false, false, false, false, false, false, false, false }, + /* propertyPrimitiveValue 18 */ { false, true , false, false, false, false, false, false, false, false, false, false, false }, + /* none 19 */ { false, true , false, false, false, false, false, false, false, false, false, false, false } }; //CHECKSTYLE:ON //@formatter:on @@ -119,6 +119,7 @@ public class UriValidator { temp.put(SystemQueryOptionKind.SKIPTOKEN, 9); temp.put(SystemQueryOptionKind.TOP, 10); temp.put(SystemQueryOptionKind.APPLY, 11); + temp.put(SystemQueryOptionKind.DELTATOKEN, 12); OPTION_INDEX = Collections.unmodifiableMap(temp); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties index 3b261ac..085afec 100644 --- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties +++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties @@ -111,6 +111,7 @@ SerializerException.IO_EXCEPTION=An I/O exception occurred. SerializerException.NULL_INPUT=The input 'null' is not allowed here. SerializerException.NO_CONTEXT_URL=No context URL has been provided. SerializerException.UNSUPPORTED_PROPERTY_TYPE=The type of the property '%1$s' is not yet supported. +SerializerException.MISSING_DELTA_PROPERTY=The delta property '%1$s' is missing. SerializerException.INCONSISTENT_PROPERTY_TYPE=An inconsistency has been detected in the type definition of property '%1$s'. SerializerException.MISSING_PROPERTY=The non-nullable property '%1$s' is missing. SerializerException.MISSING_ID=The entity id value is missing. http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java index ac35292..6bb4a00 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java @@ -36,6 +36,7 @@ import org.apache.olingo.server.core.uri.queryoption.AliasQueryOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ApplyOptionImpl; import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl; import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl; +import org.apache.olingo.server.core.uri.queryoption.DeltaTokenOptionImpl; import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl; import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl; import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl; @@ -121,7 +122,8 @@ public class UriInfoImplTest { final QueryOption skipToken = new SkipTokenOptionImpl().setName(""); final QueryOption top = new TopOptionImpl().setName(""); final QueryOption levels = new LevelsOptionImpl().setName(""); - + final QueryOption deltaToken = new DeltaTokenOptionImpl().setName(""); + final QueryOption customOption0 = new CustomQueryOptionImpl().setName("0").setText("A"); final QueryOption customOption1 = new CustomQueryOptionImpl().setName("1").setText("B"); @@ -146,9 +148,10 @@ public class UriInfoImplTest { .setQueryOption(customOption1) .setQueryOption(levels) .setQueryOption(initialQueryOption) - .setQueryOption(alias); + .setQueryOption(alias) + .setQueryOption(deltaToken); - assertEquals(13, uriInfo.getSystemQueryOptions().size()); + assertEquals(14, uriInfo.getSystemQueryOptions().size()); assertEquals(apply, uriInfo.getApplyOption()); assertEquals(expand, uriInfo.getExpandOption()); assertEquals(filter, uriInfo.getFilterOption()); @@ -161,6 +164,7 @@ public class UriInfoImplTest { assertEquals(skip, uriInfo.getSkipOption()); assertEquals(skipToken, uriInfo.getSkipTokenOption()); assertEquals(top, uriInfo.getTopOption()); + assertEquals(deltaToken, uriInfo.getDeltaTokenOption()); assertArrayEquals(new QueryOption[] { alias }, uriInfo.getAliases().toArray()); assertEquals("C", uriInfo.getValueForAlias("alias")); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java index 0b8ec36..4221f92 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java @@ -94,7 +94,8 @@ public class DataCreator { data.put("ESCompCollDerived", createESCompCollDerived(edm, odata)); data.put("ESTwoPrimDerived", createESTwoPrimDerived(edm, odata)); data.put("ESAllPrimDerived", createESAllPrimDerived(edm, odata)); - + data.put("ESDelta", createESDelta(edm, odata)); + linkSINav(data); linkESTwoPrim(data); linkESAllPrim(data); @@ -102,6 +103,34 @@ public class DataCreator { linkESKeyNav(data); linkESTwoKeyNav(data); linkESPeople(data); + linkESDelta(data); + } + + + private EntityCollection createESDelta(final Edm edm, final OData odata) { + EntityCollection entityCollection = new EntityCollection(); + + entityCollection.getEntities().add(new Entity() + .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE)) + .addProperty(createPrimitive("PropertyString", "Number:" + Short.MAX_VALUE))); + entityCollection.getEntities().add(new Entity() + .addProperty(createPrimitive("PropertyInt16", Short.MIN_VALUE)) + .addProperty(createPrimitive("PropertyString", "Number:" + Short.MIN_VALUE))); + entityCollection.getEntities().add(new Entity() + .addProperty(createPrimitive("PropertyInt16", 0)) + .addProperty(createPrimitive("PropertyString", "Number:" + 0))); + entityCollection.getEntities().add(new Entity() + .addProperty(createPrimitive("PropertyInt16", 100)) + .addProperty(createPrimitive("PropertyString", "Number:" + 100))); + entityCollection.getEntities().add(new Entity() + .addProperty(createPrimitive("PropertyInt16", -1)) + .addProperty(createPrimitive("PropertyString", "Number:" + -1))); + + + setEntityType(entityCollection, edm.getEntityType(EntityTypeProvider.nameETDelta)); + createEntityId(edm, odata, "ESDelta", entityCollection); + createOperations("ESDelta", entityCollection, EntityTypeProvider.nameETDelta); + return entityCollection; } private EntityCollection createSINav(Edm edm, OData odata) { @@ -1511,6 +1540,16 @@ public class DataCreator { + " <g stroke=\"darkmagenta\" stroke-width=\"16\" fill=\"" + color + "\">\n" + " <circle cx=\"50\" cy=\"50\" r=\"42\"/>\n" + " </g>\n" + "</svg>\n").getBytes(Charset.forName("UTF-8")); } + + + private void linkESDelta(final Map<String, EntityCollection> data) { + final EntityCollection entityCollection = data.get("ESDelta"); + final List<Entity> targetEntities = data.get("ESAllPrim").getEntities(); + + setLinks(entityCollection.getEntities().get(0), "NavPropertyETAllPrimMany", targetEntities.get(1), + targetEntities.get(2)); + setLink(entityCollection.getEntities().get(3), "NavPropertyETAllPrimOne", targetEntities.get(0)); + } private void linkESPeople(final Map<String, EntityCollection> data) { final EntityCollection entityCollection = data.get("ESPeople"); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java index dd806c2..9e5acde 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java @@ -32,6 +32,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import org.apache.olingo.commons.api.data.ComplexValue; +import org.apache.olingo.commons.api.data.DeletedEntity; +import org.apache.olingo.commons.api.data.DeletedEntity.Reason; +import org.apache.olingo.commons.api.data.DeltaLink; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; @@ -563,7 +566,54 @@ public class DataProvider { entity.setMediaContentType(type); entity.setMediaETag("W/\"" + UUID.randomUUID() + "\""); } - + + public List<DeletedEntity> readDeletedEntities(final EdmEntitySet edmEntitySet) throws DataProviderException { + EntityCollection entityCollection = data.get(edmEntitySet.getName()); + List<DeletedEntity> listOfDeletedEntities = new ArrayList<DeletedEntity>(); + DeletedEntity entitySetDeleted = new DeletedEntity(); + if (entityCollection.getEntities().size() > 1) { + entitySetDeleted.setId(entityCollection.getEntities().get(0).getId()); + entitySetDeleted.setReason(Reason.changed); + listOfDeletedEntities.add(entitySetDeleted); + entitySetDeleted = new DeletedEntity(); + entitySetDeleted.setId(entityCollection.getEntities().get(1).getId()); + entitySetDeleted.setReason(Reason.deleted); + } + listOfDeletedEntities.add(entitySetDeleted); + return listOfDeletedEntities; + } + + public List<DeltaLink> readAddedLinks(final EdmEntitySet edmEntitySet) throws DataProviderException { + EntityCollection entityCollection = data.get(edmEntitySet.getName()); + List<DeltaLink> listOfAddedLinks = new ArrayList<DeltaLink>(); + DeltaLink link = new DeltaLink(); + if (entityCollection.getEntities().size() > 0) { + link.setSource(entityCollection.getEntities().get(0).getId()); + link.setRelationship("NavPropertyETAllPrimOne"); + link.setTarget(data.get("ESAllPrim").getEntities().get(1).getId()); + } + listOfAddedLinks.add(link); + return listOfAddedLinks; + } + + public List<DeltaLink> readDeletedLinks(final EdmEntitySet edmEntitySet) throws DataProviderException { + EntityCollection entityCollection = data.get(edmEntitySet.getName()); + List<DeltaLink> listOfDeletedLinks = new ArrayList<DeltaLink>(); + if (entityCollection.getEntities().size() > 1) { + DeltaLink link = new DeltaLink(); + link.setSource(entityCollection.getEntities().get(0).getId()); + link.setRelationship("NavPropertyETAllPrimOne"); + link.setTarget(data.get("ESAllPrim").getEntities().get(0).getId()); + listOfDeletedLinks.add(link); + link = new DeltaLink(); + link.setSource(entityCollection.getEntities().get(1).getId()); + link.setRelationship("NavPropertyETAllPrimOne"); + link.setTarget(data.get("ESAllPrim").getEntities().get(1).getId()); + listOfDeletedLinks.add(link); + } + return listOfDeletedLinks; + } + public EntityCollection readFunctionEntityCollection(final EdmFunction function, final List<UriParameter> parameters, final UriInfoResource uriInfo) throws DataProviderException { return FunctionData.entityCollectionFunction(function.getName(), @@ -713,6 +763,42 @@ public class DataProvider { } } + public List<Entity> readNavigationEntities(EdmEntitySet entitySet) { + + EntityCollection entityCollection = data.get(entitySet.getName()); + List<Entity> entities = new ArrayList<Entity>(); + Entity otherEntity = entitySet.getName() == "ESAllPrim" ? data.get("ESDelta").getEntities().get(0) : + data.get("ESAllPrim").getEntities().get(0); + EntityCollection ec1=new EntityCollection(); + Entity entity1 = new Entity(); + entity1.setId(entityCollection.getEntities().get(0).getId());//added navigation + entity1.addProperty(entityCollection.getEntities().get(0).getProperty(edm.getEntityContainer() + .getEntitySet(entitySet.getName()).getEntityType().getPropertyNames().get(0))); + Link link = new Link(); + Entity entity2 = new Entity(); + entity2.setId(otherEntity.getId()); + ec1.getEntities().add(entity2); + link.setInlineEntitySet(ec1); + link.setTitle("NavPropertyETAllPrimMany"); + entity1.getNavigationLinks().add(link); + + Entity entity3 = new Entity(); + EntityCollection ec2=new EntityCollection(); + entity3.setId(entityCollection.getEntities().get(0).getId());//added navigation + DeletedEntity delentity = new DeletedEntity(); + delentity.setId(otherEntity.getId()); + delentity.setReason(Reason.deleted); + ec2.getEntities().add(delentity); + Link delLink = new Link(); + delLink.setInlineEntitySet(ec2); + delLink.setTitle("NavPropertyETAllPrimMany"); + entity3.getNavigationLinks().add(delLink); + entities.add(otherEntity); + entities.add(entity1); + entities.add(entity3); + return entities; + } + public Entity read(EdmSingleton singleton) { if (data.containsKey(singleton.getName())) { EntityCollection entitySet = data.get(singleton.getName()); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java ---------------------------------------------------------------------- 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 98817a1..ad4b82f 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 @@ -19,7 +19,9 @@ package org.apache.olingo.server.tecsvc.processor; import java.net.URI; +import java.text.SimpleDateFormat; import java.util.Collections; +import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -28,6 +30,9 @@ import org.apache.olingo.commons.api.data.ComplexValue; import org.apache.olingo.commons.api.data.ContextURL; import org.apache.olingo.commons.api.data.ContextURL.Builder; import org.apache.olingo.commons.api.data.ContextURL.Suffix; +import org.apache.olingo.commons.api.data.DeletedEntity; +import org.apache.olingo.commons.api.data.Delta; +import org.apache.olingo.commons.api.data.DeltaLink; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.EntityIterator; @@ -62,6 +67,7 @@ import org.apache.olingo.server.api.serializer.ReferenceSerializerOptions; import org.apache.olingo.server.api.serializer.SerializerResult; import org.apache.olingo.server.api.serializer.SerializerStreamResult; import org.apache.olingo.server.api.uri.UriInfo; +import org.apache.olingo.server.api.uri.UriResource; import org.apache.olingo.server.api.uri.UriResourceEntitySet; import org.apache.olingo.server.api.uri.UriResourceNavigation; import org.apache.olingo.server.api.uri.UriResourcePartTyped; @@ -70,12 +76,14 @@ import org.apache.olingo.server.api.uri.queryoption.CountOption; import org.apache.olingo.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.server.api.uri.queryoption.IdOption; import org.apache.olingo.server.api.uri.queryoption.SelectOption; +import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption; import org.apache.olingo.server.tecsvc.async.AsyncProcessor; import org.apache.olingo.server.tecsvc.async.TechnicalAsyncService; import org.apache.olingo.server.tecsvc.data.DataProvider; import org.apache.olingo.server.tecsvc.data.RequestValidator; import org.apache.olingo.server.tecsvc.processor.queryoptions.ExpandSystemQueryOptionHandler; import org.apache.olingo.server.tecsvc.processor.queryoptions.options.CountHandler; +import org.apache.olingo.server.tecsvc.processor.queryoptions.options.DeltaTokenHandler; import org.apache.olingo.server.tecsvc.processor.queryoptions.options.FilterHandler; import org.apache.olingo.server.tecsvc.processor.queryoptions.options.OrderByHandler; import org.apache.olingo.server.tecsvc.processor.queryoptions.options.SearchHandler; @@ -91,6 +99,8 @@ public class TechnicalEntityProcessor extends TechnicalProcessor implements EntityCollectionProcessor, CountEntityCollectionProcessor, EntityProcessor, MediaEntityProcessor, ReferenceCollectionProcessor, ReferenceProcessor { + private static final String DELTATOKEN = "deltatoken"; + public TechnicalEntityProcessor(final DataProvider dataProvider, final ServiceMetadata serviceMetadata) { super(dataProvider, serviceMetadata); } @@ -110,15 +120,28 @@ public class TechnicalEntityProcessor extends TechnicalProcessor getEdmEntitySet(uriInfo); // including checks final EntityCollection entitySetInitial = readEntityCollection(uriInfo); EntityCollection entitySet = new EntityCollection(); - entitySet.getEntities().addAll(entitySetInitial.getEntities()); FilterHandler.applyFilterSystemQuery(uriInfo.getFilterOption(), entitySet, uriInfo, serviceMetadata.getEdm()); - response.setContent(odata.createFixedFormatSerializer().count( - entitySet.getEntities().size())); + int count = entitySet.getEntities().size(); + for (SystemQueryOption systemQueryOption : uriInfo.getSystemQueryOptions()) { + if (systemQueryOption.getName().contains(DELTATOKEN)) { + count = count + getDeltaCount(uriInfo); + break; + } + } + response.setContent(odata.createFixedFormatSerializer().count(count)); response.setStatusCode(HttpStatusCode.OK.getStatusCode()); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.TEXT_PLAIN.toContentTypeString()); } + private int getDeltaCount(UriInfo uriInfo) throws ODataApplicationException { + List<DeletedEntity> deletedEntity = readDeletedEntities(uriInfo); + List<DeltaLink> addedLink = readAddedLinks(uriInfo); + List<DeltaLink> deletedLink = readDeletedLinks(uriInfo); + List<Entity> listofNavigationEntities = readNavigationEntities(uriInfo); + return deletedEntity.size() + addedLink.size() + deletedLink.size() + listofNavigationEntities.size(); + } + @Override public void readEntity(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo, final ContentType requestedContentType) throws ODataApplicationException, ODataLibraryException { @@ -513,6 +536,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor edmEntitySet.getEntityType(); EntityCollection entitySetInitial = readEntityCollection(uriInfo); + Delta delta = null; if (entitySetInitial == null) { entitySetInitial = new EntityCollection(); } @@ -553,7 +577,35 @@ public class TechnicalEntityProcessor extends TechnicalProcessor expandHandler.applyExpandQueryOptions(entitySetSerialization, edmEntitySet, expand, uriInfo, serviceMetadata.getEdm()); final CountOption countOption = uriInfo.getCountOption(); - + final List<SystemQueryOption> systemQueryOptions = uriInfo.getSystemQueryOptions(); + String deltaToken = null; + for (SystemQueryOption systemQueryOption : systemQueryOptions) { + if (systemQueryOption.getName().contains(DELTATOKEN)) { + deltaToken = systemQueryOption.getText(); + delta = new Delta(); + Integer count = 0; + if (deltaToken != null) { + String deltaTokenValue = generateDeltaToken(); + List<DeletedEntity> listOfDeletedEntities = readDeletedEntities(uriInfo); + List<DeltaLink> listOfAddedLinks = readAddedLinks(uriInfo); + List<DeltaLink> listOfDeletedLinks = readDeletedLinks(uriInfo); + List<Entity> listofNavigationEntities = readNavigationEntities(uriInfo); + delta.getDeletedEntities().addAll(listOfDeletedEntities); + delta.getAddedLinks().addAll(listOfAddedLinks); + delta.getDeletedLinks().addAll(listOfDeletedLinks); + delta.getEntities().addAll(listofNavigationEntities); + count = listOfDeletedLinks.size()+listOfAddedLinks.size()+listOfDeletedEntities.size(); + delta.setDeltaLink(DeltaTokenHandler.createDeltaLink( + request.getRawRequestUri(), + deltaTokenValue)); + } + + delta.getEntities().addAll(entitySetSerialization.getEntities()); + count = count + delta.getEntities().size(); + delta.setCount(count); + break; + } + } String id; if (edmEntitySet == null) { // Used for functions, function imports etc. @@ -561,7 +613,12 @@ public class TechnicalEntityProcessor extends TechnicalProcessor } else { id = request.getRawBaseUri() + edmEntitySet.getName(); } - + if(odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasTrackChanges()) { + String deltaTokenValue = generateDeltaToken(); + entitySetSerialization.setDeltaLink(DeltaTokenHandler.createDeltaLink( + request.getRawRequestUri(), + deltaTokenValue)); + } if(isReference) { final SerializerResult serializerResult = serializeReferenceCollection(entitySetSerialization, edmEntitySet, requestedContentType, countOption); @@ -573,6 +630,12 @@ public class TechnicalEntityProcessor extends TechnicalProcessor expand, select, countOption, id); response.setODataContent(serializerResult.getODataContent()); + } else if(delta != null){ + final SerializerResult serializerResult = + serializeDeltaPayloads(request, + delta, edmEntitySet, edmEntityType, requestedContentType, + expand, select, countOption, id); + response.setContent(serializerResult.getContent()); } else { final SerializerResult serializerResult = serializeEntityCollection(request, @@ -587,8 +650,44 @@ public class TechnicalEntityProcessor extends TechnicalProcessor if (pageSize != null) { response.setHeader(HttpHeader.PREFERENCE_APPLIED, PreferencesApplied.with().maxPageSize(serverPageSize).build().toValueString()); + }else if (odata.createPreferences(request.getHeaders(HttpHeader.PREFER)).hasTrackChanges()) { + response.setHeader(HttpHeader.PREFERENCE_APPLIED, + PreferencesApplied.with().trackChanges().build().toValueString()); + } + if(delta!=null){ + response.setHeader(HttpHeader.ODATA_VERSION,request.getHeaders(HttpHeader.ODATA_MAX_VERSION).get(0)); } } + private List<Entity> readNavigationEntities(final UriInfo uriInfo) { + + final List<UriResource> resourcePaths = uriInfo.getUriResourceParts(); + return dataProvider.readNavigationEntities(((UriResourceEntitySet) resourcePaths.get(0)).getEntitySet()); + } + + private String generateDeltaToken() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.000"); + + Date date = new Date(System.currentTimeMillis()); + return dateFormat.format(date); + } + + private SerializerResult serializeDeltaPayloads(final ODataRequest request, final Delta delta, + final EdmEntitySet edmEntitySet, final EdmEntityType edmEntityType, + final ContentType requestedFormat, final ExpandOption expand, final SelectOption select, + final CountOption countOption, String id) throws ODataLibraryException { + + return odata.createEdmDeltaSerializer(requestedFormat, request.getHeaders(HttpHeader.ODATA_VERSION)) + .entityCollection(serviceMetadata, + edmEntityType, delta, + EntityCollectionSerializerOptions.with() + .contextURL(isODataMetadataNone(requestedFormat) ? null : + getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, false, expand, select)) + .count(countOption) + .expand(expand).select(select) + .id(id) + .build()); + + } /** * Check is streaming is enabled for this entity set in combination with the given content type. http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java index 03d02dd..31afcfa 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java @@ -21,6 +21,8 @@ package org.apache.olingo.server.tecsvc.processor; import java.util.List; import java.util.Locale; +import org.apache.olingo.commons.api.data.DeletedEntity; +import org.apache.olingo.commons.api.data.DeltaLink; import org.apache.olingo.commons.api.data.Entity; import org.apache.olingo.commons.api.data.EntityCollection; import org.apache.olingo.commons.api.data.Link; @@ -231,6 +233,23 @@ public abstract class TechnicalProcessor implements Processor { return entitySet; } + protected List<DeletedEntity> readDeletedEntities(final UriInfoResource uriInfo) throws ODataApplicationException { + final List<UriResource> resourcePaths = uriInfo.getUriResourceParts(); + return dataProvider.readDeletedEntities(((UriResourceEntitySet) resourcePaths.get(0)).getEntitySet()); + } + + + protected List<DeltaLink> readAddedLinks(final UriInfoResource uriInfo) throws ODataApplicationException { + final List<UriResource> resourcePaths = uriInfo.getUriResourceParts(); + return dataProvider.readAddedLinks(((UriResourceEntitySet) resourcePaths.get(0)).getEntitySet()); + } + + protected List<DeltaLink> readDeletedLinks(final UriInfoResource uriInfo) throws ODataApplicationException { + final List<UriResource> resourcePaths = uriInfo.getUriResourceParts(); + return dataProvider.readDeletedLinks(((UriResourceEntitySet) resourcePaths.get(0)).getEntitySet()); + } + + protected EntityCollection readEntityCollection(final UriInfoResource uriInfo) throws ODataApplicationException { final List<UriResource> resourcePaths = uriInfo.getUriResourceParts(); if (resourcePaths.size() > 1 && resourcePaths.get(1) instanceof UriResourceNavigation) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/DeltaTokenHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/DeltaTokenHandler.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/DeltaTokenHandler.java new file mode 100644 index 0000000..e8e66b9 --- /dev/null +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/DeltaTokenHandler.java @@ -0,0 +1,54 @@ +/* + * 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.tecsvc.processor.queryoptions.options; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Locale; + +import org.apache.olingo.commons.api.http.HttpStatusCode; +import org.apache.olingo.server.api.ODataApplicationException; +import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind; + +public class DeltaTokenHandler { + + public static URI createDeltaLink(final String rawRequestUri, String deltaToken) + throws ODataApplicationException { + // Remove a maybe existing skiptoken, making sure that the query part is not empty. + String deltalink = rawRequestUri.contains("?") ? + rawRequestUri.replaceAll("(\\$|%24)deltatoken=.+&?", "").replaceAll("(\\?|&)$", "") : + rawRequestUri; + + // Add a question mark or an ampersand, depending on the current query part. + deltalink += deltalink.contains("?") ? '&' : '?'; + deltaToken = deltaToken.substring(0, 4); + // Append the new skiptoken. + deltalink += SystemQueryOptionKind.DELTATOKEN.toString().replace("$", "%24") // poor man's percent encoding + + '=' + + "%2A" +deltaToken ; // "%2A" is a percent-encoded asterisk + + try { + return new URI(deltalink); + } catch (final URISyntaxException e) { + throw new ODataApplicationException("Exception while constructing delta link", + HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT, e); + } + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java index 0d28c37..0ec96ca 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java @@ -109,6 +109,7 @@ public class ContainerProvider { entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESPeople")); entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoPrimDerived")); entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllPrimDerived")); + entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESDelta")); // Singletons List<CsdlSingleton> singletons = new ArrayList<CsdlSingleton>(); @@ -678,7 +679,7 @@ public class ContainerProvider { new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression( new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true")))); - }else if (name.equals("ESAllPrimDerived")) { + } else if (name.equals("ESAllPrimDerived")) { return new CsdlEntitySet() .setName("ESAllPrimDerived") .setType(EntityTypeProvider.nameETAllPrim) @@ -692,6 +693,17 @@ public class ContainerProvider { new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression( new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true")) )); + } else if (name.equals("ESDelta")) { + return new CsdlEntitySet() + .setName("ESDelta") + .setType(EntityTypeProvider.nameETTwoPrim) + .setNavigationPropertyBindings(Arrays.asList( + new CsdlNavigationPropertyBinding() + .setPath("NavPropertyETAllPrimOne") + .setTarget("ESAllPrim"), + new CsdlNavigationPropertyBinding() + .setPath("NavPropertyETAllPrimMany") + .setTarget("ESAllPrim"))); } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java index 22f56a8..6178c48 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java @@ -87,6 +87,8 @@ public class EntityTypeProvider { "ETMixEnumDefCollComp"); public static final FullQualifiedName nameETStream = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETWithStream"); + public static final FullQualifiedName nameETDelta = + new FullQualifiedName(SchemaProvider.NAMESPACE, "ETDelta"); public static final FullQualifiedName nameETPeople = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETPeople"); @@ -503,7 +505,16 @@ public class EntityTypeProvider { PropertyProvider.propertyId, PropertyProvider.propertyName)) .setNavigationProperties(Arrays.asList(PropertyProvider.navPropertyFriends)); - } + } else if (entityTypeName.equals(nameETDelta)) { + return new CsdlEntityType() + .setName("ETDelta") + .setBaseType(nameETTwoPrim) + .setProperties(Arrays.asList( + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString)) + .setNavigationProperties( + Arrays.asList(PropertyProvider.navPropertyETAllPrimOne_ETAllPrim, + PropertyProvider.collectionNavPropertyETAllPrimMany_ETAllPrim)); + } return null; } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7e5a5c7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java index 507c217..7cb32ae 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java @@ -86,6 +86,7 @@ public class SchemaProvider { entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompMixPrimCollComp)); entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyPrimNav)); entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETStream)); + entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETDelta)); // ComplexTypes List<CsdlComplexType> complexTypes = new ArrayList<CsdlComplexType>();
