Search in sources :

Example 1 with HumanTaskWorkItem

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();
}
Also used : HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) KogitoWorkflowProcessInstance(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcessInstance)

Example 2 with HumanTaskWorkItem

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)));
}
Also used : ProcessStartedEventImpl(org.drools.core.event.ProcessStartedEventImpl) ProcessCompletedEvent(org.kie.api.event.process.ProcessCompletedEvent) KogitoWorkItem(org.kie.kogito.internal.process.runtime.KogitoWorkItem) WorkUnit(org.kie.kogito.uow.WorkUnit) KogitoProcessInstance(org.kie.kogito.internal.process.runtime.KogitoProcessInstance) AbstractEventSupport(org.drools.core.event.AbstractEventSupport) ProcessEventListener(org.kie.api.event.process.ProcessEventListener) DeadlineType(org.kie.kogito.internal.process.event.HumanTaskDeadlineEvent.DeadlineType) KogitoProcessEventListener(org.kie.kogito.internal.process.event.KogitoProcessEventListener) ProcessNodeLeftEvent(org.kie.api.event.process.ProcessNodeLeftEvent) Map(java.util.Map) UnitOfWorkManager(org.kie.kogito.uow.UnitOfWorkManager) SLAViolatedEventImpl(org.drools.core.event.SLAViolatedEventImpl) SignalEvent(org.kie.api.event.process.SignalEvent) ProcessVariableChangedEvent(org.kie.api.event.process.ProcessVariableChangedEvent) SignalEventImpl(org.drools.core.event.SignalEventImpl) ProcessCompletedEventImpl(org.drools.core.event.ProcessCompletedEventImpl) MessageEvent(org.kie.api.event.process.MessageEvent) KogitoNodeInstance(org.kie.kogito.internal.process.runtime.KogitoNodeInstance) MessageEventImpl(org.drools.core.event.MessageEventImpl) List(java.util.List) ProcessNodeTriggeredEvent(org.kie.api.event.process.ProcessNodeTriggeredEvent) Transition(org.kie.kogito.process.workitem.Transition) KieRuntime(org.kie.api.runtime.KieRuntime) KogitoProcessEventSupport(org.kie.kogito.internal.process.event.KogitoProcessEventSupport) HumanTaskDeadlineEvent(org.kie.kogito.internal.process.event.HumanTaskDeadlineEvent) SLAViolatedEvent(org.kie.api.event.process.SLAViolatedEvent) HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) ProcessStartedEvent(org.kie.api.event.process.ProcessStartedEvent) ProcessWorkItemTransitionEvent(org.kie.kogito.internal.process.event.ProcessWorkItemTransitionEvent) HumanTaskDeadlineEvent(org.kie.kogito.internal.process.event.HumanTaskDeadlineEvent) KogitoProcessEventListener(org.kie.kogito.internal.process.event.KogitoProcessEventListener)

Example 3 with HumanTaskWorkItem

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);
}
Also used : HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) SwimlaneContextInstance(org.jbpm.process.instance.context.swimlane.SwimlaneContextInstance)

Example 4 with HumanTaskWorkItem

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);
    }
}
Also used : HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) HumanTaskWorkItemImpl(org.jbpm.process.instance.impl.humantask.HumanTaskWorkItemImpl)

Example 5 with HumanTaskWorkItem

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());
}
Also used : HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) KogitoWorkflowProcessInstance(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcessInstance) UserTaskDeadlineDataEvent(org.kie.kogito.services.event.UserTaskDeadlineDataEvent)

Aggregations

HumanTaskWorkItem (org.kie.kogito.process.workitem.HumanTaskWorkItem)6 Map (java.util.Map)2 HumanTaskWorkItemImpl (org.jbpm.process.instance.impl.humantask.HumanTaskWorkItemImpl)2 KogitoWorkItem (org.kie.kogito.internal.process.runtime.KogitoWorkItem)2 KogitoWorkflowProcessInstance (org.kie.kogito.internal.process.runtime.KogitoWorkflowProcessInstance)2 List (java.util.List)1 Entry (java.util.Map.Entry)1 BiConsumer (java.util.function.BiConsumer)1 Consumer (java.util.function.Consumer)1 Supplier (java.util.function.Supplier)1 AbstractEventSupport (org.drools.core.event.AbstractEventSupport)1 MessageEventImpl (org.drools.core.event.MessageEventImpl)1 ProcessCompletedEventImpl (org.drools.core.event.ProcessCompletedEventImpl)1 ProcessStartedEventImpl (org.drools.core.event.ProcessStartedEventImpl)1 SLAViolatedEventImpl (org.drools.core.event.SLAViolatedEventImpl)1 SignalEventImpl (org.drools.core.event.SignalEventImpl)1 SwimlaneContextInstance (org.jbpm.process.instance.context.swimlane.SwimlaneContextInstance)1 HumanTaskHelper (org.jbpm.process.instance.impl.humantask.HumanTaskHelper)1 MessageEvent (org.kie.api.event.process.MessageEvent)1 ProcessCompletedEvent (org.kie.api.event.process.ProcessCompletedEvent)1