Search in sources :

Example 1 with TaskService

use of org.jbpm.task.service.TaskService in project jBPM5-Developer-Guide by Salaboy.

the class ProcessAndHumanTasksTest method createTaskHandler.

//Creates a local task service and attaches it to a human task handler
private GenericHTWorkItemHandler createTaskHandler(StatefulKnowledgeSession ksession) {
    TaskService ts = new TaskService(Persistence.createEntityManagerFactory("org.jbpm.task"), SystemEventListenerFactory.getSystemEventListener());
    LocalTaskService taskService = new LocalTaskService(ts);
    LocalHTWorkItemHandler taskHandler = new LocalHTWorkItemHandler(taskService, ksession);
    //        taskHandler.connect();
    this.service = taskService;
    return taskHandler;
}
Also used : TaskService(org.jbpm.task.service.TaskService) LocalTaskService(org.jbpm.task.service.local.LocalTaskService) LocalTaskService(org.jbpm.task.service.local.LocalTaskService) LocalHTWorkItemHandler(org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler)

Example 2 with TaskService

use of org.jbpm.task.service.TaskService in project jBPM5-Developer-Guide by Salaboy.

the class TasksListUI method initTaskComponents.

// End of variables declaration//GEN-END:variables
private void initTaskComponents() {
    // Create an EntityManagerFactory based on the PU configuration
    emf = Persistence.createEntityManagerFactory("org.jbpm.task");
    // The Task Service will use the EMF to store our Task Status
    taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
    // We can uset the Task Service to get an instance of the Task Session which
    // allows us to introduce to our database the users and groups information before 
    // running our tests
    taskSession = taskService.createSession();
    //create new Local Task Service
    localTaskService = new LocalTaskService(taskService);
    //regisister task event listener to Local Task Service
    localTaskService.addEventListener(taskEventListener);
    // Adds 1 Administrator, 2 users and 1 Group
    addUsersAndGroups(taskSession);
    //We need to set up an user to represent the user that is making the requests
    MockUserInfo userInfo = new MockUserInfo();
    taskService.setUserinfo(userInfo);
    this.taskParametersTableModel = new TaskParametersTableModel();
    this.tblParameters.setColumnModel(new TaskParametersTableModel.ColumnModel());
    this.tblParameters.setModel(taskParametersTableModel);
}
Also used : TaskService(org.jbpm.task.service.TaskService) LocalTaskService(org.jbpm.task.service.local.LocalTaskService) LocalTaskService(org.jbpm.task.service.local.LocalTaskService) TaskParametersTableModel(com.salaboy.jbpm5.dev.guide.tablemodel.TaskParametersTableModel)

Example 3 with TaskService

use of org.jbpm.task.service.TaskService in project jBPM5-Developer-Guide by Salaboy.

the class BaseTest method setUp.

protected void setUp() throws Exception {
    Properties conf = new Properties();
    conf.setProperty("mail.smtp.host", "localhost");
    conf.setProperty("mail.smtp.port", "2345");
    conf.setProperty("from", "from@domain.com");
    conf.setProperty("replyTo", "replyTo@domain.com");
    conf.setProperty("defaultLanguage", "en-UK");
    SendIcal.initInstance(conf);
    // Use persistence.xml configuration
    emf = createEntityManagerFactory();
    taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
    taskSession = taskService.createSession();
    MockUserInfo userInfo = new MockUserInfo();
    taskService.setUserinfo(userInfo);
    addUsersAndGroups(taskSession);
    disableUserGroupCallback();
    logger = LoggerFactory.getLogger(getClass());
}
Also used : TaskService(org.jbpm.task.service.TaskService) Properties(java.util.Properties)

Example 4 with TaskService

use of org.jbpm.task.service.TaskService in project jBPM5-Developer-Guide by Salaboy.

the class HumanTasksLifecycleAPITest method setUp.

@Before
public void setUp() {
    // Create an EntityManagerFactory based on the PU configuration
    emf = Persistence.createEntityManagerFactory("org.jbpm.task");
    // The Task Service will use the EMF to store our Task Status
    taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
    // We can uset the Task Service to get an instance of the Task Session which
    // allows us to introduce to our database the users and groups information before 
    // running our tests
    taskSession = taskService.createSession();
    // Adds 1 Administrator, 2 users and 1 Group
    addUsersAndGroups(taskSession);
    //We need to set up an user to represent the user that is making the requests
    MockUserInfo userInfo = new MockUserInfo();
    taskService.setUserinfo(userInfo);
}
Also used : LocalTaskService(org.jbpm.task.service.local.LocalTaskService) TaskService(org.jbpm.task.service.TaskService)

Example 5 with TaskService

use of org.jbpm.task.service.TaskService in project jBPM5-Developer-Guide by Salaboy.

the class TaskServerDaemon method startServer.

public void startServer() {
    if (isRunning())
        throw new IllegalStateException("Server is already started");
    this.running = true;
    EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("org.drools.task");
    TaskService taskService = new TaskService(entityManagerFactory, SystemEventListenerFactory.getSystemEventListener());
    TaskServiceSession taskSession = taskService.createSession();
    MockUserInfo userInfo = new MockUserInfo();
    taskService.setUserinfo(userInfo);
    for (String userName : getDefaultUsers()) {
        taskSession.addUser(new User(userName));
    }
    taskServer = new HornetQTaskServer(taskService, 5443);
    Thread thread = new Thread(taskServer);
    thread.start();
}
Also used : User(org.jbpm.task.User) HornetQTaskServer(org.jbpm.task.service.hornetq.HornetQTaskServer) TaskService(org.jbpm.task.service.TaskService) EntityManagerFactory(javax.persistence.EntityManagerFactory) TaskServiceSession(org.jbpm.task.service.TaskServiceSession)

Aggregations

TaskService (org.jbpm.task.service.TaskService)5 LocalTaskService (org.jbpm.task.service.local.LocalTaskService)3 TaskParametersTableModel (com.salaboy.jbpm5.dev.guide.tablemodel.TaskParametersTableModel)1 Properties (java.util.Properties)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 LocalHTWorkItemHandler (org.jbpm.process.workitem.wsht.LocalHTWorkItemHandler)1 User (org.jbpm.task.User)1 TaskServiceSession (org.jbpm.task.service.TaskServiceSession)1 HornetQTaskServer (org.jbpm.task.service.hornetq.HornetQTaskServer)1