diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java index e41abd40a..9f29f6392 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java @@ -333,4 +333,5 @@ public interface Constants { String REMOVED = "removed"; String ENTITY = "/$entity"; String REASON = "Reason"; + String ID = "@id"; } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializer.java index 0708d5dfa..c6c5ac4e7 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializer.java @@ -191,7 +191,7 @@ public class JsonDeltaSerializer implements EdmDeltaSerializer { } json.writeStartObject(); json.writeStringField(Constants.JSON_CONTEXT, HASH + deletedEntity.getId().toASCIIString() + DELETEDENTITY); - json.writeStringField(Constants.JSON_ID, deletedEntity.getId().toASCIIString()); + json.writeStringField(Constants.ATOM_ATTR_ID, deletedEntity.getId().toASCIIString()); json.writeStringField(Constants.ELEM_REASON, deletedEntity.getReason().name()); json.writeEndObject(); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerWithNavigations.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerWithNavigations.java index 673a6dd17..ad8635d43 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerWithNavigations.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerWithNavigations.java @@ -225,7 +225,7 @@ public class JsonDeltaSerializerWithNavigations implements EdmDeltaSerializer { json.writeStringField(property.getName(), property.getValue().toString()); } } - json.writeStringField(Constants.AT + Constants.ATOM_ATTR_ID, deletedEntity.getId().toASCIIString()); + json.writeStringField(Constants.ID, deletedEntity.getId().toASCIIString()); json.writeEndObject(); } diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerTest.java index 3e221d6c1..0ade205e3 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/JsonDeltaSerializerTest.java @@ -144,9 +144,9 @@ public class JsonDeltaSerializerTest { final String expectedResult = "{" +"\"@odata.context\":\"$metadata#ESDelta/$delta\",\"value\":[{" + "\"@odata.context\":\"#ESDelta(100)/$deletedEntity\"," - + "\"@odata.id\":\"ESDelta(100)\",\"reason\":\"deleted\"},{" + + "\"id\":\"ESDelta(100)\",\"reason\":\"deleted\"},{" + "\"@odata.context\":\"#ESDelta(-32768)/$deletedEntity\"," - + "\"@odata.id\":\"ESDelta(-32768)\",\"reason\":\"changed\"}]" + + "\"id\":\"ESDelta(-32768)\",\"reason\":\"changed\"}]" + "}"; Assert.assertNotNull(jsonString); Assert.assertEquals(expectedResult, jsonString); @@ -231,8 +231,8 @@ public class JsonDeltaSerializerTest { + "\"@odata.id\":\"ESDelta(32767)\",\"PropertyInt16\":32767," + "\"PropertyString\":\"Number:32767\"},{\"@odata.id\":\"ESDelta(-32768)\"," + "\"PropertyString\":\"Number:-32768\"},{\"@odata.context\":\"#ESDelta(100)/$deletedEntity\"," - + "\"@odata.id\":\"ESDelta(100)\",\"reason\":\"deleted\"}," - + "{\"@odata.context\":\"#ESDelta(-32768)/$deletedEntity\",\"@odata.id\":\"ESDelta(-32768)\"," + + "\"id\":\"ESDelta(100)\",\"reason\":\"deleted\"}," + + "{\"@odata.context\":\"#ESDelta(-32768)/$deletedEntity\",\"id\":\"ESDelta(-32768)\"," + "\"reason\":\"changed\"},{\"@odata.context\":\"#ESDelta/$link\",\"source\":\"ESDelta(100)\"," + "\"relationship\":\"NavPropertyETAllPrimOne\",\"target\":\"ESAllPrim(0)\"},{\"@odata.context\":" + "\"#ESDelta/$deletedLink\",\"source\":\"ESDelta(100)\",\"relationship\":\"NavPropertyETAllPrimOne\","