-
Notifications
You must be signed in to change notification settings - Fork 2
rework export network file #899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| @Lazy StudyService studyService, | ||
| RootNetworkService rootNetworkService, | ||
| RootNetworkNodeInfoService rootNetworkNodeInfoService, | ||
| DirectoryService directoryService) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name = "exportUuids", | |
| name = "node_export", |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_exportUuids_fk") | |
| foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_nodeExport_fk") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @MapKeyColumn(name = "export_uuid_key") | |
| @MapKeyColumn(name = "export_uuid") |
There was a problem hiding this comment.
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<>(); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see
study-server/src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
Line 242 in 30130ce
| public InvalidateNodeInfos invalidateRootNetworkNode(RootNetworkNodeInfoEntity rootNetworkNodeInfoEntity, InvalidateNodeTreeParameters invalidateTreeParameters) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
… rework-export-network-file
| joinColumns = @JoinColumn(name = "root_network_node_info_id"), | ||
| foreignKey = @ForeignKey(name = "rootNetworkNodeInfo_nodeExport_fk") | ||
| ) | ||
| private Map<UUID, NodeExportEmbeddable> nodeExportNetwork = new HashMap<>(); |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
… rework-export-network-file
|
| } | ||
|
|
||
| @Transactional | ||
| public void updateExportNetworkStatus(UUID nodeUuid, UUID rootNetworkUuid, UUID exportUuid, ExportNetworkStatus status) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this call after you did https://github.com/gridsuite/study-server/pull/899/changes#r2653235285



PR Summary
rework export network file