|  |  | 
  
    | jbpm3与发散模型 |  
    |  |  
    |  |  
    | 作者:未知  来源:月光软件站  加入时间:2005-2-28 月光软件站 |  
    | 1)Parallel Split由fork来实现对于fork后面的多个分支,jbpm保证它们是同步enabled
2)exclusive choice由decision来实现在流程定义中,要加入bsh脚本,下面是jbpm解析脚本的方法:
 Script script = new Script();
 script.setResultVariableName("transitionName");
 script.setStatements(
 "if ( scenario == 1 ) { " +
 "  transitionName = \"to b\"; " +
 "} else if ( scenario == 2 ) {" +
 "  transitionName = \"to c\"; " +
 "}" );
 然后,jbpm把script加入到流程定义中:
 Decision decision = (Decision) pd.getNode("xor");
 decision.setScript( script );
 在流程运行过程中,通过环境实例为脚本中的变量赋值:
 ci.setVariable( "scenario", new Integer(1) );
 jbpm就能够根据变量的值确定流程的流转.
3)multiple choice也通过decision来实现与上面不同的是,结果变量不再是一个串,而是一个数组:
 script.setStatements(
 "transitionNames = new ArrayList();" +
 "if ( scenario == 1 ) {" +
 "  transitionNames.add( \"to b\" );" +
 "} else if ( scenario == 2 ) {" +
 "  transitionNames.add( \"to c\" );" +
 "} else if ( scenario >= 3 ) {" +
 "  transitionNames.add( \"to b\" );" +
 "  transitionNames.add( \"to c\" );" +
 "}" );
 
 
 
 |  
    |  |  
    | 相关文章:
 相关软件: |  |