Search in sources :

Example 1 with ProcessNodeInstanceFailedEvent

use of io.automatiko.engine.api.event.process.ProcessNodeInstanceFailedEvent in project automatiko-engine by automatiko-io.

the class ProcessEventSupport method fireAfterNodeInstanceFailed.

public void fireAfterNodeInstanceFailed(final ProcessInstance instance, NodeInstance nodeInstance, String errorId, String errorMessage, Exception exception, ProcessRuntime runtime) {
    final Iterator<ProcessEventListener> iter = getEventListenersIterator();
    final List<ProcessEventListener> delayedListeners = new ArrayList<ProcessEventListener>();
    final ProcessNodeInstanceFailedEvent event = new ProcessNodeInstanceFailedEventImpl(instance, nodeInstance, errorId, errorMessage, exception, runtime);
    if (iter.hasNext()) {
        do {
            ProcessEventListener listener = iter.next();
            if (listener instanceof DelayedExecution) {
                delayedListeners.add(listener);
            } else {
                listener.afterNodeInstanceFailed(event);
            }
        } while (iter.hasNext());
    }
    unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, (e) -> {
        delayedListeners.forEach(l -> l.afterNodeInstanceFailed(e));
    }));
}
Also used : ProcessEventListener(io.automatiko.engine.api.event.process.ProcessEventListener) ProcessVariableChangedEvent(io.automatiko.engine.api.event.process.ProcessVariableChangedEvent) UnitOfWorkManager(io.automatiko.engine.api.uow.UnitOfWorkManager) DelayedExecution(io.automatiko.engine.api.event.process.DelayedExecution) ProcessNodeTriggeredEvent(io.automatiko.engine.api.event.process.ProcessNodeTriggeredEvent) WorkItem(io.automatiko.engine.api.runtime.process.WorkItem) Iterator(java.util.Iterator) ProcessNodeLeftEvent(io.automatiko.engine.api.event.process.ProcessNodeLeftEvent) ProcessSignaledEvent(io.automatiko.engine.api.event.process.ProcessSignaledEvent) ProcessStartedEvent(io.automatiko.engine.api.event.process.ProcessStartedEvent) NodeInstance(io.automatiko.engine.api.runtime.process.NodeInstance) ProcessRuntime(io.automatiko.engine.api.runtime.process.ProcessRuntime) ArrayList(java.util.ArrayList) WorkUnit(io.automatiko.engine.api.uow.WorkUnit) List(java.util.List) ProcessNodeInstanceFailedEvent(io.automatiko.engine.api.event.process.ProcessNodeInstanceFailedEvent) ProcessCompletedEvent(io.automatiko.engine.api.event.process.ProcessCompletedEvent) ProcessInstance(io.automatiko.engine.api.runtime.process.ProcessInstance) Transition(io.automatiko.engine.api.workflow.workitem.Transition) SLAViolatedEvent(io.automatiko.engine.api.event.process.SLAViolatedEvent) ProcessWorkItemTransitionEvent(io.automatiko.engine.api.event.process.ProcessWorkItemTransitionEvent) ProcessNodeInstanceFailedEvent(io.automatiko.engine.api.event.process.ProcessNodeInstanceFailedEvent) DelayedExecution(io.automatiko.engine.api.event.process.DelayedExecution) ProcessEventListener(io.automatiko.engine.api.event.process.ProcessEventListener) ArrayList(java.util.ArrayList)

Aggregations

DelayedExecution (io.automatiko.engine.api.event.process.DelayedExecution)1 ProcessCompletedEvent (io.automatiko.engine.api.event.process.ProcessCompletedEvent)1 ProcessEventListener (io.automatiko.engine.api.event.process.ProcessEventListener)1 ProcessNodeInstanceFailedEvent (io.automatiko.engine.api.event.process.ProcessNodeInstanceFailedEvent)1 ProcessNodeLeftEvent (io.automatiko.engine.api.event.process.ProcessNodeLeftEvent)1 ProcessNodeTriggeredEvent (io.automatiko.engine.api.event.process.ProcessNodeTriggeredEvent)1 ProcessSignaledEvent (io.automatiko.engine.api.event.process.ProcessSignaledEvent)1 ProcessStartedEvent (io.automatiko.engine.api.event.process.ProcessStartedEvent)1 ProcessVariableChangedEvent (io.automatiko.engine.api.event.process.ProcessVariableChangedEvent)1 ProcessWorkItemTransitionEvent (io.automatiko.engine.api.event.process.ProcessWorkItemTransitionEvent)1 SLAViolatedEvent (io.automatiko.engine.api.event.process.SLAViolatedEvent)1 NodeInstance (io.automatiko.engine.api.runtime.process.NodeInstance)1 ProcessInstance (io.automatiko.engine.api.runtime.process.ProcessInstance)1 ProcessRuntime (io.automatiko.engine.api.runtime.process.ProcessRuntime)1 WorkItem (io.automatiko.engine.api.runtime.process.WorkItem)1 UnitOfWorkManager (io.automatiko.engine.api.uow.UnitOfWorkManager)1 WorkUnit (io.automatiko.engine.api.uow.WorkUnit)1 Transition (io.automatiko.engine.api.workflow.workitem.Transition)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1