use of org.kie.kogito.internal.process.event.HumanTaskDeadlineEvent 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.internal.process.event.HumanTaskDeadlineEvent in project kogito-runtimes by kiegroup.
the class ProcessInstanceEventBatch method events.
@Override
public Collection<DataEvent<?>> events() {
Map<String, ProcessInstanceEventBody> processInstances = new LinkedHashMap<>();
Map<String, UserTaskInstanceEventBody> userTaskInstances = new LinkedHashMap<>();
Set<VariableInstanceEventBody> variables = new LinkedHashSet<>();
Collection<DataEvent<?>> processedEvents = new ArrayList<>();
for (ProcessEvent event : rawEvents) {
ProcessInstanceEventBody body = processInstances.computeIfAbsent(((KogitoProcessInstance) event.getProcessInstance()).getStringId(), key -> create(event));
if (event instanceof ProcessNodeTriggeredEvent) {
handleProcessNodeTriggeredEvent((ProcessNodeTriggeredEvent) event, body);
} else if (event instanceof ProcessNodeLeftEvent) {
handleProcessNodeLeftEvent((ProcessNodeLeftEvent) event, body);
} else if (event instanceof ProcessCompletedEvent) {
handleProcessCompletedEvent((ProcessCompletedEvent) event, body);
} else if (event instanceof ProcessWorkItemTransitionEvent) {
handleProcessWorkItemTransitionEvent((ProcessWorkItemTransitionEvent) event, userTaskInstances);
} else if (event instanceof ProcessVariableChangedEvent) {
handleProcessVariableChangedEvent((KogitoProcessVariableChangedEvent) event, variables);
} else if (event instanceof HumanTaskDeadlineEvent) {
processedEvents.add(buildUserTaskDeadlineEvent((HumanTaskDeadlineEvent) event));
}
}
processInstances.values().stream().map(pi -> new ProcessInstanceDataEvent(extractRuntimeSource(pi.metaData()), addons.toString(), pi.metaData(), pi)).forEach(processedEvents::add);
userTaskInstances.values().stream().map(pi -> new UserTaskInstanceDataEvent(extractRuntimeSource(pi.metaData()), addons.toString(), pi.metaData(), pi)).forEach(processedEvents::add);
variables.stream().map(pi -> new VariableInstanceDataEvent(extractRuntimeSource(pi.metaData()), addons.toString(), pi.metaData(), pi)).forEach(processedEvents::add);
return processedEvents;
}
Aggregations