use of org.jbpm.services.task.audit.JPATaskLifeCycleEventListener in project jbpm by kiegroup.
the class LocalTaskAuditWithDeadlineTest method setup.
@Before
public void setup() {
TaskDeadlinesServiceImpl.reset();
pds = setupPoolingDataSource();
emf = Persistence.createEntityManagerFactory("org.jbpm.services.task");
this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).listener(new JPATaskLifeCycleEventListener(true)).listener(new BAMTaskEventListener(true)).getTaskService();
this.taskAuditService = TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService();
}
use of org.jbpm.services.task.audit.JPATaskLifeCycleEventListener in project jbpm by kiegroup.
the class TotalCompletionTimeAssignmentStrategyTest method setUp.
@Before
public void setUp() throws Exception {
System.setProperty("org.jbpm.task.assignment.enabled", "true");
System.setProperty("org.jbpm.task.assignment.strategy", "LoadBalance");
System.setProperty("org.jbpm.task.assignment.loadbalance.calculator", "org.jbpm.services.task.assignment.impl.TotalCompletionTimeLoadCalculator");
System.setProperty("org.jbpm.services.task.assignment.taskduration.timetolive", "1000");
pds = setupPoolingDataSource();
emf = Persistence.createEntityManagerFactory("org.jbpm.services.task");
AssignmentServiceProvider.override(new LoadBalanceAssignmentStrategy());
this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).listener(new JPATaskLifeCycleEventListener(true)).listener(new BAMTaskEventListener(true)).getTaskService();
// giving ourselves lots of room
taskIds = new Long[100];
forceBAMEntries();
}
use of org.jbpm.services.task.audit.JPATaskLifeCycleEventListener in project jbpm by kiegroup.
the class LocalTaskAuditTest method setup.
@Before
public void setup() {
pds = setupPoolingDataSource();
emf = Persistence.createEntityManagerFactory("org.jbpm.services.task");
this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).listener(new JPATaskLifeCycleEventListener(true)).listener(new BAMTaskEventListener(true)).getTaskService();
this.taskAuditService = TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService();
}
use of org.jbpm.services.task.audit.JPATaskLifeCycleEventListener in project jbpm by kiegroup.
the class TaskServiceEJBImpl method configureDelegate.
@PostConstruct
public void configureDelegate() {
UserGroupCallback callback = UserDataServiceProvider.getUserGroupCallback();
HumanTaskConfigurator configurator = HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).userGroupCallback(callback);
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);
}
delegate = (InternalTaskService) configurator.getTaskService();
}
use of org.jbpm.services.task.audit.JPATaskLifeCycleEventListener in project jbpm by kiegroup.
the class LocalWithCustomCallbackTaskAuditTest method setup.
@Before
public void setup() {
pds = setupPoolingDataSource();
emf = Persistence.createEntityManagerFactory("org.jbpm.services.task");
callback = new NullGroupsUserGroupCallback();
this.taskService = (InternalTaskService) HumanTaskServiceFactory.newTaskServiceConfigurator().entityManagerFactory(emf).listener(new JPATaskLifeCycleEventListener(true)).listener(new BAMTaskEventListener(true)).userGroupCallback(callback).getTaskService();
this.taskAuditService = TaskAuditServiceFactory.newTaskAuditServiceConfigurator().setTaskService(taskService).getTaskAuditService();
}
Aggregations