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);
}
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();
}
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();
}
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);
}
Aggregations