Search in sources :

Example 1 with ProcessWorkItemHandlerException

use of io.automatiko.engine.api.runtime.process.ProcessWorkItemHandlerException in project automatiko-engine by automatiko-io.

the class WorkItemNodeInstance method internalTrigger.

@Override
public void internalTrigger(final NodeInstance from, String type) {
    super.internalTrigger(from, type);
    // if node instance was cancelled, abort
    if (getNodeInstanceContainer().getNodeInstance(getId()) == null) {
        return;
    }
    WorkItemNode workItemNode = getWorkItemNode();
    createWorkItem(workItemNode);
    if (workItemNode.isWaitForCompletion()) {
        addWorkItemListener();
    }
    ((WorkItemImpl) workItem).setNodeInstanceId(this.getId());
    ((WorkItemImpl) workItem).setNodeId(getNodeId());
    workItem.setNodeInstance(this);
    workItem.setProcessInstance(getProcessInstance());
    setProcessId();
    try {
        ((DefaultWorkItemManager) getProcessInstance().getProcessRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);
    } catch (WorkItemHandlerNotFoundException wihnfe) {
        getProcessInstance().setState(STATE_ABORTED);
        throw wihnfe;
    } catch (ProcessWorkItemHandlerException handlerException) {
        this.workItemId = workItem.getId();
        removeEventListeners();
        handleWorkItemHandlerException(handlerException, workItem);
    } catch (WorkItemExecutionError e) {
        removeEventListeners();
        handleException(e.getErrorCode(), e);
    } catch (Exception e) {
        removeEventListeners();
        String exceptionName = e.getClass().getName();
        handleException(exceptionName, e);
    }
    if (!workItemNode.isWaitForCompletion()) {
        triggerCompleted();
    }
    this.workItemId = workItem.getId();
}
Also used : DefaultWorkItemManager(io.automatiko.engine.workflow.base.instance.impl.workitem.DefaultWorkItemManager) WorkItemNode(io.automatiko.engine.workflow.process.core.node.WorkItemNode) WorkItemImpl(io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl) WorkItemHandlerNotFoundException(io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemHandlerNotFoundException) ProcessWorkItemHandlerException(io.automatiko.engine.api.runtime.process.ProcessWorkItemHandlerException) WorkItemExecutionError(io.automatiko.engine.api.workflow.workitem.WorkItemExecutionError) WorkItemHandlerNotFoundException(io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemHandlerNotFoundException) ProcessWorkItemHandlerException(io.automatiko.engine.api.runtime.process.ProcessWorkItemHandlerException) WorkflowRuntimeException(io.automatiko.engine.workflow.process.instance.WorkflowRuntimeException)

Aggregations

ProcessWorkItemHandlerException (io.automatiko.engine.api.runtime.process.ProcessWorkItemHandlerException)1 WorkItemExecutionError (io.automatiko.engine.api.workflow.workitem.WorkItemExecutionError)1 DefaultWorkItemManager (io.automatiko.engine.workflow.base.instance.impl.workitem.DefaultWorkItemManager)1 WorkItemHandlerNotFoundException (io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemHandlerNotFoundException)1 WorkItemImpl (io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl)1 WorkItemNode (io.automatiko.engine.workflow.process.core.node.WorkItemNode)1 WorkflowRuntimeException (io.automatiko.engine.workflow.process.instance.WorkflowRuntimeException)1