As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
/** Only select tasks for which there exist an {@link IdentityLink} with the given user */
So think of it as a possible assignee of the task or somebody who can look at the status of a user task.
So if the user is a candidate for a task, the query will not return those tasks.
Involved user means that the user has been linked to the task.
<br> public void setAssignee(String taskId, String userId) {<br> commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, IdentityLinkType.ASSIGNEE));<br> }<br> <br> public void setOwner(String taskId, String userId) {<br> commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, IdentityLinkType.OWNER));<br> }<br> <br> public void addCandidateUser(String taskId, String userId) {<br> commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, IdentityLinkType.CANDIDATE));<br> }<br> <br> public void addCandidateGroup(String taskId, String groupId) {<br> commandExecutor.execute(new AddIdentityLinkCmd(taskId, null, groupId, IdentityLinkType.CANDIDATE));<br> }<br> <br> public void addUserIdentityLink(String taskId, String userId, String identityLinkType) {<br> commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, identityLinkType));<br> }<br><br> public void addGroupIdentityLink(String taskId, String groupId, String identityLinkType) {<br> commandExecutor.execute(new AddIdentityLinkCmd(taskId, null, groupId, identityLinkType));<br> }<br>
<br> // "jorg" should have one task after the processinstance was created<br> List<Task> myTasks =<br> processEngine.getTaskService().createTaskQuery().processDefinitionId(processDefinition.getId())<br> .taskCandidateUser("jorg").list();<br> Assert.assertNotNull(myTasks);<br> Assert.assertTrue(myTasks.size() == 1);<br><br> // now see if he's involved user on any task of the the process instance<br> Assert.assertTrue(<br> processEngine.getTaskService().createTaskQuery().processDefinitionId(processDefinition.getId())<br> .taskInvolvedUser("jorg").list().size() == 0);<br><br> // now add myself to the task as candidate user<br> processEngine.getTaskService().addCandidateUser(myTasks.get(0).getId(), "jorg");<br><br> // and now all of a sudden i'm involved user on the task <br> Assert.assertTrue(<br> processEngine.getTaskService().createTaskQuery().processDefinitionId(processDefinition.getId())<br> .taskInvolvedUser("jorg").list().size() == 1);<br><br>
<br><definitions id="definitions"<br> targetNamespace="<a href="http://activiti.org/bpmn20" rel="nofollow noopener noreferrer">http://activiti.org/bpmn20</a>"<br> xmlns:activiti="<a href="http://activiti.org/bpmn" rel="nofollow noopener noreferrer">http://activiti.org/bpmn</a>"<br> xmlns="<a href="http://www.omg.org/spec/BPMN/20100524/MODEL" rel="nofollow noopener noreferrer">http://www.omg.org/spec/BPMN/20100524/MODEL</a>"><br><br> <process id="ProcessVarSecurity"><br><br> <startEvent id="begin"/><br><br> <sequenceFlow id="flow1" sourceRef="begin" targetRef="createReport"/><br><br> <userTask id="createReport" name="create the report" activiti:candidateGroups="ROLE_EDIT"/><br><br> <sequenceFlow id="flow2" sourceRef="createReport" targetRef="verifyReport"/><br><br> <userTask id="verifyReport" name="verify the report" activiti:candidateGroups="ROLE_EDIT"/><br><br> <sequenceFlow id="flow3" sourceRef="verifyReport" targetRef="end"/><br><br> <endEvent id="end"/><br><br> </process><br><br></definitions><br>