Fetching tasks for candidateUser

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2012 08:42 AM
Hello,
A key feature in a workflow-driven application is the tasklist in which tasks can be queried based on certain filters. I'm struggling however with the TaskQuery API as a very common feature is very difficult to implement: Query for a list that contains all the tasks I may get on my todo-list. This involves both the currently assigned tasks and the tasks that are assigned to someone else but for which I am a candidateUser.
I've looked around and found a solution that may solve my problem (but it complicates the Maven setup as a local repo has to be created with the change):
http://forums.activiti.org/en/viewtopic.php?f=4&t=1730&start=0&hilit=candidateuser
However, I think there's a much simpler solution:
Why does an assignee override the fact that someone is a candidateUser? My guess is that it is much simpler - besides being more correct - to add "TaskQuery.unassigned()" to the cases that rely on the task being unassigned than to make TaskQuery.taskCandidateUser(X) only return unassigned tasks …
As a side-note: I do not understand the TaskQuery.involvedUser(X) semantics, but it also does not seem to solve the above problem …
A key feature in a workflow-driven application is the tasklist in which tasks can be queried based on certain filters. I'm struggling however with the TaskQuery API as a very common feature is very difficult to implement: Query for a list that contains all the tasks I may get on my todo-list. This involves both the currently assigned tasks and the tasks that are assigned to someone else but for which I am a candidateUser.
I've looked around and found a solution that may solve my problem (but it complicates the Maven setup as a local repo has to be created with the change):
http://forums.activiti.org/en/viewtopic.php?f=4&t=1730&start=0&hilit=candidateuser
However, I think there's a much simpler solution:
Why does an assignee override the fact that someone is a candidateUser? My guess is that it is much simpler - besides being more correct - to add "TaskQuery.unassigned()" to the cases that rely on the task being unassigned than to make TaskQuery.taskCandidateUser(X) only return unassigned tasks …
As a side-note: I do not understand the TaskQuery.involvedUser(X) semantics, but it also does not seem to solve the above problem …
Labels:
- Labels:
-
Archive
8 REPLIES 8

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2012 10:47 AM
Maybe the question in my original post was not entirely clear:
Is there a way to achieve this - with sorting, paging, … - without having to modify the Activiti source code?
Is there a way to achieve this - with sorting, paging, … - without having to modify the Activiti source code?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2012 04:55 AM
I quickly checked the code, and it seems that taskInvolved should give you that semantics:
Did you try the combination of taskInvolved and assignee?
/** Only select tasks for which there exist an {@link IdentityLink} with the given user */
TaskQuery taskInvolvedUser(String involvedUser);
Did you try the combination of taskInvolved and assignee?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2012 08:48 AM
I don't have an example with candidateUser but I have for candidateGroup. The bad thing is that none of below show potential task for 'user':
- single .taskInvolvedUser( userId )
- mixed .taskInvolvedUser( userId ) with .taskAssignee( userId )
The good thing is that single .taskCandidateUser( userId ) works GREAT even for candidateGroup only ( when assignee and cadidateUsers is empty and only candidateGroups is used with a group value )
Still not solved is to get a list that have all tasks userId assigned AND potential task at the same time.
- single .taskInvolvedUser( userId )
- mixed .taskInvolvedUser( userId ) with .taskAssignee( userId )
The good thing is that single .taskCandidateUser( userId ) works GREAT even for candidateGroup only ( when assignee and cadidateUsers is empty and only candidateGroups is used with a group value )
Still not solved is to get a list that have all tasks userId assigned AND potential task at the same time.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2012 08:06 AM
Nope, that won't be possible with the current API, because it uses 'and semantics'.
In 5.11, we've added a way to fire off 'native queries', which is what you'd probably need for your use case.
In 5.11, we've added a way to fire off 'native queries', which is what you'd probably need for your use case.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2012 03:33 AM
Thanks for the replies. We've adapted the Task.xml for now, but will probably try the native query in 5.11 (when it's available).
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2012 02:32 AM

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2012 06:18 AM
we need this as well, vvstraet care to share your modification to Task.xml for this ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2016 11:04 PM
in version 5.19
i think this is still an issue.
i tried
taskService.createTaskQuery()
.taskCandidateGroup("techassessment")
.includeProcessVariables()
.list();
as I have NOT used .taskUnassigned(), it should have returned everything. It doesnt!!
I think it should have returned everything as default and only unassigned when taskUnassigned is used.
i tried using the Native Query also but i am unable to add process Variables data with it..
i think this is still an issue.
i tried
taskService.createTaskQuery()
.taskCandidateGroup("techassessment")
.includeProcessVariables()
.list();
as I have NOT used .taskUnassigned(), it should have returned everything. It doesnt!!
I think it should have returned everything as default and only unassigned when taskUnassigned is used.
i tried using the Native Query also but i am unable to add process Variables data with it..
