Search in sources :

Example 1 with TaskServiceSession

use of org.jbpm.task.service.TaskServiceSession 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

EntityManagerFactory (javax.persistence.EntityManagerFactory)1 User (org.jbpm.task.User)1 TaskService (org.jbpm.task.service.TaskService)1 TaskServiceSession (org.jbpm.task.service.TaskServiceSession)1 HornetQTaskServer (org.jbpm.task.service.hornetq.HornetQTaskServer)1