claim, setAssignee and taskAssignee

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 04:23 AM
Hello
I try to make my own experience with the APIs
If I do
lstTask is empty
But if I do
lstTask contains the assigned task to myUser.
I know that claim checks if the task is not already assigned.
But why in the first case the task does not appear assigned to myUser ?
(I use Activiti 5.10)
Thank you
I try to make my own experience with the APIs

If I do
// case 1Task myTask = lstCandidateTask.get(0);myTask.setAssignee(myUser);List<Task> lstTask = taskServ.createTaskQuery().taskAssignee(myUser).list();
lstTask is empty
But if I do
// case 2Task myTask = lstCandidateTask.get(0);taskServ.claim(myTask.getId(), myUser);List<Task> lstTask = taskServ.createTaskQuery().taskAssignee(myUser).list();
lstTask contains the assigned task to myUser.
I know that claim checks if the task is not already assigned.
But why in the first case the task does not appear assigned to myUser ?
(I use Activiti 5.10)
Thank you


Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 06:31 AM
Task myTask = lstCandidateTask.get(0);
myTask.setAssignee(myUser);
taskServ.saveTask(myTask);
List<Task> lstTask = taskServ.createTaskQuery().taskAssignee(myUser).list();
i agree it is not very intuitive.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 08:32 AM
Yes indeed !!
Thank you Jorg !
Thank you Jorg !
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 08:40 AM
It's a simple principle IMHO. All operations you perform on the task-service (e.g.. setAssignee and claim) are persisted immediately.
Everything you do on the Task object, should be applied by saving that object, using saveTask().
Everything you do on the Task object, should be applied by saving that object, using saveTask().

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 09:25 AM
It's a simple principle IMHO. All operations you perform on the task-service (e.g.. setAssignee and claim) are persisted immediately.
Everything you do on the Task object, should be applied by saving that object, using saveTask().
Sure, but logically why is there no claim|complete etc on task then ? This is the confusing bit, the fact that some operations are present on both sides but they work differently and some operations are only available on the task service.
From a technical point of view i know of course why they are this way, but it's just slightly confusing as this post demonstrates.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2012 10:17 AM
Setting the assignee is the claim… However, this does not alter the state of a task, nor a process. Completing does, so it won't make sense to make this available in the POJO, since it impacts more than meets the eye.
