@@ -1769,6 +1769,24 @@ public void deleteNodeResults(InvalidateNodeInfos invalidateNodeInfos) {
1769
1769
1770
1770
}
1771
1771
1772
+ //OldName: invalidateBuild part 2
1773
+ // this is used to unbuild the node and its children
1774
+ public void unbuildNodeTree (UUID studyUuid , UUID nodeUuid , UUID rootNetworkUuid ) {
1775
+ AtomicReference <Long > startTime = new AtomicReference <>(null );
1776
+ startTime .set (System .nanoTime ());
1777
+ InvalidateNodeInfos invalidateNodeInfos = new InvalidateNodeInfos ();
1778
+ invalidateNodeInfos .setNetworkUuid (rootNetworkService .getNetworkUuid (rootNetworkUuid ));
1779
+
1780
+ //TODO: change invalidateBuild methode later
1781
+ networkModificationTreeService .invalidateBuild (nodeUuid , rootNetworkUuid , false , invalidateNodeInfos , true );
1782
+ deleteNodeResults (invalidateNodeInfos );
1783
+
1784
+ if (startTime .get () != null ) {
1785
+ LOGGER .trace ("unbuild node '{}' of study '{}' : {} seconds" , nodeUuid , studyUuid ,
1786
+ TimeUnit .NANOSECONDS .toSeconds (System .nanoTime () - startTime .get ()));
1787
+ }
1788
+ }
1789
+
1772
1790
private void updateStatuses (UUID studyUuid , UUID nodeUuid ) {
1773
1791
updateStatuses (studyUuid , nodeUuid , true );
1774
1792
}
@@ -1957,9 +1975,7 @@ public void stashNode(UUID studyUuid, UUID nodeId, boolean stashChildren, String
1957
1975
AtomicReference <Long > startTime = new AtomicReference <>(null );
1958
1976
startTime .set (System .nanoTime ());
1959
1977
boolean invalidateChildrenBuild = stashChildren || networkModificationTreeService .hasModifications (nodeId , false );
1960
- getStudyRootNetworks (studyUuid ).forEach (rootNetworkEntity ->
1961
- invalidateBuild (studyUuid , nodeId , rootNetworkEntity .getId (), false , !invalidateChildrenBuild , true )
1962
- );
1978
+ unbuildStashedNode (studyUuid , nodeId , invalidateChildrenBuild );
1963
1979
networkModificationTreeService .doStashNode (nodeId , stashChildren );
1964
1980
1965
1981
if (startTime .get () != null ) {
@@ -1970,6 +1986,23 @@ public void stashNode(UUID studyUuid, UUID nodeId, boolean stashChildren, String
1970
1986
notificationService .emitElementUpdated (studyUuid , userId );
1971
1987
}
1972
1988
1989
+ public void unbuildStashedNode (UUID studyUuid , UUID nodeId , boolean stashChildren ) {
1990
+ //two case scenario:
1991
+ // one node stashed -> unbuild the node
1992
+ // a node and its children are stashed -> unbuild all of them
1993
+ boolean invalidateChildrenBuild = stashChildren || networkModificationTreeService .hasModifications (nodeId , false );
1994
+ List <RootNetworkEntity > studyRootNetworks = getStudyRootNetworks (studyUuid );
1995
+ if (invalidateChildrenBuild ) {
1996
+ studyRootNetworks .forEach (rootNetworkEntity -> {
1997
+ unbuildNodeTree (studyUuid , nodeId , rootNetworkEntity .getId ());
1998
+ });
1999
+ } else {
2000
+ studyRootNetworks .forEach (rootNetworkEntity -> {
2001
+ unbuildStudyNode (studyUuid , nodeId , rootNetworkEntity .getId ());
2002
+ });
2003
+ }
2004
+ }
2005
+
1973
2006
public List <Pair <AbstractNode , Integer >> getStashedNodes (UUID studyId ) {
1974
2007
return networkModificationTreeService .getStashedNodes (studyId );
1975
2008
}
0 commit comments