Skip to content

Commit

Permalink
Claim/release will correctly set midpoint-approver identity links.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 24, 2017
1 parent 89648de commit 46f62b0
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -21,6 +21,7 @@
import com.evolveum.midpoint.prism.util.CloneUtil;
import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.schema.DeltaConvertor;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
Expand Down Expand Up @@ -172,7 +173,11 @@ public void claimWorkItem(String workItemId, OperationResult parentResult) throw
throw new SecurityViolationException("You are not authorized to claim the selected work item.");
}
taskService.claim(workItemId, principal.getOid());
// TODO assignees in identity links!
task = taskService.createTaskQuery().taskId(workItemId).singleResult();
if (task == null) {
throw new ObjectNotFoundException("The work item does not exist");
}
setNewAssignees(task, Collections.singletonList(ObjectTypeUtil.createObjectRef(principal.getOid(), ObjectTypes.USER)), taskService);
} catch (ObjectNotFoundException|SecurityViolationException|RuntimeException e) {
result.recordFatalError("Couldn't claim the work item " + workItemId + ": " + e.getMessage(), e);
throw e;
Expand Down Expand Up @@ -214,6 +219,11 @@ public void releaseWorkItem(String workItemId, OperationResult parentResult) thr
throw new SystemException("It has no candidates to be offered to");
}
taskService.unclaim(workItemId);
task = taskService.createTaskQuery().taskId(workItemId).singleResult();
if (task == null) {
throw new ObjectNotFoundException("The work item does not exist");
}
setNewAssignees(task, Collections.emptyList(), taskService);
} catch (ObjectNotFoundException|SecurityViolationException|RuntimeException e) {
result.recordFatalError("Couldn't release work item " + workItemId + ": " + e.getMessage(), e);
throw e;
Expand Down

0 comments on commit 46f62b0

Please sign in to comment.