use of org.kie.api.task.TaskLifeCycleEventListener in project jbpm by kiegroup.
the class HumanTaskServiceProducer method configureHumanTaskConfigurator.
protected void configureHumanTaskConfigurator(HumanTaskConfigurator configurator) {
configurator.environment(getEnvironment(identityProvider)).entityManagerFactory(emf).userGroupCallback(safeGet(userGroupCallback)).userInfo(safeGet(userInfo));
DeploymentDescriptorManager manager = new DeploymentDescriptorManager("org.jbpm.domain");
DeploymentDescriptor descriptor = manager.getDefaultDescriptor();
// in case there is descriptor with enabled audit register then by default
if (!descriptor.getAuditMode().equals(AuditMode.NONE)) {
JPATaskLifeCycleEventListener listener = new JPATaskLifeCycleEventListener(false);
BAMTaskEventListener bamListener = new BAMTaskEventListener(false);
// if the audit persistence unit is different than default for the engine perform proper init
if (!"org.jbpm.domain".equals(descriptor.getAuditPersistenceUnit())) {
EntityManagerFactory emf = EntityManagerFactoryManager.get().getOrCreate(descriptor.getAuditPersistenceUnit());
listener = new JPATaskLifeCycleEventListener(emf);
bamListener = new BAMTaskEventListener(emf);
}
configurator.listener(listener);
configurator.listener(bamListener);
}
// next proceed with registration of further listeners as cdi injections
try {
for (TaskLifeCycleEventListener listener : taskListeners) {
configurator.listener(listener);
logger.debug("Registering listener {}", listener);
}
} catch (Exception e) {
logger.debug("Cannot add listeners to task service due to {}", e.getMessage());
}
}
use of org.kie.api.task.TaskLifeCycleEventListener in project jbpm by kiegroup.
the class CustomTaskEventListenerProducer method getEventListeners.
@Override
public List<TaskLifeCycleEventListener> getEventListeners(String identifier, Map<String, Object> params) {
List<TaskLifeCycleEventListener> taskEventListeners = new ArrayList<TaskLifeCycleEventListener>();
taskEventListeners.add(new JPATaskLifeCycleEventListener(true));
return taskEventListeners;
}
Aggregations