use of io.automatiko.engine.api.workflow.NodeNotFoundException in project automatiko-engine by automatiko-io.
the class NodeNotFoundExceptionMapper method toResponse.
@Override
public Response toResponse(NodeNotFoundException ex) {
NodeNotFoundException exception = (NodeNotFoundException) ex;
Map<String, String> response = new HashMap<>();
response.put(MESSAGE, exception.getMessage());
response.put(PROCESS_INSTANCE_ID, exception.getProcessInstanceId());
response.put(NODE_ID, exception.getNodeId());
return notFound(response);
}
use of io.automatiko.engine.api.workflow.NodeNotFoundException in project automatiko-engine by automatiko-io.
the class AbstractProcessInstance method triggerNode.
@Override
public void triggerNode(String nodeId) {
lock();
WorkflowProcessInstanceImpl wfpi = ((WorkflowProcessInstanceImpl) processInstance());
ExecutableProcess rfp = ((ExecutableProcess) wfpi.getProcess());
Node node = rfp.getNodesRecursively().stream().filter(ni -> nodeId.equals(ni.getMetaData().get("UniqueId"))).findFirst().orElseThrow(() -> new NodeNotFoundException(this.id, nodeId));
Node parentNode = rfp.getParentNode(node.getId());
NodeInstanceContainer nodeInstanceContainerNode = parentNode == null ? wfpi : ((NodeInstanceContainer) wfpi.getNodeInstance(parentNode));
if (nodeInstanceContainerNode.getNodeInstances().isEmpty() && nodeInstanceContainerNode instanceof CompositeContextNodeInstance) {
((CompositeContextNodeInstance) nodeInstanceContainerNode).internalTriggerOnlyParent(null, nodeId);
}
nodeInstanceContainerNode.getNodeInstance(node).trigger(null, io.automatiko.engine.workflow.process.core.Node.CONNECTION_DEFAULT_TYPE);
}
Aggregations