on 11-01-2013 6:12 AM
Hi,
I want to check whether a user has completed a task in a process. So I use
Set<TaskAbstract> getMyTaskAbstractsByParent(URI processInstanceId, Set<Status> statuses)
in TaskInstanceManager. But it does not returns tasks of sub-processes. So I want to get the process instance ids of sub-processes by the parent process instance id.
In the latest API, there are only methods getting parent process instance id by sub-process instance id: getParentProcessInstanceId()
and getRootProcessInstanceId(). How should I do?
Best regards,
Abe
Hi Abe,
getting the sub-processes of a process is not directly supported by the public API. In your case you could fetch all tasks for a user, get the corresponding process instance and check whether this process instance is the desired on or a child of it. You could do this, for example, as sketched with the pseudo-code snippet below.
Set<TaskAbstract> TaskInstanceManager.getMyTaskAbstracts(Set<Status> statuses)
for each TaskAbstract in Set
ProcessInstance ProcessInstanceManager.getProcessInstanceForTaskInstanceId(URI taskInstanceId)
if (ProcessInstance=parent or ProcessInstance.getParent()=parent)
add to result Set<ProcessInstance>
Best Regards,
Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andre,
Thank you for your reply. It seems that the method getParentProcessInstanceId() is available from NW7.31 SP08. Our NW is 7.31 SP05. Is there any other way?
-Abe
Hi Abe,
you are right, the method ProcessInstance.getParentProcessInstanceId()
is only available starting with SP08. Unfortunately there isn’t any other way to get sub-processes with the public API.
You could at most try to find out whether a process/task is child of a particular process by analyzing the context of the sub-task/sub-process in your app. You could for example put the parent’s process instance ID into the input data object of the sub-tasks or any other special information into the subject of the sub-processes. Use methods like TaskDetail.getInputDataObject()
or ProcessInstance.getSubject()
to get this information in your app. But this is just a workaround, I would rather recommend you to go to SP08 and use the getParent
method.
Best Regards,
Andre
Hi Andre,
I have another question about your first reply. TaskInstanceManager.getMyTaskAbstracts(Set<Status> statuses) will get all of somebody's tasks in some status e.g. status Completed. If someone has two many completed tasks, I am afraid that running that code will take some time and even degrade the server performance if many users having lots of completed tasks run that code at the same time.
Is my fear justified?
Best Regards,
Abe
Hi Abe,
here is what you can do:
1) Identify a unique context field (e.g. request ID, mat. no., order id...) that you pass from your main process to all subprocesses
2) write this context field along will the respective process instance ids into a CAF or JPA table
3) query all process instance ids for a given context key
4) get all tasks from all found process instance ids
Regards,
Christian
Hi Abe,
you are right, the operation getMyTaskAbstracts
will query for example all the completed tasks of a user. This could be a costly query, especially in case of the completed tasks, but this depends on many things like the load on your server, your archiving strategy, the performance of your database, etc.
Best Regards,
Andre
you are embedding for referencing sub process?
can you put the process in context?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.