From 7563f5e55e100cec709968391044d9db6418c334 Mon Sep 17 00:00:00 2001 From: walid-sahnoun Date: Tue, 19 Sep 2023 17:48:31 +0200 Subject: [PATCH] delete stashed modifications when stash node or subtree Signed-off-by: walid-sahnoun --- .../server/repositories/NetworkModificationRepository.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java b/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java index 8107229bd..42719653d 100644 --- a/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java +++ b/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java @@ -244,7 +244,9 @@ public void deleteStashedModificationGroup(UUID groupUuid, boolean errorOnGroupN try { ModificationGroupEntity groupEntity = getModificationGroup(groupUuid); if (!groupEntity.getModifications().isEmpty()) { - modificationRepository.deleteAll(groupEntity.getModifications().stream().filter(modificationEntity -> modificationEntity.getStashed().equals(true)).collect(Collectors.toList())); + List stashedModifications = groupEntity.getModifications().stream() + .filter(modificationEntity -> modificationEntity.getStashed()).map(modification -> modification.getId()).collect(Collectors.toList()); + deleteModifications(groupUuid, stashedModifications); } } catch (NetworkModificationException e) { if (e.getType() == MODIFICATION_GROUP_NOT_FOUND && !errorOnGroupNotFound) {