This is an automated email from the ASF dual-hosted git repository.

archanarai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git


The following commit(s) were added to refs/heads/master by this push:
     new a50c098  [OLINGO-1490] Update(PUT) Collection Property
a50c098 is described below

commit a50c098644f17a51a03289d01b3decc6e650c047
Author: Archana Rai <[email protected]>
AuthorDate: Fri Oct 30 16:01:49 2020 +0530

    [OLINGO-1490] Update(PUT) Collection Property
---
 .../org/apache/olingo/server/core/ODataDispatcher.java    | 15 ++++++++++++++-
 .../olingo/server/tecsvc/data/RequestValidator.java       |  4 ----
 .../apache/olingo/server/core/ODataHandlerImplTest.java   |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

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 @@ public class ODataDispatcher {
               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 @@ public class RequestValidator {
     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 @@ public class ODataHandlerImplTest {
     
     dispatchMethodNotAllowed(HttpMethod.PATCH, sigletonManyNavUri, processor);
     
-    dispatchMethodNotAllowed(HttpMethod.PUT, sigletonManyNavUri, processor);
+    dispatch(HttpMethod.PUT, sigletonManyNavUri, processor);
     
     dispatch(HttpMethod.POST, sigletonManyNavUri, processor);
     verify(processor).createEntity(

Reply via email to