[jboss-user] [JBoss jBPM] - Re: How to design a Task Node with two Transition?

prajatna do-not-reply at jboss.com
Tue Aug 4 08:06:05 EDT 2009


"kukeltje" wrote : Sorry, pressed submit instead of preview.... and this link does not belong here
  | 
  | You cannot leave a task-node on a node-enter. You can only do this on generic nodes. The usage of a tasknode is completely superfluous here. 


Thanks for your comments...
Then, what we should use in my scenario, where we have two transition with a Task node. 

I also tried with task assignment like....


  | <task-node name="PM_Approval" >		
  | 		<task>
  | 			<assignment class="com.sample.nodeAction.PMAssignAction"></assignment>			
  | 		</task>
  | 		<transition to="HOD_Approval" name="Accepted"></transition>
  | 		<transition to="end" name="Denied"></transition>	
  | 	</task-node>
  | 


and from inside my PMAssignAction class i am trying to switch to required transition as follows.


  | public class PMAssignAction implements AssignmentHandler {
  | 
  | 	
  | 	private static final long serialVersionUID = 1L;
  | 
  | 	public void assign(Assignable assignable, ExecutionContext executionContext)
  | 			throws Exception {
  | 		
  | 		System.out.println("--------PMAssignAction------------1-------");
  | 		System.out.println("This Node is---"+executionContext.getNode().getName());	
  | 		
  | 		System.out.print("Enter your decission: ");	      
  | 	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));	    
  | 	    String decision = null;
  | 	    
  | 	    try {
  | 	    	decision = br.readLine();
  | 	    } catch (IOException ioe) {
  | 	       System.out.println("IO error trying to read your decission!");	       
  | 	    }
  | 	    
  | 	    System.out.println("Thanks for the desission, " + decision);
  | 	    System.out.println("---------PMAssignAction------------2-------");
  | 	    
  | 	    if(decision != null && decision.equalsIgnoreCase("a")){
  | 	    	
  | 	    	executionContext.getContextInstance().setVariable("decision", decision);
  | 	    	System.out.println("---------PMAssignAction----a--------3---");
  | 	    	executionContext.getProcessInstance().signal("Accepted");
  | 	    	//leaveNode("Accepted");
  | 	    }
  | 	    else if(decision != null && decision.equalsIgnoreCase("d")){
  | 	    	
  | 	    	executionContext.getContextInstance().setVariable("decision", decision);
  | 	    	System.out.println("---------PMAssignAction-----d-------3----");
  | 	    	executionContext.getProcessInstance().signal("Denied");
  | 	    	
  | 	    }
  | 	    else{
  | 	    	System.out.println("Error trying to read your decission!..Enter only a/d ");	
  | 	    }
  | 	}
  | }


But unfortunately , this is also not working..... The problem is that once flow reaches the end state by giving denied decision.... it is again coming back to the previous node....

Please find the log below and help me out resolving this.....Thanks..


  | 
  | 16:49:51,530 [main] DEBUG Converters : adding converter 'R', 'org.jbpm.context.exe.converter.SerializableToByteArrayConverter'
  | 16:49:51,530 [main] DEBUG Converters : adding converter 'I', 'org.jbpm.context.exe.converter.IntegerToLongConverter'
  | 16:49:51,530 [main] DEBUG Converters : adding converter 'H', 'org.jbpm.context.exe.converter.ShortToLongConverter'
  | 16:49:51,530 [main] DEBUG Converters : adding converter 'G', 'org.jbpm.context.exe.converter.FloatToDoubleConverter'
  | 16:49:51,540 [main] DEBUG Converters : adding converter 'F', 'org.jbpm.context.exe.converter.FloatToStringConverter'
  | 16:49:51,540 [main] DEBUG Converters : adding converter 'E', 'org.jbpm.context.exe.converter.ByteToLongConverter'
  | Hi............
  | ---------------------1-----------------
  | You are now in node: start
  | ---------------------2-----------------
  | 16:49:51,570 [main] DEBUG GraphElement : event 'before-signal' on 'StartState(start)' for 'Token(/)'
  | 16:49:51,570 [main] DEBUG GraphElement : event 'node-leave' on 'StartState(start)' for 'Token(/)'
  | 16:49:51,570 [main] DEBUG GraphElement : event 'transition' on 'Transition(Test)' for 'Token(/)'
  | 16:49:51,570 [main] DEBUG GraphElement : event 'node-enter' on 'TaskNode(PM_Approval)' for 'Token(/)'
  | 16:49:51,580 [main] DEBUG GraphElement : event 'task-create' on 'Task(PM_Approval)' for 'Token(/)'
  | --------PMAssignAction------------1-------
  | This Node is---PM_Approval
  | Enter your decission: d
  | Thanks for the desission, d
  | ---------PMAssignAction------------2-------
  | 16:49:55,435 [main] DEBUG VariableContainer : update variable 'decision' in 'TokenVariableMap1193779' to value 'd'
  | ---------PMAssignAction-----d-------3----
  | 16:49:55,445 [main] DEBUG GraphElement : event 'before-signal' on 'TaskNode(PM_Approval)' for 'Token(/)'
  | 16:49:55,445 [main] DEBUG GraphElement : event 'node-leave' on 'TaskNode(PM_Approval)' for 'Token(/)'
  | 16:49:55,445 [main] DEBUG GraphElement : event 'transition' on 'Transition(Denied)' for 'Token(/)'
  | 16:49:55,445 [main] DEBUG GraphElement : event 'node-enter' on 'EndState(end)' for 'Token(/)'
  | 16:49:55,445 [main] DEBUG GraphElement : event 'process-end' on 'ProcessDefinition(processdefinition)' for 'Token(/)'
  | 16:49:55,465 [main] DEBUG GraphElement : event 'after-signal' on 'TaskNode(PM_Approval)' for 'Token(/)'
  | 16:49:55,465 [main] DEBUG GraphElement : event 'node-leave' on 'TaskNode(PM_Approval)' for 'Token(/)'
  | 16:49:55,465 [main] DEBUG GraphElement : event 'transition' on 'Transition(Accepted)' for 'Token(/)'
  | 16:49:55,465 [main] DEBUG GraphElement : event 'node-enter' on 'TaskNode(HOD_Approval)' for 'Token(/)'
  | 16:49:55,465 [main] DEBUG GraphElement : event 'task-create' on 'Task(HOD_Approval)' for 'Token(/)'
  | --------HODAssignAction------------1-------
  | This Node is---HOD_Approval
  | Enter your decission: 

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

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



More information about the jboss-user mailing list