This content has been marked as final.
Show 4 replies
-
1. Re: Task nodes problem
salaboy21 Nov 1, 2008 1:16 PM (in response to black83angel)If you know a little about Java, you should look the jBPM API and notice that
processInstance.getTaskMgmtInstance().getTaskInstances()
Give you the list (List) of all the task that you have at some moment.
Hope it helps -
2. Re: Task nodes problem
kukeltje Nov 1, 2008 1:39 PM (in response to black83angel)And this is only for one taskinstance. If you want it for all taskinstances, use the JbpmContext api
-
3. Re: Task nodes problem
black83angel Nov 2, 2008 5:43 AM (in response to black83angel)"kukeltje" wrote:
And this is only for one taskinstance. If you want it for all taskinstances, use the JbpmContext api
Can you give me an example please? -
4. Re: Task nodes problem
black83angel Nov 2, 2008 6:26 AM (in response to black83angel)Ok, no problem: I think I just solved the matter following a simple example I found browsing the net; the example manages different tasks by creating different task instances:
Token token = processInstance.getRootToken(); <some code that brings the process to task-node 1> TaskInstance t1 = (TaskInstance) processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next(); t1.start(); out.println("some feedback for task 1"); t1.end("task2"); token.signal(); TaskInstance t2 = (TaskInstance) processInstance.getTaskMgmtInstance().getUnfinishedTasks(token).iterator().next(); t2.start(); out.println("some fedback for task 2"); t2.end("end state");
I did not use the "getUnfinishedTasks(token)" function, now it seems to work: I assign actor to the task in a java class implementing AssignmentHandler.
If you don't mind, I have another question: on jBPM online documentation, cap 12 ("task management") I read that "Tasks can be defined in task-nodes and in the process-definition"; now I defined my task in the processdefinition.xml file:<task-node name="task1"> <task name="task1"> <assignment class="task1HandlerClass" /> </task> <transition name="follow" to="state2" /> </task-node>
...but what about if I want to define tasks following another way? The docs say that "task instance creation might be based upon a runtime calculation. In that case, add an ActionHandler on the nodeenter event of the task-node and set the attribute create-tasks=false."; so, I guess something like:<task-node name="task1" create-tasks="false"> <event type="node-enter"> <action class="createTask1" name="task1" /> </event> </task-node>
Getting to the point, what is the meaning of the "create-tasks=false" attribute? And, how can I assign the handler to a task created in such way? Do I simply introduce an in the task node, as above?
Thanks...