[jboss-user] [jBPM] - Re: Find Tasks by Candidate-Group Name
Michael Wohlfart
do-not-reply at jboss.com
Thu Sep 30 07:31:34 EDT 2010
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&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100930/e7ff0c51/attachment.html
More information about the jboss-user
mailing list