Skip to content

Conversation

@ghazwarhili
Copy link
Contributor

PR Summary

rework export network file

@Lazy StudyService studyService,
RootNetworkService rootNetworkService,
RootNetworkNodeInfoService rootNetworkNodeInfoService,
DirectoryService directoryService) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reformatted code to be reverted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


@ElementCollection
@CollectionTable(
name = "exportUuids",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name = "exportUuids",
name = "node_export",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@CollectionTable(
name = "exportUuids",
joinColumns = @JoinColumn(name = "root_network_node_info_id"),
foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_exportUuids_fk")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_exportUuids_fk")
foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_nodeExport_fk")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

joinColumns = @JoinColumn(name = "root_network_node_info_id"),
foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_exportUuids_fk")
)
@MapKeyColumn(name = "export_uuid_key")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@MapKeyColumn(name = "export_uuid_key")
@MapKeyColumn(name = "export_uuid")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@MapKeyColumn(name = "export_uuid_key")
@Column(name = "status")
@Enumerated(EnumType.STRING)
private Map<UUID, ExportNetworkStatus> exportNetworkUuids = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Entries in the sub table should be deleted when the node is unbuild (and also when a modification is added to the node ? to be done later maybe)

Copy link
Contributor

Choose a reason for hiding this comment

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

see

public InvalidateNodeInfos invalidateRootNetworkNode(RootNetworkNodeInfoEntity rootNetworkNodeInfoEntity, InvalidateNodeTreeParameters invalidateTreeParameters) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ll look into how to do it

Copy link
Contributor

Choose a reason for hiding this comment

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

And it would be simpler by using a NodeExportEmbeddable and remove @MapKeyColumn and @Enumerated.
After your PR, Bassel will add some columns to this table

uriComponentsBuilder.queryParam("fileName", fileName);
}
String receiver = URLEncoder.encode(objectMapper.writeValueAsString(new NetworkExportReceiver(studyUuid, userId)), StandardCharsets.UTF_8);
String receiver = URLEncoder.encode(objectMapper.writeValueAsString(new NetworkExportReceiver(studyUuid, nodeUuid, rootNetworkUuid, userId)), StandardCharsets.UTF_8);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you add this ? I guess it's not used as you didn't change the conversion-server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need it because I use nodeUuid and rootNetworkUuid to look up the rootNetworkNodeInfoEntity. Even if the conversion-server wasn’t changed, these values are required for that lookup

Copy link
Contributor

Choose a reason for hiding this comment

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

You need it in some other methods yes. But not this one that is dedicated to the request to network-conversion-server

Copy link
Contributor

Choose a reason for hiding this comment

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

Hum ok it's for the nodeUuid and rootNetworkUuid to be present in the notification ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rootNetworkUuid and nodeUuid removed
done

joinColumns = @JoinColumn(name = "root_network_node_info_id"),
foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_nodeExport_fk")
)
private Map<UUID, NodeExportEmbeddable> nodeExportNetwork = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a list and add exportUuid to NodeExportEmbeddable ?

Copy link
Contributor Author

@ghazwarhili ghazwarhili Dec 17, 2025

Choose a reason for hiding this comment

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

map replaced by list
done

}

@Transactional
public void updateExportNetworkStatus(UUID nodeUuid, UUID rootNetworkUuid, UUID exportUuid, ExportNetworkStatus status) {
Copy link
Contributor

Choose a reason for hiding this comment

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

method to remove ? The one above does the job


List<RootNetworkNodeInfoEntity> findAllByPccMinResultUuidNotNull();

List<RootNetworkNodeInfoEntity> findAllByNodeExportNetworkExportUuid(UUID exportUuid);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add a JPQL request (as it is done for existsByNodeUuidsAndBlockedNode()) that will return a NodeExportEmbeddable for a given exportUuid. This will simplify also updateExportNetworkStatus(UUID exportUuid, ExportNetworkStatus status) and getExportNetworkStatus()

UUID exportUuid = msg.getHeaders().containsKey(HEADER_EXPORT_UUID) ? UUID.fromString((String) Objects.requireNonNull(msg.getHeaders().get(HEADER_EXPORT_UUID))) : null;
String errorMessage = (String) msg.getHeaders().get(HEADER_ERROR);
notificationService.emitNetworkExportFinished(studyUuid, exportUuid, userId, errorMessage);
rootNetworkNodeInfoService.updateExportNetworkStatus(exportUuid, errorMessage == null ? ExportNetworkStatus.SUCCESS : ExportNetworkStatus.FAILED);
Copy link
Contributor

Choose a reason for hiding this comment

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

You should first update the export status and then notify that the export is finished

RootNetworkNodeInfoEntity rootNetworkNodeInfo = findRootNetworkNodeInfo(nodeUuid, rootNetworkUuid);
if (rootNetworkNodeInfo.getNodeExportNetwork() != null) {
rootNetworkNodeInfo.getNodeExportNetwork().clear();
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this branch ? It's not in the clearNodeExportNetwork that we should set a new ArrayList<> instead of a null


deleteInvalidationInfos(invalidateNodeInfos);

rootNetworkNodeInfoService.clearNodeExportNetworks(nodeUuid, rootNetworkUuid);
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this into invalidateRootNetworkNode(RootNetworkNodeInfoEntity rootNetworkNodeInfoEntity, InvalidateNodeTreeParameters invalidateTreeParameters) of RootNetworkNodeInfoService.java

}

if (!networkModificationTreeService.isRootNode(nodeUuid)) {
rootNetworkNodeInfoService.clearNodeExportNetworks(nodeUuid, rootNetworkUuid);
Copy link
Contributor

Choose a reason for hiding this comment

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

joinColumns = @JoinColumn(name = "root_network_node_info_id"),
foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_nodeExport_fk")
)
private List<NodeExportEmbeddable> nodeExportNetwork = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you have to move this to AbstractNodeInfoEntity.
RootNetworkNodeInfoEntity is for modification nodes only, not for root nodes. And we need to export also root nodes

@ghazwarhili ghazwarhili force-pushed the rework-export-network-file branch from b6c2eb9 to 97f17ed Compare January 7, 2026 15:42
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@ghazwarhili ghazwarhili merged commit 7ad354d into main Jan 8, 2026
4 checks passed
@ghazwarhili ghazwarhili deleted the rework-export-network-file branch January 8, 2026 14:52
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.

3 participants