Skip to content

Commit

Permalink
fix(core): added raw setter for app not to override jackson setters
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mulier-p committed Sep 14, 2023
1 parent db995d4 commit 94f5b1d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ public AbstractGraph(String uid) {
public String getLabel() {
return this.getUid();
}

public void updateUidWithChildren(String uid) {
this.uid = uid;
}

public void updateErrorWithChildren(boolean error) {
this.error = error;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void addNode(AbstractGraph node) {

public void addNode(AbstractGraph node, boolean withClusterUidPrefix) {
if (withClusterUidPrefix) {
node.setUid(prefixedUid(node.uid));
node.updateUidWithChildren(prefixedUid(node.uid));
}
this.getGraph().addNode(node);
}
Expand Down Expand Up @@ -104,21 +104,19 @@ public String getUid() {
}

@Override
@JsonIgnore
public void setUid(String uid) {
public void updateUidWithChildren(String uid) {
graph.nodes().stream().filter(node ->
// filter other clusters' root & end to prevent setting uid multiple times
// this is because we need other clusters' root & end to have edges over them, but they are already managed by their own cluster
(!(node instanceof GraphClusterRoot) && !(node instanceof GraphClusterEnd))
|| node.equals(this.root) || node.equals(this.end))
.forEach(node -> node.setUid(uid + node.uid.substring(this.uid.length())));
.forEach(node -> node.updateUidWithChildren(uid + node.uid.substring(this.uid.length())));

super.setUid(uid);
super.updateUidWithChildren(uid);
}

@Override
@JsonIgnore
public void setError(boolean error) {
public void updateErrorWithChildren(boolean error) {
this.error = error;

this.taskNode.error = error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void replace() {
parentCluster.getGraph().removeNode(taskToReplace);

if (taskToReplace.isError()) {
clusterForReplacement.setError(true);
clusterForReplacement.updateErrorWithChildren(true);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/kestra/core/utils/GraphUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private static void fillGraph(
graph.addNode(currentGraph);

if (relationType == RelationType.ERROR) {
currentGraph.setError(true);
currentGraph.updateErrorWithChildren(true);
if (isFirst) {
previous = graph.getRoot();
}
Expand Down

0 comments on commit 94f5b1d

Please sign in to comment.