use of io.automatiko.engine.api.runtime.process.WorkItem in project automatiko-engine by automatiko-io.
the class UIWorkItemHandler method reloadWorkItemsList.
private void reloadWorkItemsList() {
List<WorkItemWrapper> result = new ArrayList<WorkItemWrapper>();
for (Iterator<WorkItem> iterator = workItems.keySet().iterator(); iterator.hasNext(); ) {
WorkItem workItem = iterator.next();
result.add(new WorkItemWrapper(workItem));
}
workItemsList.setListData(result.toArray());
}
use of io.automatiko.engine.api.runtime.process.WorkItem in project automatiko-engine by automatiko-io.
the class DefaultWorkItemManager method retryWorkItem.
public void retryWorkItem(String workItemId) {
WorkItem workItem = workItems.get(workItemId);
retryWorkItem(workItem);
}
use of io.automatiko.engine.api.runtime.process.WorkItem in project automatiko-engine by automatiko-io.
the class DefaultWorkItemManager method completeWorkItem.
public void completeWorkItem(String id, Map<String, Object> results, Policy<?>... policies) {
WorkItem workItem = workItems.get(id);
// work item may have been aborted
if (workItem != null) {
((WorkItemImpl) workItem).setResults(results);
ProcessInstance processInstance = runtime.getProcessInstance(workItem.getProcessInstanceId());
((WorkItemImpl) workItem).setState(COMPLETED);
// process instance may have finished already
if (processInstance != null) {
processInstance.signalEvent("workItemCompleted", workItem);
}
workItems.remove(id);
}
}
use of io.automatiko.engine.api.runtime.process.WorkItem in project automatiko-engine by automatiko-io.
the class ProcessEventSupport method fireBeforeWorkItemTransition.
public void fireBeforeWorkItemTransition(final ProcessInstance instance, WorkItem workitem, Transition<?> transition, ProcessRuntime runtime) {
final Iterator<ProcessEventListener> iter = getEventListenersIterator();
final List<ProcessEventListener> delayedListeners = new ArrayList<ProcessEventListener>();
final ProcessWorkItemTransitionEvent event = new ProcessWorkItemTransitionEventImpl(instance, workitem, transition, runtime, false);
if (iter.hasNext()) {
do {
ProcessEventListener listener = iter.next();
if (listener instanceof DelayedExecution) {
delayedListeners.add(listener);
} else {
listener.beforeWorkItemTransition(event);
}
} while (iter.hasNext());
}
unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, (e) -> {
delayedListeners.forEach(l -> l.beforeWorkItemTransition(e));
}));
}
use of io.automatiko.engine.api.runtime.process.WorkItem in project automatiko-engine by automatiko-io.
the class LightWorkItemManager method retryWorkItem.
public void retryWorkItem(String workItemId) {
WorkItem workItem = workItems.get(workItemId);
retryWorkItem(workItem);
}
Aggregations