[jboss-user] [JBoss jBPM] - Re: Problem with multiple end-states

efip10 do-not-reply at jboss.com
Thu Jul 12 04:29:10 EDT 2007


I use multiple end-states, and it works. 

As outlined in "Node responsibilities" in userguide, only the node action can decide on which transition to take. In event action, you cannot take this decision.

	<node name="check-suspend-or-abort">
  | 		<action class="com.qq.DecideIfSuspendedOrAbortedAction" />
  | 		<transition to="continue" /> 
  | 		<transition to="error" name="error"/>		
  | 		<transition to="suspended" name="suspended"/>
  | 		<transition to="aborted" name="aborted"/>
  | 	</node>
  | 
  | 	<end-state name="aborted">
  | 	</end-state>
  | 
  | 	<end-state name="suspended">
  | 	</end-state>
  | 
  | 	<end-state name="error">
  | 	</end-state>
  | 

Here's the action:

	public void execute(ExecutionContext ctx) throws Exception {
  | 		Map params = ctx.getContextInstance().getVariables();
  | 
  | 		// check if aborted - invoke my function
  | 		if (isAbortedFlagForWorkflow()) {
  | 			// do something
  | 			ctx.getToken().signal("aborted");
  | 		} else
  | 			// check if suspended
  | 		if (isSuspendedFlagForWorkflow()) {
  | 			// do something
  | 			ctx.getToken().signal("suspended");
  | 		} else {
  | 			// everything is OK, we may start the workflow
  | 			// leave over default transition
  | 			ctx.getToken().signal();
  | 		}
  | 	}
  | 

Hope it helps.

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

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



More information about the jboss-user mailing list