[jboss-user] [JBoss jBPM] - Re: JBPM Decision node implementation with Decision handler

dabd do-not-reply at jboss.com
Mon Jun 25 04:45:52 EDT 2007


"nageshreddy1981" wrote : Hi,
  | 
  | I am new to JBPM.
  | I am trying to implement decision node in process definiton.
  | where can i find the examples for the decision node with the decision handler implemetation.
  | Can anybody provide me with examples or links on the same.
  | 
  | Thanks in advance


I'm a newbie too but here's what I did:

Implement the interface DecisionHandler and implement the 'decide' method which returns the appropriate transition.

public class MyDecisionHandler implements DecisionHandler {
  | 
  | 	/**
  | 	 * Comment for <code>serialVersionUID</code>
  | 	 */
  | 	private static final long serialVersionUID = 1L;
  | 
  | 	
  | 	
  | 	public String decide(ExecutionContext executionContext) throws Exception {
  | 		String lower = (String) executionContext.getContextInstance().getVariable("lower");
  | 		String upper = (String) executionContext.getContextInstance().getVariable("upper");
  | 		
  | 		if ((Integer.parseInt(upper) - Integer.parseInt(lower)) > 10) {
  | 			return "yes";
  | 		}
  | 		else {
  | 			return "no";
  | 		}
  | 
  | 	}
  | 

Currently you can't use the GPD to associate the handler to the decision node, so you have to edit the process definition XML by hand like this:

<decision name="checkDiff">
  |       <transition name="yes" to="doSomething">
  |       </transition>
  |       <transition name="nao" to="doSomethingElse"></transition>
  |       <handler class="com.decisions.MyDecisionHandler"></handler>
  |    </decision>



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

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



More information about the jboss-user mailing list