Skip to content

Commit

Permalink
[Fix #3390] Do not create container instance, search it (#3432)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado authored Mar 11, 2024
1 parent ccdd173 commit 5728052
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jbpm.workflow.core.node.AsyncEventNode;
import org.kie.api.definition.process.Node;
import org.kie.api.definition.process.NodeContainer;
import org.kie.kogito.internal.process.runtime.KogitoNodeInstance;
import org.kie.kogito.internal.process.runtime.KogitoNodeInstanceContainer;

import static org.jbpm.ruleflow.core.Metadata.CUSTOM_ASYNC;
Expand Down Expand Up @@ -64,7 +65,12 @@ default NodeInstance getByNodeDefinitionId(final String nodeDefinitionId, NodeCo

if (nodeDefinitionId.equals(node.getMetaData().get(UNIQUE_ID))) {
if (nodeContainer instanceof Node) {
return ((NodeInstanceContainer) getNodeInstance((Node) nodeContainer)).getNodeInstance(node);
Collection<KogitoNodeInstance> nodeInstances = getKogitoNodeInstances(ni -> ni.getNode().getId() == (((Node) nodeContainer).getId()), true);
if (nodeInstances.isEmpty()) {
return ((NodeInstanceContainer) getNodeInstance((Node) nodeContainer)).getNodeInstance(node);
} else {
return ((NodeInstanceContainer) nodeInstances.iterator().next()).getNodeInstance(node);
}
} else {
return getNodeInstance(node);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ void testRetrigger() {
.accept(ContentType.JSON).when()
.post("/management/processes/division/instances/{id}/retrigger", id)
.then().statusCode(200).body("workflowdata.response", is(2));

given()
.contentType(ContentType.JSON)
.accept(ContentType.JSON).when()
.get("/division/{id}", id)
.then().statusCode(404);
}

}

0 comments on commit 5728052

Please sign in to comment.