jbpm支持http://blog.csdn.net/hongbo781202/archive/2004/07/12/39393.aspx中提到的三种发散模型: 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/" );" + "}" );