use of org.kie.kogito.process.workitem.HumanTaskWorkItem in project kogito-runtimes by kiegroup.
the class ProcessInstanceEventBatch method createUserTask.
protected UserTaskInstanceEventBody createUserTask(ProcessWorkItemTransitionEvent workItemTransitionEvent) {
KogitoWorkflowProcessInstance pi = (KogitoWorkflowProcessInstance) workItemTransitionEvent.getProcessInstance();
HumanTaskWorkItem workItem = (HumanTaskWorkItem) workItemTransitionEvent.getWorkItem();
return UserTaskInstanceEventBody.create().id(workItem.getStringId()).state(workItem.getPhaseStatus()).taskName(workItem.getTaskName()).taskDescription(workItem.getTaskDescription()).taskPriority(workItem.getTaskPriority()).referenceName(workItem.getReferenceName()).actualOwner(workItem.getActualOwner()).startDate(workItem.getStartDate()).completeDate(workItem.getCompleteDate()).adminGroups(workItem.getAdminGroups()).adminUsers(workItem.getAdminUsers()).excludedUsers(workItem.getExcludedUsers()).potentialGroups(workItem.getPotentialGroups()).potentialUsers(workItem.getPotentialUsers()).processInstanceId(pi.getStringId()).rootProcessInstanceId(pi.getRootProcessInstanceId()).processId(pi.getProcessId()).rootProcessId(pi.getRootProcessId()).inputs(workItem.getParameters()).outputs(workItem.getResults()).comments(workItem.getComments().values()).attachments(workItem.getAttachments().values()).build();
}
use of org.kie.kogito.process.workitem.HumanTaskWorkItem in project kogito-runtimes by kiegroup.
the class KogitoProcessEventSupportImpl method fireTaskNotification.
private void fireTaskNotification(KogitoProcessInstance instance, HumanTaskWorkItem workItem, Map<String, Object> notification, DeadlineType type, KieRuntime kruntime) {
final HumanTaskDeadlineEvent event = new HumanTaskDeadlineEventImpl(instance, workItem, notification, type, kruntime);
unitOfWorkManager.currentUnitOfWork().intercept(WorkUnit.create(event, e -> notifyAllListeners(event, KogitoProcessEventListener::onHumanTaskDeadline)));
}
use of org.kie.kogito.process.workitem.HumanTaskWorkItem in project kogito-runtimes by kiegroup.
the class HumanTaskNodeInstance method triggerCompleted.
@Override
public void triggerCompleted(InternalKogitoWorkItem workItem) {
cancelTimers(notStartedDeadlines);
cancelTimers(notCompletedDeadlines);
cancelTimers(notStartedReassignments);
cancelTimers(notCompletedReassignments);
String swimlaneName = getHumanTaskNode().getSwimlane();
SwimlaneContextInstance swimlaneContextInstance = getSwimlaneContextInstance(swimlaneName);
if (swimlaneContextInstance != null) {
String newActorId = (workItem instanceof HumanTaskWorkItem) ? ((HumanTaskWorkItem) workItem).getActualOwner() : (String) workItem.getParameter(ACTOR_ID);
if (newActorId != null) {
swimlaneContextInstance.setActorId(swimlaneName, newActorId);
}
}
super.triggerCompleted(workItem);
}
use of org.kie.kogito.process.workitem.HumanTaskWorkItem in project kogito-runtimes by kiegroup.
the class TestWorkItemHandler method executeWorkItem.
public void executeWorkItem(KogitoWorkItem workItem, KogitoWorkItemManager manager) {
workItems.add(workItem);
if (workItem instanceof HumanTaskWorkItem) {
HumanTaskWorkItemImpl humanTaskWorkItem = (HumanTaskWorkItemImpl) workItem;
humanTaskWorkItem.setPhaseId(Active.ID);
humanTaskWorkItem.setPhaseStatus(Active.STATUS);
}
}
use of org.kie.kogito.process.workitem.HumanTaskWorkItem in project kogito-runtimes by kiegroup.
the class ProcessInstanceEventBatch method buildUserTaskDeadlineEvent.
private DataEvent<?> buildUserTaskDeadlineEvent(HumanTaskDeadlineEvent event) {
HumanTaskWorkItem workItem = event.getWorkItem();
KogitoWorkflowProcessInstance pi = (KogitoWorkflowProcessInstance) event.getProcessInstance();
UserTaskDeadlineEventBody body = UserTaskDeadlineEventBody.create(workItem.getStringId(), event.getNotification()).state(workItem.getPhaseStatus()).taskName(workItem.getTaskName()).taskDescription(workItem.getTaskDescription()).taskPriority(workItem.getTaskPriority()).referenceName(workItem.getReferenceName()).actualOwner(workItem.getActualOwner()).startDate(workItem.getStartDate()).processInstanceId(pi.getStringId()).rootProcessInstanceId(pi.getRootProcessInstanceId()).processId(pi.getProcessId()).rootProcessId(pi.getRootProcessId()).inputs(workItem.getParameters()).outputs(workItem.getResults()).build();
return new UserTaskDeadlineDataEvent("UserTaskDeadline" + event.getType(), buildSource(pi.getProcessId()), addons.toString(), body, pi.getStringId(), pi.getRootProcessInstanceId(), pi.getProcessId(), pi.getRootProcessId());
}
Aggregations