Skip to content

Commit

Permalink
fix: sonar issues
Browse files Browse the repository at this point in the history
Signed-off-by: LE SAULNIER Kevin <[email protected]>
  • Loading branch information
LE SAULNIER Kevin committed Jan 8, 2025
1 parent 5014584 commit 92c5241
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,11 @@ public Consumer<Message<String>> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ private Integer deleteStateEstimationResults() {
public void invalidateAllNodesBuilds(UUID studyUuid) {
AtomicReference<Long> 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 ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 92c5241

Please sign in to comment.