[jboss-user] [JBoss jBPM] - solved - Re: Dynamic task creation

massimiliano_cuccia do-not-reply at jboss.com
Tue Apr 29 06:08:04 EDT 2008

Scull, I doesn't understood. But now It works.

At the end of all my attempts I resolved. Continue reading to know all the story.. Hope this will help someone.

I moved The action that creates all the dynamic tasks to the node-enter of the task to "clone" (if you followed the example in the previous post, the task in tCompDoc)
This is the code of dynamic creation:

  |         Token token = executionContext.getToken();
  |         TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
  |         TaskNode taskNode = (TaskNode) executionContext.getNode();
  |         Task task = taskNode.getTask("task compilazione");        
  |         TaskInstance taskInstance = tmi.createTaskInstance(task, executionContext);
  |         taskInstance.setActorId(user);
But the important part of this is the execution point. Remembar "node-enter of the cloning task". Elsewhere will cause errors and token scramble.

In my sample I need a task to close every dynamic task created early, still not ended, I put this code to the node-leave of chiusura-interpello.
This is the relevant part of code:

  |                     if (!ti.hasEnded())
  |                         ti.cancel();

thanks to every one helped me to achieve this goal
Hoping this will help someone else.

If you have any question, ask.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147466#4147466

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147466

More information about the jboss-user mailing list