[jboss-user] [JBoss jBPM] - Associating variables to task instances

john.rojas do-not-reply at jboss.com
Tue Oct 31 21:47:06 EST 2006


Hi,

I am having difficulty associating variables with task instances. I am using hypersonic to test my code and when I check the JBPM_VARIABLEINSTANCE table, the TASKINSTANCE_ column is null.

My process definition loops over the same task node multiple times. Each time the token reaches the task node, a new task instance is created, but I cannot find the variable instance "var1" for each task instance.

For now, I am concatinating the task instance id to the variable name, but from reading the documentation, I thought that taskInstance.setVariable( "var name", object ) would assign "var name" to that task instance, and assigning "var name" to another task instance would not change the value of the 1st assignment.

Thanks in advance for your help.

Regards,

John

The task action handler is shown below:

  |   public static class TaskNodeAction implements ActionHandler
  |   {
  |     private static final long serialVersionUID = 1L;
  |     String value1;
  |     public void execute(ExecutionContext context) throws Exception 
  |     {
  |         TaskInstance taskInstance = context.getTaskInstance();
  |           if( taskInstance == null )
  |             logger.error( "Got null taskInstance in node=" + context.getNode().getFullyQualifiedName() );
  |           else
  |           {
  |             // load custom variables and start it.
  |             taskInstance.setVariable( "var1", value1 );
  |             taskInstance.start();
  |           }
  |     }
  |   }
  | 

The task node out of the process definition:

  |    <task-node name="Looping Task">
  |       <task name="Looping Task">
  |       	 <event type='task-create'>
  | 	         <action class='TaskNodeAction'>
  | 	 	         <value1>1234</value1>  
  | 	          </action>
  | 	  </event>
  |       </task>
  |       <transition name="" to="next transition"></transition>
  |    </task-node>
  | 


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

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



More information about the jboss-user mailing list