Skip to content

Commit

Permalink
MID-7149: Fixed modify on REST /objects/oid
Browse files Browse the repository at this point in the history
If user is posting Patch to /objects/oid we do additional read to
get actual object type in order to correctly parse and propagate
delta.
  • Loading branch information
tonydamage committed Sep 28, 2023
1 parent e6fde6f commit 90abcf9
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,15 @@ public ResponseEntity<?> modifyObjectPatch(
ResponseEntity<?> response;
try {
ModelExecuteOptions modelExecuteOptions = ModelExecuteOptions.fromRestOptions(options);
Collection<? extends ItemDelta<?, ?>> modifications = DeltaConvertor.toModifications(modificationType, clazz, prismContext);
model.modifyObject(clazz, oid, modifications, modelExecuteOptions, task, result);
Class<? extends ObjectType> realType = null;
if (ObjectType.class.equals(clazz)) {
// Slow path // we need to determine real type of object.
realType = model.getObject(clazz, oid, GetOperationOptions.createRawCollection(), task, result).getCompileTimeClass();
} else {
realType = clazz;
}
Collection<? extends ItemDelta<?, ?>> modifications = DeltaConvertor.toModifications(modificationType, realType, prismContext);
model.modifyObject(realType, oid, modifications, modelExecuteOptions, task, result);
response = createResponse(HttpStatus.NO_CONTENT, result);
} catch (Exception ex) {
result.recordFatalError("Could not modify object. " + ex.getMessage(), ex);
Expand Down

0 comments on commit 90abcf9

Please sign in to comment.