Add loaded status by root network - #1072
Conversation
|
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 |
|
| public enum NetworkLoadStatus { | ||
| LOADED, | ||
| UNLOADED, | ||
| LOADING, |
| private RootNetworkIndexationStatus indexationStatus = RootNetworkIndexationStatus.NOT_INDEXED; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "network_load_status") |
There was a problem hiding this comment.
| @Column(name = "network_load_status") | |
| @Column(name = "load_status") |
| /** | ||
| * @author Ghazwa Rehili <ghazwa.rehili at rte-france.com> | ||
| */ | ||
| public enum NetworkLoadStatus { |
There was a problem hiding this comment.
| public enum NetworkLoadStatus { | |
| public enum RootNetworkLoadStatus { |
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "network_load_status") | ||
| @Builder.Default | ||
| private NetworkLoadStatus networkLoadStatus = NetworkLoadStatus.LOADED; |
There was a problem hiding this comment.
| private NetworkLoadStatus networkLoadStatus = NetworkLoadStatus.LOADED; | |
| private NetworkLoadStatus loadStatus = NetworkLoadStatus.LOADED; |
| removeReimportCaseActivity(studyUuid, rootNetworkUuid); | ||
| } | ||
| if (!success && caseImportAction == CaseImportAction.NETWORK_RECREATION) { | ||
| rootNetworkService.updateNetworkLoadStatusIfCurrent(rootNetworkUuid, NetworkLoadStatus.LOADING, NetworkLoadStatus.UNLOADED); |
There was a problem hiding this comment.
Too complicated. Just set to LOADED after network recreation
| if (receiver.getCaseImportAction() == CaseImportAction.ROOT_NETWORK_MODIFICATION) { | ||
| removeReimportCaseActivity(receiver.getStudyUuid(), receiver.getRootNetworkUuid()); | ||
| } | ||
| if (receiver.getCaseImportAction() == CaseImportAction.NETWORK_RECREATION) { |
There was a problem hiding this comment.
Here it's a fail. Just set to UNLOADED if UNLOADING
| } | ||
|
|
||
| @Transactional | ||
| public void updateNetworkLoadStatusIfCurrent(UUID rootNetworkUuid, NetworkLoadStatus expectedCurrentStatus, NetworkLoadStatus networkLoadStatus) { |
|
|
||
| persistNetwork(rootNetworkInfos, studyUuid, null, userId, importParametersToUse, CaseImportAction.NETWORK_RECREATION, reportId); | ||
| notificationService.emitElementUpdated(studyUuid, userId); | ||
| rootNetworkService.updateNetworkLoadStatus(rootNetworkInfos.getId(), NetworkLoadStatus.LOADING); |
There was a problem hiding this comment.
All changes here to remove. We don't use LOADING
| RootNetworkEntity rootNetworkEntity = rootNetworkService.getRootNetwork(rootNetworkUuid).orElseThrow(() -> new StudyException(NOT_FOUND, "Root network not found")); | ||
|
|
||
| rootNetworkService.updateNetwork(rootNetworkEntity, networkInfos); | ||
| rootNetworkEntity.setNetworkLoadStatus(NetworkLoadStatus.LOADED); |
There was a problem hiding this comment.
Why do you need this ?
| .toList(); | ||
| CompletableFuture.allOf(futures.toArray(CompletableFuture[]::new)).join(); | ||
| notificationService.emitElementUpdated(studyUuid, userId); | ||
| boolean allRootNetworkLoaded = rootNetworkIds.stream() |
There was a problem hiding this comment.
If "at least one network is loaded", then you notify. Not needed to be all LOADED


PR Summary
NetworkLoadStatus enum (LOADED, LOADING, UNLOADED) and a network_load_status column on root_network (migration, default LOADED for existing rows)
Two new supervision endpoints:
invalidateStudyRootNetwork gained a skipElementUpdatedNotification parameter, letting a caller unbuild/clean up a root network without firing the element.update notification that bumps lastModificationDate in directory-server
new root network -> LOADED ==> Entity default set once the network import has actually succeeded
LOADED/UNLOADED -> LOADING ==> recreateNetwork (reopening a study whose network was unloaded)
LOADING -> LOADED ==> Async case-import success (ConsumerService, NETWORK_RECREATION)
LOADING -> UNLOADED ==> Case-import failure
LOADED -> UNLOADED ==> invalidateStudyRootNetwork
DELETE /supervision/studies/{id}/invalidate -> for each root network: unbuild all nodes, delete the network from network-store, networkLoadStatus -> UNLOADED, called with skipElementUpdatedNotification=true so no element.update message is sent lastModificationDate in directory-server is untouched
GET /supervision/studies/unloaded will now include this study once every root network is UNLOADED