-
1. Re: jbpm3 Assign task to multiple actors
avelazquez May 26, 2011 11:46 AM (in response to sasir)I thnik, the simplest way is to define individual assigned tasks into the Task Node.
The Task Node will leave after all task are attended.
<task-node name="task-node1">
<task name="TaskForActor1">
<assignment actor-id="actor1"></assignment>
</task>
<task name="TaskForActor2">
<assignment actor-id="actor2"></assignment>
</task>
<task name="TaskForActor3">
<assignment actor-id="actor3"></assignment>
</task>
</task-node>
-
2. Re: jbpm3 Assign task to multiple actors
sasir May 26, 2011 11:50 AM (in response to avelazquez)Thanks for replying. But i dont have control over how many users can be assigned for finishing the task and hence need to do this dynamically. Can you please tell me how we can do this programatically
-
3. Re: jbpm3 Assign task to multiple actors
avelazquez May 26, 2011 1:51 PM (in response to sasir)OK,
Programatically,you can add an Action to the enter-event in the Task Node.
In the ActionHandler you create the tasks required (individual assigned) via the TaskMgtInstance; something like:
//First, obtain the unassigned task from the node
TaskNode taskNode = (TaskNode) executionContext.getNode();
Task myTask = taskNode.getTask("My Unassigned Task")
//Then, create the required task instances, by using myTask as model.
TaskMgmtInstance taskMgtInstance = executionContext.getTaskMgmtInstance();
for(.....) {
TaskInstance ti = taskMgtInstance.createTaskInstance(myTask, executionContext().getToken());
ti.setName(......);
ti.setActorId(.....);
.....
}
In order to make this works, you have to disable the automatic creation of task instances in the Task Node. By setting the attribute: create-tasks="false". So, the task-node is something like:
<task-node name="task-node1" create-tasks="false">
<event type="node-enter">
<action class="my,paq.CreateTaskActionHandler" name="CreateTaskActionHandler"></action>
</event>
<task name="My Unassigned Task">
......
</task>
</task-node>
-
4. Re: jbpm3 Assign task to multiple actors
sasir May 27, 2011 9:57 AM (in response to avelazquez)Works like a charm..Thanks Alejandro