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;
}
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);
}
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());
}
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);
}
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();
}
Aggregations