Search in sources :

Example 1 with WorkItemNotFoundException

use of org.kie.kogito.internal.process.runtime.WorkItemNotFoundException in project kogito-runtimes by kiegroup.

the class LightWorkItemManager method updateWorkItem.

@Override
public <T> T updateWorkItem(String id, Function<org.kie.kogito.internal.process.runtime.KogitoWorkItem, T> updater, Policy<?>... policies) {
    InternalKogitoWorkItem workItem = workItems.get(id);
    if (workItem != null) {
        if (!workItem.enforce(policies)) {
            throw new NotAuthorizedException("User is not authorized to access task instance with id " + id);
        }
        T results = updater.apply(workItem);
        eventSupport.fireAfterWorkItemTransition(processInstanceManager.getProcessInstance(workItem.getProcessInstanceStringId()), workItem, null, null);
        return results;
    } else {
        throw new WorkItemNotFoundException(id);
    }
}
Also used : InternalKogitoWorkItem(org.kie.kogito.process.workitems.InternalKogitoWorkItem) WorkItemNotFoundException(org.kie.kogito.internal.process.runtime.WorkItemNotFoundException) NotAuthorizedException(org.kie.kogito.process.workitem.NotAuthorizedException)

Aggregations

WorkItemNotFoundException (org.kie.kogito.internal.process.runtime.WorkItemNotFoundException)1 NotAuthorizedException (org.kie.kogito.process.workitem.NotAuthorizedException)1 InternalKogitoWorkItem (org.kie.kogito.process.workitems.InternalKogitoWorkItem)1