风人园

弱水三千,只取一瓢,便能解渴;佛法无边,奉行一法,便能得益。
随笔 - 99, 文章 - 181, 评论 - 56, 引用 - 0
数据加载中……

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,这样就可以通过代码动态控制流程。

posted on 2007-01-18 14:18 风人园 阅读(504) 评论(0)  编辑  收藏 所属分类: jBPM


只有注册用户登录后才能发表评论。


网站导航: