[OLINGO-1490] Update(PUT) Collection Property
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
index 985bee6..e922277 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataDispatcher.java
@@ -563,7 +563,20 @@
ODataHandlerException.MessageKeys.INVALID_PAYLOAD);
}
}
- } else {
+ } else if (method == HttpMethod.PUT && uriInfo.getUriResourceParts().size()==2) {
+ if (isMedia) {
+ validatePreferHeader(request);
+ }
+ validatePreconditions(request, false);
+ final ContentType requestFormat = getSupportedContentType(
+ request.getHeader(HttpHeader.CONTENT_TYPE),
+ RepresentationType.ENTITY, true);
+ final ContentType responseFormat = ContentNegotiator.
+ doContentNegotiation(uriInfo.getFormatOption(),
+ request, handler.getCustomContentTypeSupport(), RepresentationType.ENTITY);
+ handler.selectProcessor(EntityProcessor.class)
+ .updateEntity(request, response, uriInfo, requestFormat, responseFormat);
+ } else {
throwMethodNotAllowed(method);
}
}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
index baf2f40..51ac9fa 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/RequestValidator.java
@@ -140,13 +140,9 @@
if (edmProperty.isCollection()) {
final EntityCollection inlineEntitySet = navigationLink.getInlineEntitySet();
if (inlineEntitySet != null) {
- if (!isInsert && inlineEntitySet.getEntities().size() > 0) {
- throw new DataProvider.DataProviderException("Deep update is not allowed", HttpStatusCode.BAD_REQUEST);
- } else {
for (final Entity entity : navigationLink.getInlineEntitySet().getEntities()) {
validate(edmBindingTarget, entity);
}
- }
}
} else {
final Entity inlineEntity = navigationLink.getInlineEntity();
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerImplTest.java
index b9e1970..7c0894a 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerImplTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerImplTest.java
@@ -748,7 +748,7 @@
dispatchMethodNotAllowed(HttpMethod.PATCH, sigletonManyNavUri, processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, sigletonManyNavUri, processor);
+ dispatch(HttpMethod.PUT, sigletonManyNavUri, processor);
dispatch(HttpMethod.POST, sigletonManyNavUri, processor);
verify(processor).createEntity(