Skip to content

Add loaded status by root network - #1072

Open
ghazwarhili wants to merge 17 commits into
mainfrom
add-loaded-status-by-root-network
Open

Add loaded status by root network#1072
ghazwarhili wants to merge 17 commits into
mainfrom
add-loaded-status-by-root-network

Conversation

@ghazwarhili

@ghazwarhili ghazwarhili commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

PR Summary

RootNetworkLoadStatus (LOADED, UNLOADED, UNLOADING) carried by root_network.load_status (migration, default LOADED for existing rows)

Two new supervision endpoints:

  • DELETE /supervision/studies/{studyUuid}/invalidate for each root network: unbuild all nodes, delete the network in network-store, transition through UNLOADING then UNLOADED
  • GET /supervision/studies/loaded returns among the given ids the studies that have at least one root network LOADED

Transitions:

  • new root network → LOADED (entity default, confirmed once import actually succeeds)
  • LOADED → UNLOADING → UNLOADED: DELETE /invalidate
  • UNLOADED → LOADED: successful case re-import (reopening a study whose network had been unloaded)
  • UNLOADED stays UNLOADED: re import failure

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 696d34a0-4ced-40ed-abb3-cad390542fdc


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

public enum NetworkLoadStatus {
LOADED,
UNLOADED,
LOADING,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

private RootNetworkIndexationStatus indexationStatus = RootNetworkIndexationStatus.NOT_INDEXED;

@Enumerated(EnumType.STRING)
@Column(name = "network_load_status")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Column(name = "network_load_status")
@Column(name = "load_status")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

/**
* @author Ghazwa Rehili <ghazwa.rehili at rte-france.com>
*/
public enum NetworkLoadStatus {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public enum NetworkLoadStatus {
public enum RootNetworkLoadStatus {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

@Enumerated(EnumType.STRING)
@Column(name = "network_load_status")
@Builder.Default
private NetworkLoadStatus networkLoadStatus = NetworkLoadStatus.LOADED;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private NetworkLoadStatus networkLoadStatus = NetworkLoadStatus.LOADED;
private NetworkLoadStatus loadStatus = NetworkLoadStatus.LOADED;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

removeReimportCaseActivity(studyUuid, rootNetworkUuid);
}
if (!success && caseImportAction == CaseImportAction.NETWORK_RECREATION) {
rootNetworkService.updateNetworkLoadStatusIfCurrent(rootNetworkUuid, NetworkLoadStatus.LOADING, NetworkLoadStatus.UNLOADED);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too complicated. Just set to LOADED after network recreation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

if (receiver.getCaseImportAction() == CaseImportAction.ROOT_NETWORK_MODIFICATION) {
removeReimportCaseActivity(receiver.getStudyUuid(), receiver.getRootNetworkUuid());
}
if (receiver.getCaseImportAction() == CaseImportAction.NETWORK_RECREATION) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it's a fail. Just set to UNLOADED if UNLOADING

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

@Transactional
public void updateNetworkLoadStatusIfCurrent(UUID rootNetworkUuid, NetworkLoadStatus expectedCurrentStatus, NetworkLoadStatus networkLoadStatus) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove also the endpoint getLoadedStudies ?


persistNetwork(rootNetworkInfos, studyUuid, null, userId, importParametersToUse, CaseImportAction.NETWORK_RECREATION, reportId);
notificationService.emitElementUpdated(studyUuid, userId);
rootNetworkService.updateNetworkLoadStatus(rootNetworkInfos.getId(), NetworkLoadStatus.LOADING);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes here to remove. We don't use LOADING

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

RootNetworkEntity rootNetworkEntity = rootNetworkService.getRootNetwork(rootNetworkUuid).orElseThrow(() -> new StudyException(NOT_FOUND, "Root network not found"));

rootNetworkService.updateNetwork(rootNetworkEntity, networkInfos);
rootNetworkEntity.setNetworkLoadStatus(NetworkLoadStatus.LOADED);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to update the status to LOADED ? you suggest to be removed also ?

.toList();
CompletableFuture.allOf(futures.toArray(CompletableFuture[]::new)).join();
notificationService.emitElementUpdated(studyUuid, userId);
boolean allRootNetworkLoaded = rootNetworkIds.stream()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If "at least one network is loaded", then you notify. Not needed to be all LOADED

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants