[Proposal] Linking process instances and users
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2013 06:19 AM
In Activiti users are linked to tasks through IdentityLink and can be queried using TaskQuery.candidateUser(…). Similarly, the ability to link users with process definitions has been added recently through ProcessDefinitionQuery.startableByUser(…).
However, unless I've missed something obvious, there seems to be no way to link users and process instances.
In our application we have the requirement for people to see a list of the running process instances they are involved in (i.e. they started it or own/have owned an associated task). We've implemented this with our table which stores user_id - instance_id - involvement_type, but this is obviously not ideal.
It would be great if it were possible to do this through the standard Activiti API.
I would suggest to do it as follows and am willing to implement it as such and contribute it through a Git Pull Request.
1. Add a column for process instance id to ACT_RU_IDENTITYLINK.
2. Where IdentityLinks for tasks are added also store the process instance id.
3. On process start add an IdentityLink to the instance id and the current users (obtained through IdentityService.authenticatedUser).
4. Add a filter method to ProcessInstanceQuery: involvedUser(String userId).
What do you think?
However, unless I've missed something obvious, there seems to be no way to link users and process instances.
In our application we have the requirement for people to see a list of the running process instances they are involved in (i.e. they started it or own/have owned an associated task). We've implemented this with our table which stores user_id - instance_id - involvement_type, but this is obviously not ideal.
It would be great if it were possible to do this through the standard Activiti API.
I would suggest to do it as follows and am willing to implement it as such and contribute it through a Git Pull Request.
1. Add a column for process instance id to ACT_RU_IDENTITYLINK.
2. Where IdentityLinks for tasks are added also store the process instance id.
3. On process start add an IdentityLink to the instance id and the current users (obtained through IdentityService.authenticatedUser).
4. Add a filter method to ProcessInstanceQuery: involvedUser(String userId).
What do you think?
Labels:
- Labels:
-
Archive
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2013 04:23 AM
I don't see the point yet: if users have tasks, they are involved with the process instance. So isn't a query on the tasks enough to know which process instances people are involved? Also, typically people are not really interested in processes, but tasks in my opinion. But probably you have another use case in mind … maybe it helps to share it?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2013 07:07 AM
Hi Joram,
Suppose that a user starts a leave request process. As soon as he submits the first form, he will no longer have an active task, so he is no longer associated with the process. However, the user is still interested in that status of this process. We want to show the process diagram with the current state (highlighting the current task, but also show the assigned users, submission times, etc) so the user can see what is happening with his request as it goes through the organisation. This is especially interesting for non-trivial processes in which many different users are involved.
Suppose that a user starts a leave request process. As soon as he submits the first form, he will no longer have an active task, so he is no longer associated with the process. However, the user is still interested in that status of this process. We want to show the process diagram with the current state (highlighting the current task, but also show the assigned users, submission times, etc) so the user can see what is happening with his request as it goes through the organisation. This is especially interesting for non-trivial processes in which many different users are involved.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2013 07:40 AM
This is a typical use case that can be solved using a combination of activiti:initiator, variables, history and task/execution-listeners, and can be audited later on.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2013 08:09 AM
Sure, that is how we've implemented it so far.
It just seems to me that it could be done so much simpler, more robust and more efficient if done within Activiti.
It just seems to me that it could be done so much simpler, more robust and more efficient if done within Activiti.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2013 04:40 AM
After some discussion, it seems to be a valid use-case to involve people with a process. The suggested approach seems to be a good one, perhaps we should add a "runtimeService.addUserIdentityLink(processInstanceId, userId, role)" method, similar to the taskService.addUserIdentityLink() method.
It's great that you're willing to contribute this to the activiti project. I'll make sure I get the pull-request reviewed and into Activiti asap when you've finished the implementation. Don't hesitate to ask additional questions during development…
It's great that you're willing to contribute this to the activiti project. I'll make sure I get the pull-request reviewed and into Activiti asap when you've finished the implementation. Don't hesitate to ask additional questions during development…
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2013 05:03 AM
Great. Will do.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2013 05:24 PM