Michael Wohlfart [
http://community.jboss.org/people/mwohlf] created the discussion
"Re: Find Tasks by Candidate-Group Name"
To view the discussion, visit:
http://community.jboss.org/message/564247#564247
--------------------------------------------------------------
Hi William,
I suppose this is what you want to do:
public class TaskCandidatesTest extends JbpmTestCase {
public void testCandidatePutsTaskBackInGroup() {
deployJpdlXmlString(
"<process name='CandidatePutsTaskBackInGroup'>" +
" <start>" +
" <transition to='review' />" +
" </start>" +
" <task name='review' " +
" candidate-groups='sales-dept'>" +
" <transition to='wait' />" +
" </task>" +
" <state name='wait'/>" +
"</process>"
);
ProcessInstance processInstance =
executionService.startProcessInstanceByKey("CandidatePutsTaskBackInGroup");
String pid = processInstance.getId();
Task task = taskService.createTaskQuery().processInstanceId(pid).uniqueResult();
assertNull(task.getAssignee());
processEngine.execute(
new Command<Void>() {
public Void execute(Environment environment) throws Exception {
DbSessionImpl dbSessionImpl = environment.get(DbSessionImpl.class);
Session session = dbSessionImpl.getSession();
assertNotNull(session);
List<Task> list =
session.createQuery(
" select p.task from " + ParticipationImpl.class.getName() +
" p "
+ " where p.groupId = :groupId ")
.setParameter("groupId", "sales-dept")
.list();
assertEquals(1, list.size());
assertEquals("review", list.get(0).getName());
return null;
}
}
);
taskService.takeTask(task.getId(), "johndoe");
task = taskService.createTaskQuery().processInstanceId(pid).uniqueResult();
assertEquals("johndoe", task.getAssignee());
taskService.assignTask(task.getId(), null);
task = taskService.getTask(task.getId());
assertNull(task.getAssignee());
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/564247#564247]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]