[jboss-user] [JBoss jBPM] - TaskQuery w/ ProcessInstanceId possible?

hrworx do-not-reply at jboss.com
Mon Aug 3 17:40:27 EDT 2009


I've tried everything I can think of to query tasks by ProcessInstanceId but no matter what, if you put a ProcessInstanceId on a TaskQuery, you get back zero results.  The test below runs fine until the last line, when the assertion fails.  I have tried substituting different ids in the query, including processInstance.getProcessInstance.getId(),  processInstance.getExecutions() and iterating over all the executions and using their ids, and various other attempts without success.

Is it even possible?  If anybody can do it, how about pasting a code snippet?



  |     @Test
  |     public void testTaskQueryByProcessInstanceId()
  |     {
  | 
  |         TaskQuery taskQueryBefore = getTaskService().createTaskQuery();
  |         List<Task> taskListBefore = taskQueryBefore.list();
  |         Assert.assertEquals(0, taskListBefore.size());
  | 
  |         ProcessInstance processInstance = createProcessInstance();
  |         TaskQuery taskQuery = getTaskService().createTaskQuery();
  | 
  |         List<Task> taskList = taskQuery.list();
  |         Assert.assertEquals(2, taskList.size());
  | 
  |         TaskQuery taskQuery2 = getTaskService().createTaskQuery();
  |         taskQuery2.processInstanceId(processInstance.getId());
  |         List<Task> taskList2 = taskQuery2.list();
  | 
  |         Assert.assertEquals(2, taskList2.size());
  |     }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4247700#4247700

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4247700



More information about the jboss-user mailing list