cancel
Showing results for 
Search instead for 
Did you mean: 

what does 'involvedUser' mean ?

heymjo
Champ on-the-rise
Champ on-the-rise
Hi,

The javadoc of TaskQuery.involvedUser says

/** Only select tasks for which there exist an {@link IdentityLink} with the given user */

but what does that really mean ? As an API user you would normally not deal with identity links so the description is kind of technical and means not much to me, unless i drill down to the identitylink javadoc which is not that helpful either to understand. Can someone just in plain terms say what 'involvedUser' means, something like  candidateUser + member of candidateGroup + assigned tasks ?

See also http://forums.activiti.org/en/viewtopic.php?f=6&t=1671. The activiti-webapp2 has a component dedicated to this, so involvedUser must be an important workflow concept in Activiti ..

Thanks
Jorg
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Hi,

Involved user means that the user has been linked to the task.
So think of it as a possible assignee of the task or somebody who can look at the status of a user task.

Best regards,

heymjo
Champ on-the-rise
Champ on-the-rise
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));
  }

addCandidateUser adds an identity link yet it was said above that candidateusers do not cause a user to be 'involved' in a task.

This is all a bit confusing to me, so what am I missing ?  :?

trademak
Star Contributor
Star Contributor
Hi,

If you set a candidate user on a task, a task query will return this task when you query on involvedUser.
It will not return the task if you only set the person as owner, assignee or in a candidate group.
You can also add a custom user identity link and the involvedUser will return these tasks also.

Best regards,

heymjo
Champ on-the-rise
Champ on-the-rise
This does not make sense  Smiley Indifferent 

I made a quick test on a simple 2 step process definition. What it does first is testing if user "jorg" is a candidate user for a task. This returns true. Then i test for the number of tasks he's an involved user for, this returns 0. Then i add him as a candidate user to the same task he is already a candidate user for, and now all of a sudden he's an involved user on that task ?????????


        // "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);


the process definition is very simple, user "jorg" has the ROLE_EDIT permission assigned.


<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>

Please enlighten me, i still don't get the concept of involvedUser and its usefullness.
Getting started

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.