use of io.automatiko.engine.api.event.process.ProcessEventListener in project automatiko-engine by automatiko-io.
the class ProcessEventSupport method fireBeforeSLAViolated.
public void fireBeforeSLAViolated(final ProcessInstance instance, ProcessRuntime runtime) {
final Iterator<ProcessEventListener> iter = getEventListenersIterator();
final List<ProcessEventListener> delayedListeners = new ArrayList<ProcessEventListener>();
final SLAViolatedEvent event = new SLAViolatedEventImpl(instance, runtime);
if (iter.hasNext()) {
do {
ProcessEventListener listener = iter.next();
if (listener instanceof DelayedExecution) {
delayedListeners.add(listener);
} else {
listener.beforeSLAViolated(event);
}
} while (iter.hasNext());
}
unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, e -> {
delayedListeners.forEach(l -> l.beforeSLAViolated(e));
}));
}
use of io.automatiko.engine.api.event.process.ProcessEventListener in project automatiko-engine by automatiko-io.
the class ProcessEventSupport method fireBeforeSLAViolated.
public void fireBeforeSLAViolated(final ProcessInstance instance, NodeInstance nodeInstance, ProcessRuntime runtime) {
final Iterator<ProcessEventListener> iter = getEventListenersIterator();
final List<ProcessEventListener> delayedListeners = new ArrayList<ProcessEventListener>();
final SLAViolatedEvent event = new SLAViolatedEventImpl(instance, nodeInstance, runtime);
if (iter.hasNext()) {
do {
ProcessEventListener listener = iter.next();
if (listener instanceof DelayedExecution) {
delayedListeners.add(listener);
} else {
listener.beforeSLAViolated(event);
}
} while (iter.hasNext());
}
unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, e -> {
delayedListeners.forEach(l -> l.beforeSLAViolated(e));
}));
}
use of io.automatiko.engine.api.event.process.ProcessEventListener in project automatiko-engine by automatiko-io.
the class ProcessEventSupport method fireBeforeProcessSignaled.
public void fireBeforeProcessSignaled(String signal, Object data, final ProcessInstance instance, ProcessRuntime runtime) {
final Iterator<ProcessEventListener> iter = getEventListenersIterator();
final List<ProcessEventListener> delayedListeners = new ArrayList<ProcessEventListener>();
final ProcessSignaledEvent event = new ProcessSignaledEventImpl(signal, data, instance, runtime);
if (iter.hasNext()) {
do {
ProcessEventListener listener = iter.next();
if (listener instanceof DelayedExecution) {
delayedListeners.add(listener);
} else {
listener.beforeProcessSignaled(event);
}
} while (iter.hasNext());
}
unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, (e) -> {
delayedListeners.forEach(l -> l.beforeProcessSignaled(e));
}));
}
use of io.automatiko.engine.api.event.process.ProcessEventListener in project automatiko-engine by automatiko-io.
the class ProcessEventSupport method fireBeforeNodeLeft.
public void fireBeforeNodeLeft(final NodeInstance nodeInstance, ProcessRuntime runtime) {
final Iterator<ProcessEventListener> iter = getEventListenersIterator();
final List<ProcessEventListener> delayedListeners = new ArrayList<ProcessEventListener>();
final ProcessNodeLeftEvent event = new ProcessNodeLeftEventImpl(nodeInstance, runtime);
if (iter.hasNext()) {
do {
ProcessEventListener listener = iter.next();
if (listener instanceof DelayedExecution) {
delayedListeners.add(listener);
} else {
listener.beforeNodeLeft(event);
}
} while (iter.hasNext());
}
unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, e -> {
delayedListeners.forEach(l -> l.beforeNodeLeft(e));
}));
}
Aggregations