[OLINGO-1490] Update(PUT) Collection Property

This commit is contained in:
Archana Rai 2020-10-30 16:01:49 +05:30
parent 4aba5b9f92
commit a50c098644
3 changed files with 15 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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(