jbpm3與發散模型

來源:互聯網
上載者:User
jbpm支援http://blog.csdn.net/hongbo781202/archive/2004/07/12/39393.aspx
中提到的三種發散模型:1)Parallel Split由fork來實現
對於fork後面的多個分支,jbpm保證它們是同步enabled2)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/" );" +
      "}" );

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.