Search in sources :

Example 1 with JPATaskLifeCycleEventListener

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();
}
Also used : JPATaskLifeCycleEventListener(org.jbpm.services.task.audit.JPATaskLifeCycleEventListener) BAMTaskEventListener(org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener) Before(org.junit.Before)

Example 2 with JPATaskLifeCycleEventListener

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();
}
Also used : JPATaskLifeCycleEventListener(org.jbpm.services.task.audit.JPATaskLifeCycleEventListener) BAMTaskEventListener(org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener) LoadBalanceAssignmentStrategy(org.jbpm.services.task.assignment.impl.strategy.LoadBalanceAssignmentStrategy) Before(org.junit.Before)

Example 3 with JPATaskLifeCycleEventListener

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();
}
Also used : JPATaskLifeCycleEventListener(org.jbpm.services.task.audit.JPATaskLifeCycleEventListener) BAMTaskEventListener(org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener) Before(org.junit.Before)

Example 4 with JPATaskLifeCycleEventListener

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();
}
Also used : JPATaskLifeCycleEventListener(org.jbpm.services.task.audit.JPATaskLifeCycleEventListener) HumanTaskConfigurator(org.jbpm.services.task.HumanTaskConfigurator) BAMTaskEventListener(org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener) DeploymentDescriptor(org.kie.internal.runtime.conf.DeploymentDescriptor) EntityManagerFactory(javax.persistence.EntityManagerFactory) DeploymentDescriptorManager(org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorManager) UserGroupCallback(org.kie.api.task.UserGroupCallback) PostConstruct(javax.annotation.PostConstruct)

Example 5 with JPATaskLifeCycleEventListener

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();
}
Also used : JPATaskLifeCycleEventListener(org.jbpm.services.task.audit.JPATaskLifeCycleEventListener) BAMTaskEventListener(org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener) Before(org.junit.Before)

Aggregations

JPATaskLifeCycleEventListener (org.jbpm.services.task.audit.JPATaskLifeCycleEventListener)10 BAMTaskEventListener (org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener)7 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)3 EntityManagerFactory (javax.persistence.EntityManagerFactory)3 TaskLifeCycleEventListener (org.kie.api.task.TaskLifeCycleEventListener)3 DeploymentDescriptorManager (org.jbpm.runtime.manager.impl.deploy.DeploymentDescriptorManager)2 DeploymentDescriptor (org.kie.internal.runtime.conf.DeploymentDescriptor)2 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 PostConstruct (javax.annotation.PostConstruct)1 AmbiguousResolutionException (javax.enterprise.inject.AmbiguousResolutionException)1 EntityManager (javax.persistence.EntityManager)1 ProcessInstanceLog (org.jbpm.process.audit.ProcessInstanceLog)1 StandaloneJtaStrategy (org.jbpm.process.audit.strategy.StandaloneJtaStrategy)1 HumanTaskConfigurator (org.jbpm.services.task.HumanTaskConfigurator)1 HumanTaskServiceFactory (org.jbpm.services.task.HumanTaskServiceFactory)1 LoadBalanceAssignmentStrategy (org.jbpm.services.task.assignment.impl.strategy.LoadBalanceAssignmentStrategy)1 TaskFluent (org.jbpm.services.task.utils.TaskFluent)1