@@ -1008,6 +1008,9 @@ public void assertNoBlockedBuildInNodeTree(UUID nodeUuid, UUID rootNetworkUuid)
1008
1008
1009
1009
@ Transactional (readOnly = true )
1010
1010
public void assertNoBlockedBuildInStudy (UUID studyUuid , UUID nodeUuid ) {
1011
+ if (nodeUuid == null ) {
1012
+ throw new StudyException (MISSING_PARAMETER , "The parameter 'nodeUuid' must be defined !" );
1013
+ }
1011
1014
List <UUID > nodesUuids = networkModificationTreeService .getNodeTreeUuids (nodeUuid );
1012
1015
getStudyRootNetworks (studyUuid ).stream ().forEach (rootNetwork ->
1013
1016
rootNetworkNodeInfoService .assertNoBlockedBuild (rootNetwork .getId (), nodesUuids )
@@ -1645,12 +1648,10 @@ private void removeSecurityAnalysisParameters(@Nullable UUID securityAnalysisPar
1645
1648
}
1646
1649
1647
1650
@ Transactional
1648
- public void createNetworkModification (UUID studyUuid , String createModificationAttributes , UUID nodeUuid , String userId ) {
1651
+ public void createNetworkModification (UUID studyUuid , UUID nodeUuid , String createModificationAttributes , String userId ) {
1649
1652
List <UUID > childrenUuids = networkModificationTreeService .getChildrenUuids (nodeUuid );
1650
1653
notificationService .emitStartModificationEquipmentNotification (studyUuid , nodeUuid , childrenUuids , NotificationService .MODIFICATIONS_CREATING_IN_PROGRESS );
1651
1654
try {
1652
- invalidateNodeTreeWithLF (studyUuid , nodeUuid , ComputationsInvalidationMode .ALL );
1653
-
1654
1655
UUID groupUuid = networkModificationTreeService .getModificationGroupUuid (nodeUuid );
1655
1656
List <RootNetworkEntity > studyRootNetworkEntities = getStudyRootNetworks (studyUuid );
1656
1657
@@ -1671,7 +1672,6 @@ public void createNetworkModification(UUID studyUuid, String createModificationA
1671
1672
}
1672
1673
}
1673
1674
} finally {
1674
- invalidateBlockedBuildNodeTree (studyUuid , nodeUuid );
1675
1675
notificationService .emitEndModificationEquipmentNotification (studyUuid , nodeUuid , childrenUuids );
1676
1676
}
1677
1677
notificationService .emitElementUpdated (studyUuid , userId );
@@ -1874,7 +1874,6 @@ private void invalidateNode(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid)
1874
1874
TimeUnit .NANOSECONDS .toSeconds (System .nanoTime () - startTime .get ()));
1875
1875
}
1876
1876
}
1877
- // Invalidate only one node
1878
1877
1879
1878
private void invalidateNode (UUID studyUuid , UUID nodeUuid ) {
1880
1879
getStudyRootNetworks (studyUuid ).forEach (rootNetworkEntity ->
@@ -1890,6 +1889,30 @@ private void invalidateNodeTree(UUID studyUuid, UUID nodeUuid, InvalidateNodeTre
1890
1889
invalidateNodeTree (studyUuid , nodeUuid , rootNetworkEntity .getId (), invalidateTreeParameters ));
1891
1890
}
1892
1891
1892
+ @ Transactional
1893
+ public void invalidateNodeTreeWhenMoveModification (UUID studyUuid , UUID nodeUuid ) {
1894
+ invalidateNodeTree (studyUuid , nodeUuid , InvalidateNodeTreeParameters .ALL );
1895
+ }
1896
+
1897
+ @ Transactional
1898
+ public boolean invalidateNodeTreeWhenMoveModifications (UUID studyUuid , UUID targetNodeUuid , UUID originNodeUuid ) {
1899
+ boolean isTargetInDifferentNodeTree = !targetNodeUuid .equals (originNodeUuid )
1900
+ && !networkModificationTreeService .isAChild (originNodeUuid , targetNodeUuid );
1901
+
1902
+ invalidateNodeTree (studyUuid , originNodeUuid );
1903
+
1904
+ if (isTargetInDifferentNodeTree ) {
1905
+ invalidateNodeTreeWithLF (studyUuid , targetNodeUuid , ComputationsInvalidationMode .ALL );
1906
+ }
1907
+
1908
+ return isTargetInDifferentNodeTree ;
1909
+ }
1910
+
1911
+ @ Transactional
1912
+ public void invalidateNodeTreeWithLF (UUID studyUuid , UUID nodeUuid ) {
1913
+ invalidateNodeTreeWithLF (studyUuid , nodeUuid , ComputationsInvalidationMode .ALL );
1914
+ }
1915
+
1893
1916
private void invalidateNodeTreeWithLF (UUID studyUuid , UUID nodeUuid , ComputationsInvalidationMode computationsInvalidationMode ) {
1894
1917
getStudyRootNetworks (studyUuid ).forEach (rootNetworkEntity ->
1895
1918
invalidateNodeTreeWithLF (studyUuid , nodeUuid , rootNetworkEntity .getId (), computationsInvalidationMode )
@@ -1927,7 +1950,8 @@ private void invalidateNodeTree(UUID studyUuid, UUID nodeUuid, UUID rootNetworkU
1927
1950
}
1928
1951
}
1929
1952
1930
- private void invalidateBlockedBuildNodeTree (UUID studyUuid , UUID nodeUuid ) {
1953
+ @ Transactional
1954
+ public void invalidateBlockedBuildNodeTree (UUID studyUuid , UUID nodeUuid ) {
1931
1955
getStudyRootNetworks (studyUuid ).forEach (rootNetworkEntity ->
1932
1956
networkModificationTreeService .invalidateBlockedBuildNodeTree (rootNetworkEntity .getId (), nodeUuid )
1933
1957
);
@@ -2190,17 +2214,12 @@ public RootNetworkIndexationStatus getRootNetworkIndexationStatus(UUID studyUuid
2190
2214
}
2191
2215
2192
2216
@ Transactional
2193
- public void moveNetworkModifications (UUID studyUuid , UUID targetNodeUuid , UUID originNodeUuid , List <UUID > modificationUuidList , UUID beforeUuid , String userId ) {
2217
+ public void moveNetworkModifications (UUID studyUuid , UUID targetNodeUuid , UUID originNodeUuid , List <UUID > modificationUuidList , UUID beforeUuid , boolean isTargetInDifferentNodeTree , String userId ) {
2194
2218
if (originNodeUuid == null ) {
2195
2219
throw new StudyException (MISSING_PARAMETER , "The parameter 'originNodeUuid' must be defined when moving modifications" );
2196
2220
}
2197
2221
2198
2222
boolean isTargetDifferentNode = !targetNodeUuid .equals (originNodeUuid );
2199
- // Target node must not be built (incremental mode) when:
2200
- // - the move is a cut & paste or a position change inside the same node
2201
- // - the move is a cut & paste between 2 nodes and the target node belongs to the source node subtree
2202
- boolean isTargetChildNode = networkModificationTreeService .isAChild (originNodeUuid , targetNodeUuid );
2203
- boolean isTargetInDifferentNodeTree = isTargetDifferentNode && !isTargetChildNode ;
2204
2223
2205
2224
List <UUID > childrenUuids = networkModificationTreeService .getChildrenUuids (targetNodeUuid );
2206
2225
List <UUID > originNodeChildrenUuids = new ArrayList <>();
@@ -2212,11 +2231,6 @@ public void moveNetworkModifications(UUID studyUuid, UUID targetNodeUuid, UUID o
2212
2231
try {
2213
2232
checkStudyContainsNode (studyUuid , targetNodeUuid );
2214
2233
2215
- invalidateNodeTree (studyUuid , originNodeUuid );
2216
- if (isTargetInDifferentNodeTree ) {
2217
- invalidateNodeTreeWithLF (studyUuid , targetNodeUuid , ComputationsInvalidationMode .ALL );
2218
- }
2219
-
2220
2234
StudyEntity studyEntity = studyRepository .findById (studyUuid ).orElseThrow (() -> new StudyException (STUDY_NOT_FOUND ));
2221
2235
List <RootNetworkEntity > studyRootNetworkEntities = studyEntity .getRootNetworks ();
2222
2236
UUID originGroupUuid = networkModificationTreeService .getModificationGroupUuid (originNodeUuid );
@@ -2234,10 +2248,6 @@ public void moveNetworkModifications(UUID studyUuid, UUID targetNodeUuid, UUID o
2234
2248
emitNetworkModificationImpactsForAllRootNetworks (networkModificationsResult .modificationResults (), studyEntity , targetNodeUuid );
2235
2249
}
2236
2250
} finally {
2237
- invalidateBlockedBuildNodeTree (studyUuid , originNodeUuid );
2238
- if (isTargetInDifferentNodeTree ) {
2239
- invalidateBlockedBuildNodeTree (studyUuid , targetNodeUuid );
2240
- }
2241
2251
notificationService .emitEndModificationEquipmentNotification (studyUuid , targetNodeUuid , childrenUuids );
2242
2252
if (isTargetDifferentNode ) {
2243
2253
notificationService .emitEndModificationEquipmentNotification (studyUuid , originNodeUuid , originNodeChildrenUuids );
@@ -2265,8 +2275,6 @@ public void duplicateOrInsertNetworkModifications(UUID studyUuid, UUID targetNod
2265
2275
try {
2266
2276
checkStudyContainsNode (studyUuid , targetNodeUuid );
2267
2277
2268
- invalidateNodeTreeWithLF (studyUuid , targetNodeUuid , ComputationsInvalidationMode .ALL );
2269
-
2270
2278
List <RootNetworkEntity > studyRootNetworkEntities = getStudyRootNetworks (studyUuid );
2271
2279
UUID groupUuid = networkModificationTreeService .getModificationGroupUuid (targetNodeUuid );
2272
2280
@@ -2295,7 +2303,6 @@ public void duplicateOrInsertNetworkModifications(UUID studyUuid, UUID targetNod
2295
2303
}
2296
2304
2297
2305
} finally {
2298
- invalidateBlockedBuildNodeTree (studyUuid , targetNodeUuid );
2299
2306
notificationService .emitEndModificationEquipmentNotification (studyUuid , targetNodeUuid , childrenUuids );
2300
2307
}
2301
2308
notificationService .emitElementUpdated (studyUuid , userId );
0 commit comments