Search in sources :

Example 1 with NodeInstanceNotFoundException

use of io.automatiko.engine.api.workflow.NodeInstanceNotFoundException in project automatiko-engine by automatiko-io.

the class NodeInstanceNotFoundExceptionMapper method toResponse.

@Override
public Response toResponse(NodeInstanceNotFoundException ex) {
    NodeInstanceNotFoundException exception = (NodeInstanceNotFoundException) ex;
    Map<String, String> response = new HashMap<>();
    response.put(MESSAGE, exception.getMessage());
    response.put(PROCESS_INSTANCE_ID, exception.getProcessInstanceId());
    response.put(NODE_INSTANCE_ID, exception.getNodeInstanceId());
    return notFound(response);
}
Also used : HashMap(java.util.HashMap) NodeInstanceNotFoundException(io.automatiko.engine.api.workflow.NodeInstanceNotFoundException)

Example 2 with NodeInstanceNotFoundException

use of io.automatiko.engine.api.workflow.NodeInstanceNotFoundException in project automatiko-engine by automatiko-io.

the class AbstractProcessInstance method cancelNodeInstance.

@Override
public void cancelNodeInstance(String nodeInstanceId) {
    lock();
    NodeInstance nodeInstance = ((WorkflowProcessInstanceImpl) processInstance()).getNodeInstances(true).stream().filter(ni -> ni.getId().equals(nodeInstanceId)).findFirst().orElseThrow(() -> new NodeInstanceNotFoundException(this.id, nodeInstanceId));
    nodeInstance.cancel();
    removeOnFinish();
}
Also used : NodeInstanceNotFoundException(io.automatiko.engine.api.workflow.NodeInstanceNotFoundException) WorkflowProcessInstanceImpl(io.automatiko.engine.workflow.process.instance.impl.WorkflowProcessInstanceImpl) CompositeContextNodeInstance(io.automatiko.engine.workflow.process.instance.node.CompositeContextNodeInstance) EventSubProcessNodeInstance(io.automatiko.engine.workflow.process.instance.node.EventSubProcessNodeInstance) HumanTaskNodeInstance(io.automatiko.engine.workflow.process.instance.node.HumanTaskNodeInstance) WorkItemNodeInstance(io.automatiko.engine.workflow.process.instance.node.WorkItemNodeInstance) NodeInstance(io.automatiko.engine.workflow.process.instance.NodeInstance) LambdaSubProcessNodeInstance(io.automatiko.engine.workflow.process.instance.node.LambdaSubProcessNodeInstance)

Example 3 with NodeInstanceNotFoundException

use of io.automatiko.engine.api.workflow.NodeInstanceNotFoundException in project automatiko-engine by automatiko-io.

the class AbstractProcessInstance method retriggerNodeInstance.

@Override
public void retriggerNodeInstance(String nodeInstanceId) {
    lock();
    NodeInstance nodeInstance = ((WorkflowProcessInstanceImpl) processInstance()).getNodeInstances(true).stream().filter(ni -> ni.getId().equals(nodeInstanceId)).findFirst().orElseThrow(() -> new NodeInstanceNotFoundException(this.id, nodeInstanceId));
    ((NodeInstanceImpl) nodeInstance).retrigger(true);
    removeOnFinish();
}
Also used : NodeInstanceImpl(io.automatiko.engine.workflow.process.instance.impl.NodeInstanceImpl) NodeInstanceNotFoundException(io.automatiko.engine.api.workflow.NodeInstanceNotFoundException) WorkflowProcessInstanceImpl(io.automatiko.engine.workflow.process.instance.impl.WorkflowProcessInstanceImpl) CompositeContextNodeInstance(io.automatiko.engine.workflow.process.instance.node.CompositeContextNodeInstance) EventSubProcessNodeInstance(io.automatiko.engine.workflow.process.instance.node.EventSubProcessNodeInstance) HumanTaskNodeInstance(io.automatiko.engine.workflow.process.instance.node.HumanTaskNodeInstance) WorkItemNodeInstance(io.automatiko.engine.workflow.process.instance.node.WorkItemNodeInstance) NodeInstance(io.automatiko.engine.workflow.process.instance.NodeInstance) LambdaSubProcessNodeInstance(io.automatiko.engine.workflow.process.instance.node.LambdaSubProcessNodeInstance)

Example 4 with NodeInstanceNotFoundException

use of io.automatiko.engine.api.workflow.NodeInstanceNotFoundException in project automatiko-engine by automatiko-io.

the class BaseExceptionHandlerTest method testMapNodeInstanceNotFoundException.

@Test
void testMapNodeInstanceNotFoundException() {
    Object response = tested.mapException(new NodeInstanceNotFoundException("processInstanceId", "nodeInstanceId"));
    assertThat(response).isEqualTo(notFoundResponse);
}
Also used : NodeInstanceNotFoundException(io.automatiko.engine.api.workflow.NodeInstanceNotFoundException) Test(org.junit.jupiter.api.Test)

Aggregations

NodeInstanceNotFoundException (io.automatiko.engine.api.workflow.NodeInstanceNotFoundException)4 NodeInstance (io.automatiko.engine.workflow.process.instance.NodeInstance)2 WorkflowProcessInstanceImpl (io.automatiko.engine.workflow.process.instance.impl.WorkflowProcessInstanceImpl)2 CompositeContextNodeInstance (io.automatiko.engine.workflow.process.instance.node.CompositeContextNodeInstance)2 EventSubProcessNodeInstance (io.automatiko.engine.workflow.process.instance.node.EventSubProcessNodeInstance)2 HumanTaskNodeInstance (io.automatiko.engine.workflow.process.instance.node.HumanTaskNodeInstance)2 LambdaSubProcessNodeInstance (io.automatiko.engine.workflow.process.instance.node.LambdaSubProcessNodeInstance)2 WorkItemNodeInstance (io.automatiko.engine.workflow.process.instance.node.WorkItemNodeInstance)2 NodeInstanceImpl (io.automatiko.engine.workflow.process.instance.impl.NodeInstanceImpl)1 HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1