use of org.drools.core.process.instance.WorkItem in project drools by kiegroup.
the class JPAWorkItemManager method retryWorkItem.
public void retryWorkItem(long workItemId) {
WorkItem workItem = getWorkItem(workItemId);
retryWorkItem(workItem);
}
use of org.drools.core.process.instance.WorkItem in project drools by kiegroup.
the class JPAWorkItemManager method completeWorkItem.
public void completeWorkItem(long id, Map<String, Object> results) {
PersistenceContext context = getPersistenceContext();
WorkItemInfo workItemInfo = null;
if (this.workItems != null) {
workItemInfo = this.workItems.get(id);
if (workItemInfo != null) {
workItemInfo = (WorkItemInfo) context.merge(workItemInfo);
}
}
if (workItemInfo == null) {
workItemInfo = (WorkItemInfo) context.findWorkItem(id);
}
// work item may have been aborted
if (workItemInfo != null) {
WorkItem workItem = internalGetWorkItem(workItemInfo);
workItem.setResults(results);
ProcessInstance processInstance = kruntime.getProcessInstance(workItem.getProcessInstanceId());
workItem.setState(WorkItem.COMPLETED);
// process instance may have finished already
if (processInstance != null) {
processInstance.signalEvent("workItemCompleted", workItem);
}
context.remove(workItemInfo);
if (workItems != null) {
this.workItems.remove(workItem.getId());
}
}
}
use of org.drools.core.process.instance.WorkItem in project drools by kiegroup.
the class JPAWorkItemManager method retryWorkItemWithParams.
public void retryWorkItemWithParams(long workItemId, Map<String, Object> map) {
Environment env = this.kruntime.getEnvironment();
WorkItem workItem = getWorkItem(workItemId);
if (workItem != null) {
workItem.setParameters(map);
WorkItemInfo workItemInfo = new WorkItemInfo(workItem, env);
PersistenceContext context = getPersistenceContext();
context.merge(workItemInfo);
retryWorkItem(workItem);
}
}
use of org.drools.core.process.instance.WorkItem in project drools by kiegroup.
the class DefaultWorkItemManager method completeWorkItem.
public void completeWorkItem(long id, Map<String, Object> results) {
WorkItem workItem = workItems.get(new Long(id));
// work item may have been aborted
if (workItem != null) {
(workItem).setResults(results);
ProcessInstance processInstance = kruntime.getProcessInstance(workItem.getProcessInstanceId());
(workItem).setState(WorkItem.COMPLETED);
// process instance may have finished already
if (processInstance != null) {
processInstance.signalEvent("workItemCompleted", workItem);
}
workItems.remove(new Long(id));
}
}
use of org.drools.core.process.instance.WorkItem in project drools by kiegroup.
the class GetWorkItemIdsCommand method execute.
public List<Long> execute(Context context) {
KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
Set<WorkItem> workItems = ((WorkItemManager) ksession.getWorkItemManager()).getWorkItems();
List<Long> workItemIds = new ArrayList<Long>(workItems.size());
for (WorkItem workItem : workItems) {
workItemIds.add(workItem.getId());
}
return workItemIds;
}
Aggregations