[jboss-user] [JBoss jBPM] - Dynamic task creation

massimiliano_cuccia do-not-reply at jboss.com
Fri Mar 21 12:26:54 EDT 2008


Hi all
I have a process named Interpello that, at a certains point, executes the task InizioInterpello.
I attached at the node-leave event an action (actionIstruttoriaInterpello).

This action have to create a task instance for a number of users (i mean a task that each selected user must execute).

The code below (createAndAssignTask) does the work, but when the process arrives to the task ChiusuraInterpello, it should execute the action actionChiusuraInterpello (actually just display some outputs via println) 
but it doesn't execute nothing (I can't see the output), and the execution process doesn't step to verificaFinale.
Everything goes well if I comment all the createAndAssignTask code invocation in the actionIstruttoriaInterpello

There is something wrong in the code below (dynamic task creation)?

thanks
I'm using jbpm 3.1.2


  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process-definition
  |   xmlns="urn:jbpm.org:jpdl-3.1"  name="Interpello">
  |    <swimlane name="startingUser">
  |       <assignment expression="variable(ThisProcessStartingUser)"></assignment>
  |    </swimlane>
  |    <start-state name="start">
  |       <transition name="" to="inizioInterpello"></transition>
  |    </start-state>
  |    <end-state name="end1"></end-state>
  |    <task-node name="verificaFinale">
  |       <task name="verifica finale" swimlane="startingUser"></task>
  |       <transition name="finito" to="end1"></transition>
  |       <transition name="ripeti" to="inizioInterpello"></transition>
  |    </task-node>
  |    <task-node name="inizioInterpello">
  |       <task name="inizio interpello" swimlane="startingUser"></task>
  |       <event type="node-leave">
  |          <action name="actionIstruttoriaInterpello" class="it.unict.interpello.IstruttoriaInterpello"></action>
  |       </event>
  |       <transition name="Convoca Interpello" to="chiusuraInterpello"></transition>
  |    </task-node>
  |    <task-node name="tCompDoc">
  |    </task-node>
  |    <task-node name="chiusuraInterpello">
  |       <task name="Chiusura interpello" swimlane="startingUser"></task>
  |       <event type="node-leave">
  |          <action name="actionChiudiInterpello" class="it.unict.interpello.ChiusuraInterpello"></action>
  |       </event>
  |       <transition name="procedi alla verifica finale" to="verificaFinale"></transition>
  |    </task-node>
  | </process-definition>
  | 



  | 	public void createAndAssignTask(String user, ExecutionContext executionContext)
  | 	{
  | 		Token token = null;
  | 		TaskMgmtInstance tmi = null;
  | 		TaskNode taskNode = null;
  | 
  | 		try
  | 		{
  | 			token = executionContext.getToken();
  | 			tmi = executionContext.getTaskMgmtInstance();
  | 			taskNode = (TaskNode) executionContext.getNode();
  | 			
  | 			Task doCompilaDocumento = taskNode.getTask("tCompDoc");
  | 			TaskInstance tCompDoc = tmi.createTaskInstance(doCompilaDocumento, token);
  | 			
  | 			tCompDoc.setName("consulta: convocazione " + user);
  | 			tCompDoc.setActorId(user);
  | 			tCompDoc.setCreate(token.getEnd());
  | 			
  | 			tCompDoc.setVariableLocally("XXX"+user, "");
  | 			//tCompDoc.assign(executionContext);
  | 			tmi.addTaskInstance(tCompDoc);
  | 						System.out.println("creato: " + tCompDoc);
  | 					} catch (Exception ex)
  | 		{
  | 			ex.printStackTrace();
  | 		}
  | 	}
  | 

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

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



More information about the jboss-user mailing list