jBPM之Custom node behaviour

jBPM之Custom node behaviour

在流程中会涉及到很多的分支结构,下面就用代码说明
public   class  AmountUpdate  implements  ActionHandler  {
  
public void execute(ExecutionContext ctx) throws Exception {
    
// business logic
    Float erpAmount = get amount from erp-system;
    Float processAmount 
= (Float) ctx.getContextInstance().getVariable("amount");
    
float result = erpAmount.floatValue() + processAmount.floatValue();
    update erp
-system with the result;
    
    
// graph execution propagation
    if (result > 5000{
      ctx.leaveNode(ctx, 
"big amounts");
    }
 else {
      ctx.leaveNode(ctx, 
"small amounts");
    }

  }

}
leaveNode (java.lang.String transitionName)
          leave this node over the given transition.
通过ctx的 leaveNode方法,来确定下一个node,这样就可以通过代码动态控制流程。

你可能感兴趣的:(jBPM之Custom node behaviour)