why do you not use the standard jbpm way?
<task-node name="MyTask"> <task swimlane="Group"/> <transition name="RETRY" to="A"></transition> <transition name="DONE" to="B"></transition> </task-node>
Then a TaskInstance is automatically created for you by jbpm!
By the way: You can get the Node-Type by the jbpm API, just look which type (Class) the Node has...
Thanks a lot for your reply.
Yes, i also thought about the way to define the task in the process definition. But then i've the same problem: The task is created automatically, but then I've to assign it to a user at runtime. In other words: Not later than now I need to know at which node the Process Instance is - If task node --> assign the task.. with your mentioned "class lookup".
anyway, is there a better way?
The way Bernd proposes is the right one. You can use an assignment handler which jBPM will invoke at runtime so that you can assign your task to suit your needs.
The jBPM user guide, section 11.3, Assignment describes the jBPM task assingment model in detail. Please take a look at it and let us know if it fulfills your needs.
I've got a dialog where the user chooses if he/she wants to create a pooled task or a task for a specific user of the predefined group.
When the user submits, I perform the "signal()", the task node will be enterd and the assignment handler will be called. Right? But where I get the previously defined User-Assignment-Data from (In the Assignment Handler)?
Is there nobody who assigned a task to a user/group by user's choice? I mean the assignment should not be done automatically by the AssignmentHandler.
@alex.guizar: This issue isn't captured by the Assignment-Section of the user guide isn't it?
In this case, you should set the createTasks attribute of the task node to false and create and assign the tasks in an actionHandler you associate with the node-enter event of the task node.
The actionHandler has access to all the variables of the processinstance through the execution context. So you can store the user's choice in a variable and retrieve it in the actionHandler to perform the task creation and assignment.
Thank you Koen,
you helped a lot.
Look here: http://jboss.org/index.html?module=bb&op=viewtopic&p=3933716#3933716
...If you also want to create & assign a TaskInstance in an Action-Handler --> there are several problems with this issue!