Is claiming a task is mandatory?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2014 03:12 AM
Hi,
I have two question -
1. I have a user task (approve/reject) which is assigned to multiple users. My question is, can any one of the assigned user complete the task without claiming it? OR is it mandatory for user to claim the task on his/her name and then only that user can complete the task.
2. Is it posible the to revert the claim? I mean, if one user is claiming the task and later on wants to revoke his/her claim, then is it possible? If yes, how?
Any help is very much appreciated.
Thanks,
Pratik
I have two question -
1. I have a user task (approve/reject) which is assigned to multiple users. My question is, can any one of the assigned user complete the task without claiming it? OR is it mandatory for user to claim the task on his/her name and then only that user can complete the task.
2. Is it posible the to revert the claim? I mean, if one user is claiming the task and later on wants to revoke his/her claim, then is it possible? If yes, how?
Any help is very much appreciated.
Thanks,
Pratik
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2014 01:55 AM
Hi Pratik.
AFAIK
1. claiming is not mandatory
2. yes, you can set Assignee to null
Regards
Martin
AFAIK
1. claiming is not mandatory
2. yes, you can set Assignee to null
Regards
Martin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2014 03:01 AM
Thanks Martin. Appreciate your quick response..
But, in second question I was talking about real time situation. Let me try to rephrase the scenario - In assignee I have already assigned two users (user1 and user2) and I have invoked the workflow. Now user1 is claiming the task but unable to complete due to some reason and wants to revert his claim, so that user2 can complete it.
In this scenario, is it possible to revert the claimed task in real time? As far as I understand, setting assignee to null can be done in the properties of user task, but that can be done before workflow is invoked I guess?
Thanks,
Pratik
But, in second question I was talking about real time situation. Let me try to rephrase the scenario - In assignee I have already assigned two users (user1 and user2) and I have invoked the workflow. Now user1 is claiming the task but unable to complete due to some reason and wants to revert his claim, so that user2 can complete it.
In this scenario, is it possible to revert the claimed task in real time? As far as I understand, setting assignee to null can be done in the properties of user task, but that can be done before workflow is invoked I guess?
Thanks,
Pratik
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2014 01:20 AM
Hi Pratik,
use: org.activiti.engine.TaskService#unclaim
the best examples are following jUnit tests:
Regards
Martin
use: org.activiti.engine.TaskService#unclaim
the best examples are following jUnit tests:
public void testClaimAlreadyClaimedTaskByOtherUser() {
Task task = taskService.newTask();
taskService.saveTask(task);
User user = identityService.newUser("user");
identityService.saveUser(user);
User secondUser = identityService.newUser("seconduser");
identityService.saveUser(secondUser);
// Claim task the first time
taskService.claim(task.getId(), user.getId());
try {
taskService.claim(task.getId(), secondUser.getId());
fail("ActivitiException expected");
} catch (ActivitiTaskAlreadyClaimedException ae) {
assertTextPresent("Task '" + task.getId() + "' is already claimed by someone else.", ae.getMessage());
}
taskService.deleteTask(task.getId(), true);
identityService.deleteUser(user.getId());
identityService.deleteUser(secondUser.getId());
}
public void testClaimAlreadyClaimedTaskBySameUser() {
Task task = taskService.newTask();
taskService.saveTask(task);
User user = identityService.newUser("user");
identityService.saveUser(user);
// Claim task the first time
taskService.claim(task.getId(), user.getId());
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
// Claim the task again with the same user. No exception should be thrown
taskService.claim(task.getId(), user.getId());
taskService.deleteTask(task.getId(), true);
identityService.deleteUser(user.getId());
}
public void testUnClaimTask() {
Task task = taskService.newTask();
taskService.saveTask(task);
User user = identityService.newUser("user");
identityService.saveUser(user);
// Claim task the first time
taskService.claim(task.getId(), user.getId());
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals(user.getId(), task.getAssignee());
// Unclaim the task
taskService.unclaim(task.getId());
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertNull(task.getAssignee());
taskService.deleteTask(task.getId(), true);
identityService.deleteUser(user.getId());
}
Regards
Martin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2014 08:27 AM
Thanks a lot Martin!!

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2015 05:49 AM
Hi,
change your project dependencies.
Regards
Sumer
change your project dependencies.
Regards
Sumer
