Search in sources :

Example 6 with HumanTaskWorkItem

use of org.kie.kogito.process.workitem.HumanTaskWorkItem in project kogito-runtimes by kiegroup.

the class TaskManagementService method updateTask.

@Override
public TaskInfo updateTask(String processId, String processInstanceId, String taskId, TaskInfo taskInfo, boolean shouldReplace, Policy<?>... policies) {
    ProcessInstance<?> pi = getProcessInstance(processId, processInstanceId, taskId);
    KogitoWorkItem workItem = UnitOfWorkExecutor.executeInUnitOfWork(processConfig.unitOfWorkManager(), () -> pi.updateWorkItem(taskId, wi -> {
        HumanTaskWorkItemImpl humanTask = HumanTaskHelper.asHumanTask(wi);
        setField(humanTask::setAdminGroups, taskInfo::getAdminGroups, shouldReplace);
        setField(humanTask::setAdminUsers, taskInfo::getAdminUsers, shouldReplace);
        setField(humanTask::setExcludedUsers, taskInfo::getExcludedUsers, shouldReplace);
        setField(humanTask::setPotentialUsers, taskInfo::getPotentialUsers, shouldReplace);
        setField(humanTask::setPotentialGroups, taskInfo::getPotentialGroups, shouldReplace);
        setField(humanTask::setTaskPriority, taskInfo::getPriority, shouldReplace);
        setField(humanTask::setTaskDescription, taskInfo::getDescription, shouldReplace);
        setMap(humanTask::setParameters, humanTask::setParameter, taskInfo.getInputParams(), shouldReplace);
        return wi;
    }, policies));
    return convert((HumanTaskWorkItem) workItem);
}
Also used : Policy(org.kie.kogito.process.workitem.Policy) KogitoWorkItem(org.kie.kogito.internal.process.runtime.KogitoWorkItem) ProcessConfig(org.kie.kogito.process.ProcessConfig) HumanTaskHelper(org.jbpm.process.instance.impl.humantask.HumanTaskHelper) UnitOfWorkExecutor(org.kie.kogito.services.uow.UnitOfWorkExecutor) Supplier(java.util.function.Supplier) Consumer(java.util.function.Consumer) HumanTaskWorkItemImpl(org.jbpm.process.instance.impl.humantask.HumanTaskWorkItemImpl) ProcessInstance(org.kie.kogito.process.ProcessInstance) Map(java.util.Map) Entry(java.util.Map.Entry) BiConsumer(java.util.function.BiConsumer) Process(org.kie.kogito.process.Process) HumanTaskWorkItem(org.kie.kogito.process.workitem.HumanTaskWorkItem) Processes(org.kie.kogito.process.Processes) ProcessInstanceNotFoundException(org.kie.kogito.process.ProcessInstanceNotFoundException) KogitoWorkItem(org.kie.kogito.internal.process.runtime.KogitoWorkItem) HumanTaskWorkItemImpl(org.jbpm.process.instance.impl.humantask.HumanTaskWorkItemImpl)

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 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 ProcessEventListener (org.kie.api.event.process.ProcessEventListener)1 ProcessNodeLeftEvent (org.kie.api.event.process.ProcessNodeLeftEvent)1 ProcessNodeTriggeredEvent (org.kie.api.event.process.ProcessNodeTriggeredEvent)1 ProcessStartedEvent (org.kie.api.event.process.ProcessStartedEvent)1 ProcessVariableChangedEvent (org.kie.api.event.process.ProcessVariableChangedEvent)1