use of org.activiti.engine.impl.delegate.invocation.TaskListenerInvocation in project Activiti by Activiti.
the class ListenerNotificationHelper method executeTaskListeners.
public void executeTaskListeners(UserTask userTask, TaskEntity taskEntity, String eventType) {
for (ActivitiListener activitiListener : userTask.getTaskListeners()) {
String event = activitiListener.getEvent();
if (event.equals(eventType) || event.equals(TaskListener.EVENTNAME_ALL_EVENTS)) {
BaseTaskListener taskListener = createTaskListener(activitiListener);
if (activitiListener.getOnTransaction() != null) {
planTransactionDependentTaskListener(taskEntity.getExecution(), (TransactionDependentTaskListener) taskListener, activitiListener);
} else {
taskEntity.setEventName(eventType);
taskEntity.setCurrentActivitiListener(activitiListener);
try {
Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new TaskListenerInvocation((TaskListener) taskListener, taskEntity));
} catch (Exception e) {
throw new ActivitiException("Exception while invoking TaskListener: " + e.getMessage(), e);
} finally {
taskEntity.setEventName(null);
taskEntity.setCurrentActivitiListener(null);
}
}
}
}
}
Aggregations