Skip to content

Commit

Permalink
[Fix apache#3390] Do not create container instance, search it
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Mar 8, 2024
1 parent f04c2a3 commit c705786
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 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()
.post("/division/{id}", id)
.then().statusCode(404);
}

}

0 comments on commit c705786

Please sign in to comment.