Add an endpoint sharing a composite modification of a group - #874
Add an endpoint sharing a composite modification of a group#874flomillot wants to merge 4 commits into
Conversation
The composite modification is taken out of its group, so that it can be stored as an element of the directory server, and a reference to it takes its place - and its order - in the group. It keeps its own uuid, and is renamed when a name is given. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
| if (!groupUuid.equals(modificationEntity.getContainerUuid())) { | ||
| throw new NetworkModificationServerException(MODIFICATION_NOT_FOUND, | ||
| String.format("Modification %s is not owned by group %s", modificationUuid, groupUuid), | ||
| Map.of(MODIFICATION_ID, modificationUuid + " (group = " + groupUuid + ")")); |
There was a problem hiding this comment.
Map.of(MODIFICATION_ID, modificationUuid, "groupId", groupUuid)) ?
(Jackson serializes UUID as a string anyway)
There was a problem hiding this comment.
Took same as existing
| } | ||
| if (!groupUuid.equals(modificationEntity.getContainerUuid())) { | ||
| throw new NetworkModificationServerException(MODIFICATION_NOT_FOUND, | ||
| String.format("Modification %s is not owned by group %s", modificationUuid, groupUuid), |
There was a problem hiding this comment.
String.format(MODIFICATION_NOT_FOUND.messageTemplate(), modificationUuid) ?
There was a problem hiding this comment.
Nope it's a different one.
| } | ||
|
|
||
| @PostMapping(value = "/{uuid}/share") | ||
| @Operation(summary = "Extract a composite modification from its group, replacing it by a reference to it") |
There was a problem hiding this comment.
Extract the composite modification from the group and replace it with a reference ?
There was a problem hiding this comment.
Honestly I don't see the difference and I prefer the original one
| } | ||
|
|
||
| modificationRepository.save(referenceEntity); | ||
| modificationRepository.save(compositeEntity); |
There was a problem hiding this comment.
modificationRepository.save(referenceEntity);
modificationRepository.save(compositeEntity);
are you sure about those save ? they seem a little weird to me do you really need to perform the save operation after addModification? (the modifications are already committed)
There was a problem hiding this comment.
It's a good catch and actually technically it works without. However, it totally depends on how other entities are annotated.
It's tricky for me and keeping the save is safer even if it's useless right now.
Moreover, there is already a similar case keeping the save.
Maybe we should ask a tech lead about it.
The composite modification keeps its own uuid when extracted, so the caller already knows it. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
|



Adds
POST /v1/network-composite-modifications/{uuid}/share?groupUuid=&name=, used when a composite modification of a study node becomes a shared modification stored in GridExplore.In a single transaction, the composite modification is taken out of its group and a
MODIFICATION_REFERENCEto it takes its place, at the very same order. The composite keeps its own uuid — it is moved, not duplicated — so the caller can store it in the directory server under that uuid, and it is renamed when a name is given.Sharing a modification which is not a composite one is rejected with the new
MODIFICATION_BAD_TYPEbusiness error, and sharing one which is not owned by the given group withMODIFICATION_NOT_FOUND.