02-02-2012 11:05 AM
public Void execute(CommandContext commandContext) {
if(taskId == null) {
throw new ActivitiException("taskId is null");
}
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiException("Cannot find task with id " + taskId);
}
if(userId != null) {
if (task.getAssignee() != null) {
if(!task.getAssignee().equals(userId)) {
// When the task is already claimed by another user, throw exception. Otherwise, ignore
// this, post-conditions of method already met.
throw new ActivitiException("Task " + taskId + " is already claimed by someone else");
}
} else {
task.setAssignee(userId);
}
} else {
// Task should be assigned to no one
task.setAssignee(null);
}
return null;
}
02-02-2012 02:07 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.