07-14-2011 04:55 AM
/** Only select tasks for which there exist an {@link IdentityLink} with the given user */
07-14-2011 08:17 AM
07-14-2011 09:15 AM
So think of it as a possible assignee of the task or somebody who can look at the status of a user task.Yet a possible assignee != a candidate user apparently, see Frederik's last message on the linked forum thread where he says
So if the user is a candidate for a task, the query will not return those tasks.Also when you say
Involved user means that the user has been linked to the task.–> linking users to tasks means executing AddIdentityLinkCmd right ? There are in taskservice 5 methods that do this
public void setAssignee(String taskId, String userId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, IdentityLinkType.ASSIGNEE));
}
public void setOwner(String taskId, String userId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, IdentityLinkType.OWNER));
}
public void addCandidateUser(String taskId, String userId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, IdentityLinkType.CANDIDATE));
}
public void addCandidateGroup(String taskId, String groupId) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, null, groupId, IdentityLinkType.CANDIDATE));
}
public void addUserIdentityLink(String taskId, String userId, String identityLinkType) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, userId, null, identityLinkType));
}
public void addGroupIdentityLink(String taskId, String groupId, String identityLinkType) {
commandExecutor.execute(new AddIdentityLinkCmd(taskId, null, groupId, identityLinkType));
}
07-14-2011 09:32 AM
07-15-2011 04:23 AM
// "jorg" should have one task after the processinstance was created
List<Task> myTasks =
processEngine.getTaskService().createTaskQuery().processDefinitionId(processDefinition.getId())
.taskCandidateUser("jorg").list();
Assert.assertNotNull(myTasks);
Assert.assertTrue(myTasks.size() == 1);
// now see if he's involved user on any task of the the process instance
Assert.assertTrue(
processEngine.getTaskService().createTaskQuery().processDefinitionId(processDefinition.getId())
.taskInvolvedUser("jorg").list().size() == 0);
// now add myself to the task as candidate user
processEngine.getTaskService().addCandidateUser(myTasks.get(0).getId(), "jorg");
// and now all of a sudden i'm involved user on the task
Assert.assertTrue(
processEngine.getTaskService().createTaskQuery().processDefinitionId(processDefinition.getId())
.taskInvolvedUser("jorg").list().size() == 1);
<definitions id="definitions"
targetNamespace="http://activiti.org/bpmn20"
xmlns:activiti="http://activiti.org/bpmn"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
<process id="ProcessVarSecurity">
<startEvent id="begin"/>
<sequenceFlow id="flow1" sourceRef="begin" targetRef="createReport"/>
<userTask id="createReport" name="create the report" activiti:candidateGroups="ROLE_EDIT"/>
<sequenceFlow id="flow2" sourceRef="createReport" targetRef="verifyReport"/>
<userTask id="verifyReport" name="verify the report" activiti:candidateGroups="ROLE_EDIT"/>
<sequenceFlow id="flow3" sourceRef="verifyReport" targetRef="end"/>
<endEvent id="end"/>
</process>
</definitions>
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.