[jboss-user] [jBPM Users] - Re: Advice regarding complex proccess modeling
saraswati.santanu
do-not-reply at jboss.com
Tue Nov 10 11:05:39 EST 2009
How about creating sub-tasks in you actual task? Signalling flag will be false for the sub-tasks by default. So it will not transit to the next node till you call complete on the super task.
The following code may be used when the review task becomes active
| Task reviewTask = taskService.createTaskQuery()
| .activityName("Review")
| .processInstanceId(processInstanceId)
| .uniqueResult();
|
| for (String userId:userIds) {
| TaskImpl subTask = reviewTask.createTask("Review for user "+userId)
| .addCandidateUser(userId);
|
| reviewTask.addSubTask(subTask);
| }
|
When an user performs review then you can execute something like this:
| //somehow get the review task
| Task reviewTask = taskService.createTaskQuery()
| .activityName("Review")
| .processInstanceId(processInstanceId)
| .uniqueResult();
|
| //some get the sub task for this user
| Task reviewSubTask = taskService.createTaskQuery()
| .activityName("Review for user "+userId)
| .processInstanceId(processInstanceId)
| .uniqueResult();
|
| //complete the sub task
| taskService.completeTask(reviewSubTask.getId());
|
| //remove sub task from the super task
| reviewTask.removeSubTask(reviewSubTask);
|
| //if there exists not sub task then move on
| if (reviewTask.getSubTasks().isEmpty()) {
| taskService.completeTask(reviewTask.getId());
| }
|
This is just an idea I got now. I have never tried this. So the code may not be accurate. Let me know if it works.
You may need to create a node altogether if you need to implement your own activity behaviour. You cannot really assign your own behaviour to the existing Task node of Jbpm. This also can be an approach to solve this problem.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264867#4264867
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264867
More information about the jboss-user
mailing list