@@ -35,13 +35,12 @@ private List<PipelineStageInternal> getPipelineNodes() {
3535 }
3636
3737 return new PipelineStageInternal (
38- Integer .parseInt (
39- flowNodeWrapper
40- .getId ()), // TODO no need to parse it BO returns a string even though the
38+ flowNodeWrapper
39+ .getId (), // TODO no need to parse it BO returns a string even though the
4140 // datatype is number on the frontend
4241 flowNodeWrapper .getDisplayName (),
4342 flowNodeWrapper .getParents ().stream ()
44- .map (wrapper -> Integer . parseInt ( wrapper . getId ()) )
43+ .map (FlowNodeWrapper :: getId )
4544 .collect (Collectors .toList ()),
4645 state ,
4746 50 , // TODO how ???
@@ -57,32 +56,32 @@ public PipelineGraph createGraph() {
5756 List <PipelineStageInternal > stages = getPipelineNodes ();
5857
5958 // id => stage
60- Map <Integer , PipelineStageInternal > stageMap =
59+ Map <String , PipelineStageInternal > stageMap =
6160 stages .stream ()
6261 .collect (
6362 Collectors .toMap (
6463 PipelineStageInternal ::getId , stage -> stage , (u , v ) -> u , LinkedHashMap ::new ));
6564
66- Map <Integer , List <Integer >> stageToChildrenMap = new HashMap <>();
65+ Map <String , List <String >> stageToChildrenMap = new HashMap <>();
6766
68- List <Integer > stagesThatAreNested = new ArrayList <>();
67+ List <String > stagesThatAreNested = new ArrayList <>();
6968
70- Map <Integer , Integer > nextSiblingToOlderSibling = new HashMap <>();
69+ Map <String , String > nextSiblingToOlderSibling = new HashMap <>();
7170
72- List <Integer > stagesThatAreChildrenOrNestedStages = new ArrayList <>();
71+ List <String > stagesThatAreChildrenOrNestedStages = new ArrayList <>();
7372 stages .forEach (
7473 stage -> {
7574 if (stage .getParents ().isEmpty ()) {
7675 stageToChildrenMap .put (stage .getId (), new ArrayList <>());
7776 } else if (stage .getType ().equals ("PARALLEL" )) {
78- Integer parentId = stage .getParents ().get (0 ); // assume one parent for now
79- List <Integer > childrenOfParent =
77+ String parentId = stage .getParents ().get (0 ); // assume one parent for now
78+ List <String > childrenOfParent =
8079 stageToChildrenMap .getOrDefault (parentId , new ArrayList <>());
8180 childrenOfParent .add (stage .getId ());
8281 stageToChildrenMap .put (parentId , childrenOfParent );
8382 stagesThatAreChildrenOrNestedStages .add (stage .getId ());
8483 } else if (stageMap .get (stage .getParents ().get (0 )).getType ().equals ("PARALLEL" )) {
85- Integer parentId = stage .getParents ().get (0 );
84+ String parentId = stage .getParents ().get (0 );
8685 PipelineStageInternal parent = stageMap .get (parentId );
8786 parent .setSeqContainerName (parent .getName ());
8887 parent .setName (stage .getName ());
@@ -130,12 +129,11 @@ public PipelineGraph createGraph() {
130129 return new PipelineGraph (stageResults , execution != null && execution .isComplete ());
131130 }
132131
133- private Function <Integer , PipelineStage > mapper (
134- Map <Integer , PipelineStageInternal > stageMap ,
135- Map <Integer , List <Integer >> stageToChildrenMap ) {
132+ private Function <String , PipelineStage > mapper (
133+ Map <String , PipelineStageInternal > stageMap , Map <String , List <String >> stageToChildrenMap ) {
136134
137135 return id -> {
138- List <Integer > orDefault = stageToChildrenMap .getOrDefault (id , emptyList ());
136+ List <String > orDefault = stageToChildrenMap .getOrDefault (id , emptyList ());
139137 List <PipelineStage > children =
140138 orDefault .stream ().map (mapper (stageMap , stageToChildrenMap )).collect (Collectors .toList ());
141139 return stageMap .get (id ).toPipelineStage (children );
@@ -148,16 +146,16 @@ private Function<Integer, PipelineStage> mapper(
148146 */
149147 public PipelineGraph createTree () {
150148 List <PipelineStageInternal > stages = getPipelineNodes ();
151- List <Integer > topLevelStageIds = new ArrayList <>();
149+ List <String > topLevelStageIds = new ArrayList <>();
152150
153151 // id => stage
154- Map <Integer , PipelineStageInternal > stageMap =
152+ Map <String , PipelineStageInternal > stageMap =
155153 stages .stream ()
156154 .collect (
157155 Collectors .toMap (
158156 PipelineStageInternal ::getId , stage -> stage , (u , v ) -> u , LinkedHashMap ::new ));
159157
160- Map <Integer , List <Integer >> stageToChildrenMap = new HashMap <>();
158+ Map <String , List <String >> stageToChildrenMap = new HashMap <>();
161159
162160 FlowExecution execution = run .getExecution ();
163161 if (execution == null ) {
@@ -168,25 +166,25 @@ public PipelineGraph createTree() {
168166 stages .forEach (
169167 stage -> {
170168 try {
171- FlowNode stageNode = execution .getNode (Integer . toString ( stage .getId () ));
169+ FlowNode stageNode = execution .getNode (stage .getId ());
172170 if (stageNode == null ) {
173171 return ;
174172 }
175- List <Integer > ancestors = getAncestors (stage , stageMap );
176- Integer treeParentId = null ;
173+ List <String > ancestors = getAncestors (stage , stageMap );
174+ String treeParentId = null ;
177175 // Compare the list of GraphVistor ancestors to the IDs of the enclosing node in the
178176 // execution.
179177 // If a node encloses another node, it means it's a tree parent, so the first ancestor
180178 // ID we find
181179 // which matches an enclosing node then it's the stages tree parent.
182- for (Integer ancestorId : ancestors ) {
183- if (stageNode .getAllEnclosingIds ().contains (Integer . toString ( ancestorId ) )) {
180+ for (String ancestorId : ancestors ) {
181+ if (stageNode .getAllEnclosingIds ().contains (ancestorId )) {
184182 treeParentId = ancestorId ;
185183 break ;
186184 }
187185 }
188186 if (treeParentId != null ) {
189- List <Integer > childrenOfParent =
187+ List <String > childrenOfParent =
190188 stageToChildrenMap .getOrDefault (treeParentId , new ArrayList <>());
191189 childrenOfParent .add (stage .getId ());
192190 stageToChildrenMap .put (treeParentId , childrenOfParent );
@@ -223,11 +221,11 @@ public PipelineGraph createTree() {
223221 return new PipelineGraph (stageResults , execution .isComplete ());
224222 }
225223
226- private List <Integer > getAncestors (
227- PipelineStageInternal stage , Map <Integer , PipelineStageInternal > stageMap ) {
228- List <Integer > ancestors = new ArrayList <>();
224+ private List <String > getAncestors (
225+ PipelineStageInternal stage , Map <String , PipelineStageInternal > stageMap ) {
226+ List <String > ancestors = new ArrayList <>();
229227 if (!stage .getParents ().isEmpty ()) {
230- Integer parentId = stage .getParents ().get (0 ); // Assume one parent.
228+ String parentId = stage .getParents ().get (0 ); // Assume one parent.
231229 ancestors .add (parentId );
232230 if (stageMap .containsKey (parentId )) {
233231 PipelineStageInternal parent = stageMap .get (parentId );
0 commit comments