diff --git a/src/main/java/org/gridsuite/study/server/service/ConsumerService.java b/src/main/java/org/gridsuite/study/server/service/ConsumerService.java index 0bbfb7adf..62e0cae68 100644 --- a/src/main/java/org/gridsuite/study/server/service/ConsumerService.java +++ b/src/main/java/org/gridsuite/study/server/service/ConsumerService.java @@ -395,12 +395,11 @@ public Consumer> consumeCaseImportFailed() { UUID studyUuid = receiver.getStudyUuid(); String userId = receiver.getUserId(); - switch (receiver.getCaseImportAction()) { - case STUDY_CREATION -> { - studyService.deleteStudyIfNotCreationInProgress(studyUuid, userId); - notificationService.emitStudyCreationError(studyUuid, userId, errorMessage); - } - case ROOT_NETWORK_CREATION, ROOT_NETWORK_MODIFICATION -> notificationService.emitRootNetworksUpdateFailed(studyUuid, errorMessage); + if (receiver.getCaseImportAction() == CaseImportAction.STUDY_CREATION) { + studyService.deleteStudyIfNotCreationInProgress(studyUuid, userId); + notificationService.emitStudyCreationError(studyUuid, userId, errorMessage); + } else { + notificationService.emitRootNetworksUpdateFailed(studyUuid, errorMessage); } } catch (Exception e) { LOGGER.error(e.toString(), e); diff --git a/src/main/java/org/gridsuite/study/server/service/StudyService.java b/src/main/java/org/gridsuite/study/server/service/StudyService.java index 40812a2a9..37e692f9e 100644 --- a/src/main/java/org/gridsuite/study/server/service/StudyService.java +++ b/src/main/java/org/gridsuite/study/server/service/StudyService.java @@ -393,9 +393,9 @@ public void duplicateStudyAsync(BasicStudyInfos basicStudyInfos, UUID sourceStud StudyEntity duplicatedStudy = duplicateStudy(basicStudyInfos, sourceStudyUuid, userId); - rootNetworkService.getStudyRootNetworks(duplicatedStudy.getId()).forEach(rootNetworkEntity -> { - reindexStudy(duplicatedStudy, rootNetworkEntity.getId()); - }); + rootNetworkService.getStudyRootNetworks(duplicatedStudy.getId()).forEach(rootNetworkEntity -> + reindexStudy(duplicatedStudy, rootNetworkEntity.getId()) + ); } catch (Exception e) { LOGGER.error(e.toString(), e); } finally { @@ -1495,7 +1495,6 @@ public void duplicateStudySubtree(UUID sourceStudyUuid, UUID targetStudyUuid, UU checkStudyContainsNode(targetStudyUuid, referenceNodeUuid); StudyEntity studyEntity = studyRepository.findById(targetStudyUuid).orElseThrow(() -> new StudyException(STUDY_NOT_FOUND)); - //TODO: tofix, should not have rootNetworkUuid here, but this method returns data linked to a specific root network AbstractNode studySubTree = networkModificationTreeService.getStudySubtree(sourceStudyUuid, parentNodeToCopyUuid, null); UUID duplicatedNodeUuid = networkModificationTreeService.cloneStudyTree(studySubTree, referenceNodeUuid, studyEntity); notificationService.emitSubtreeInserted(targetStudyUuid, duplicatedNodeUuid, referenceNodeUuid); diff --git a/src/main/java/org/gridsuite/study/server/service/SupervisionService.java b/src/main/java/org/gridsuite/study/server/service/SupervisionService.java index 418a6a78c..434a59a49 100644 --- a/src/main/java/org/gridsuite/study/server/service/SupervisionService.java +++ b/src/main/java/org/gridsuite/study/server/service/SupervisionService.java @@ -304,7 +304,6 @@ private Integer deleteStateEstimationResults() { public void invalidateAllNodesBuilds(UUID studyUuid) { AtomicReference startTime = new AtomicReference<>(); startTime.set(System.nanoTime()); - //TODO: to fix, should not have any root network uuid here UUID rootNodeUuid = networkModificationTreeService.getStudyRootNodeUuid(studyUuid); //TODO: to parallelize ? rootNetworkService.getStudyRootNetworks(studyUuid).forEach(rootNetworkEntity -> diff --git a/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java b/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java index 28ea53f53..4f8589c42 100644 --- a/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java +++ b/src/test/java/org/gridsuite/study/server/NetworkModificationTest.java @@ -227,7 +227,6 @@ class NetworkModificationTest { private UUID userNoProfileStubId; private static final String ERROR_MESSAGE = "nullPointerException: unexpected null somewhere"; - private ObjectMapper objectMapper; @BeforeEach void setup(final MockWebServer server) {