reference:http://activiti.org/userguide/index.html?_ga=1.41496610.1079305175.1466499422# Bpmnusertask------------------------------------------------------------------------------------------------------------- ---------User Assignment
A User task can is directly assigned to a user. This is do by defining a Humanperformer sub element. Such a humanperformerdefinition needs a resourceassignmentexpression that actually defines the user. Currently, only Formalexpressions is supported.
1 2 3 4 5 6 7 8 9 ten |
<process > ... <usertask id= ' thetask ' Name= ' important task ' > <formalexpression>kermit< Span class= "tok-nt" ></formalexpression> </resourceassignmentexpression> </usertask> |
Only one user can is assigned as human performer to the task. In Activiti terminology, this user is called the assignee. Tasks that has an assignee is not visible in the task lists of people and can is found in the so-called person Al Task List of the assignee instead.
Tasks directly assigned to users can be retrieved through the Taskservice as follows:
1 |
list<task> tasks = taskservice. Createtaskquery (). Taskassignee "Kermit" List |
Tasks can also is put in the so-called candidate Task List of people. In this case, the Potentialowner construct must is used. The usage is similar to the Humanperformer construct. Do note that it's required to define for each element in the formal expression to specify if it's a user or a group (the Engine cannot guess this).
1 2 3 4 5 6 7 8 9 ten |
<process > ... <usertask id= ' thetask ' Name= ' important task ' > <potentialowner> Span class= "tok-nt" ><resourceassignmentexpression> <formalexpression>user ( Kermit), group (management) </formalexpression> </ resourceassignmentexpression> </potentialowner> </userTask > |
Tasks defines with the potential owner construct, can be retrieved as follows (or a similar taskquery us Age as for the tasks with an assignee):
1 |
List<Task> Tasks = Taskservice. Createtaskquery(). Taskcandidateuser("Kermit"); |
This would retrieve all tasks where Kermit is a candidate user, i.e. the formal expression contains user (Kermi T). This would also retrieve all tasks, which is assigned to a group where Kermit is a member of (e.g. gro Up (management), if Kermit are a member of that group and the Activiti identity component are used). The groups of a user is resolved at runtime and these can be managed through Theidentityservice.
If No specifics is given whether the given text string was a user or group, the engine defaults to group. So the following would is the same as when Group (accountancy) was declared.
1 |
<formalexpression>accountancy</formalExpression> |
Activiti Extensions for Task assignment
It is clear that user and group assignments was quite cumbersome for use cases where the assignment was not complex. To avoid these complexities, custom extensions on the user task is possible.
1 |
<usertask id="Thetask" name="My task" activiti:assignee="Kermit" /> |
This is exactly the same as using a humanperformer construct as defined above.
1 |
<usertask id="Thetask" name="My task" activiti:candidateusers="Kermit, Gonzo" /> /c10> |
This is exactly the same as using a potentialowner construct as defined above. Note that it isn't required to use the user (Kermit)declaration as was the case with the potential owner construct, since the attribute can only is used for users.
1 |
<usertask id="Thetask" name="My task" activiti:candidategroups="Management, Accountancy" /> |
This is exactly the same as using a potentialowner construct as defined above. Note that it isn't required to use theGroup (management) declaration as was the case with the potential own Er construct, since the attribute can only is used for groups.
Note:although Activiti provides an identity management component, which is exposed through the identityservice, No check is do whether a provided user is known by the identity component. This allows Activiti to integrate with existing identity management solutions when it was embedded into a applica tion.
--------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------
For example:
Taskservice.claim ("62556", "user1");
User1 is a userID, it should being saved in Pt_wf_id_user, and if it does ' t exist, the claim function can also be executed Su Ccessful.
How to integrate the Identity System in Activity