-
1. Re: Find Task by Process Def and group
lalitbhatia Jun 24, 2010 6:30 AM (in response to lalitbhatia)A similar situation where If I have Process Instance key/business key and Group and I need to figure out list of Tasks then I guess following piece of code should work -
-------------------------------------------------------------------
ProcessInstanceQuery piQuery = new ProcessInstanceQueryImpl();
ProcessInstance pi = piQuery.processInstanceKey(businessKey).list().get(0);// find the Task by process instance id and user id - since the task is assigned to user group
// user associated with group will also be candidate
TaskQuery tQuery = taskService.createTaskQuery().processInstanceId(pi.getId()).candidate(userId);--------------------------------------------------------------------------------------
what do you say guys?
-
2. Re: Find Task by Process Def and group
swiderski.maciej Jun 24, 2010 1:42 PM (in response to lalitbhatia)Hi,
let me tell you first that this is not the optimal way but you asked for API solution. I think you could achieve what you described in following steps:
1. find tasks for given process definition
taskService.createTaskQuery().processDefinitionId(defId).list()
2. Iterate over returned list of tasks and get partcipations for each
taskService.getTaskParticipations(taskId)
3. Check returned list of participations based on
participation.getGroupId()
you can filter what groups you trying to find.
That probably should do what you want but not in the best way. You could find related jira issue or create new one to extend API if it comes to querying for tasks.
HTH
Maciej