<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    零全零美(www.zzgwt.com)
    生活中的很多事情,并不像If...Else那么簡單!
    posts - 96,comments - 52,trackbacks - 0
            在閱讀本文之前,建議先閱讀一下《JBPM源碼解讀之:Fork》以了解Fork中Script的配置方法及處理方式:
            按照Fork對Script的規(guī)范Script必須包含一個具有write權(quán)限的變量,而且該變量必須實(shí)現(xiàn)java.util.Collection接口。

    <?xml version="1.0" encoding="UTF-8"?>
    <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="multiChoice">
        
    <start-state name="start">
            
    <transition name="" to="a"></transition>
        
    </start-state>
        
        
    <task-node name="a">
            
    <event type="node-enter">
                
    <script>System.out.println("---enter node a--");</script>
            
    </event>
            
    <transition name="" to="multichoice"></transition>
        
    </task-node>
        
    <fork name="multichoice">
            
    <script>
                
    <variable name="transitionNames" access="write"></variable>
                
    <expression>
                    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" );
                    }
                
    </expression>
            
    </script>
            
    <event type="node-enter">
                
    <script>System.out.println("---enter node fork--");</script>
            
    </event>
            
    <transition name="to b" to="b"></transition>
            
    <transition name="to c" to="c"></transition>
        
    </fork>
        
    <task-node name="b">
            
    <event type="node-enter">
                
    <script>System.out.println("---enter node b--");</script>
            
    </event>
            
    <transition name="" to="syncmerge"></transition>
        
    </task-node>
        
    <task-node name="c">
            
    <event type="node-enter">
                
    <script>System.out.println("---enter node c--");</script>
            
    </event>
            
    <transition name="" to="syncmerge"></transition>
        
    </task-node>
        
    <join name="syncmerge">
            
    <event type="node-enter">
                
    <script>
                    System.out.println("---enter node syncmerge--");
                
    </script>
            
    </event>
            
    <transition name="" to="end"></transition>
        
    </join>
        
    <end-state name="end">
            
    <event type="node-enter">
                
    <script>
                    System.out.println("---enter node end--");
                
    </script>
            
    </event>
        
    </end-state>
    </process-definition>


            附上單元測試代碼:

    import junit.framework.TestCase;

    import org.jbpm.graph.def.ProcessDefinition;
    import org.jbpm.graph.exe.ProcessInstance;
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;

    public class TestFork extends TestCase {

        
    private ProcessDefinition processDefinition;
        
        @Before
        
    public void setUp() throws Exception {
            String xmlPath 
    = "jbpmTest/fork/jpdl/fork.xml";
            processDefinition 
    = ProcessDefinition.parseXmlResource(xmlPath);
        }


        @After
        
    public void tearDown() throws Exception {
        }


        @Test
        
    public void test() {
            ProcessInstance processInstance 
    = new ProcessInstance(processDefinition);
    //        processInstance.getContextInstance().setVariable("scenario", new Integer(1));
    //        processInstance.getContextInstance().setVariable("scenario", new Integer(2));
            processInstance.getContextInstance().setVariable("scenario"new Integer(3));
            processInstance.signal();
        }

        
    }

    posted on 2008-11-05 17:05 零全零美 閱讀(1919) 評論(4)  編輯  收藏 所屬分類: jbpm

    FeedBack:
    # re: JBPM實(shí)踐之:使用Fork中的Script實(shí)現(xiàn)多路路由選擇[未登錄]
    2009-07-14 10:36 | zhang
    你好。我的運(yùn)行報(bào)錯。好像是這個地方。
    <script>
    <variable name="transitionNames" access="write"></variable>
    <expression>
    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" );
    }
    </expression>
    </script>

    錯誤提示:
    10:33:04,453 [main] WARN Script : exception during evaluation of script expression
    Sourced file: inline evaluation of: ``transitionNames=new ArrayList(); if(scenario==1){ transitionNames.add("to b" ); . . . '' : illegal use of undefined variable, class, or 'void' literal : at Line: 1 : in file: inline evaluation of: ``transitionNames=new ArrayList(); if(scenario==1){ transitionNames.add("to b" ); . . . '' : ) {   回復(fù)  更多評論
      
    # re: JBPM實(shí)踐之:使用Fork中的Script實(shí)現(xiàn)多路路由選擇
    2009-08-03 14:32 | tomc
    要怎么解決?  回復(fù)  更多評論
      
    # re: JBPM實(shí)踐之:使用Fork中的Script實(shí)現(xiàn)多路路由選擇
    2009-08-17 21:42 | 阿斯頓
    我也遇到了和樓上一樣的問題,請問該如何解決呢?等待中。。。  回復(fù)  更多評論
      
    # re: JBPM實(shí)踐之:使用Fork中的Script實(shí)現(xiàn)多路路由選擇
    2011-02-23 14:38 | 鄭院生
    我的也是這個問題 不過我的是因?yàn)槌隽藗€小錯 解釋把 access=“write” 寫成了acess=“write”,修改以后就沒事了 民可以再仔細(xì)檢查一下自己的源碼,僅供參考  回復(fù)  更多評論
      
    主站蜘蛛池模板: 亚洲精品狼友在线播放| 国产又大又黑又粗免费视频 | 亚洲国产日韩a在线播放| 曰批视频免费40分钟试看天天| 亚洲人成77777在线播放网站| 色爽黄1000部免费软件下载| 亚洲?V乱码久久精品蜜桃| 在线亚洲精品视频| 亚洲AⅤ无码一区二区三区在线| 欧洲亚洲国产精华液| 免费国产成人高清在线观看麻豆 | 免费看黄福利app导航看一下黄色录像| 日本成人免费在线| 深夜A级毛片视频免费| 亚洲中文字幕视频国产| 国产无遮挡又黄又爽免费网站| 亚洲国产AV无码专区亚洲AV| 香蕉免费一区二区三区| 亚洲第一页在线观看| 免费av欧美国产在钱| 羞羞视频免费网站入口| 在线亚洲午夜理论AV大片| 中文字幕无码日韩专区免费| 亚洲午夜精品国产电影在线观看| 最近中文字幕mv手机免费高清| 成a人片亚洲日本久久| 亚洲欧洲∨国产一区二区三区| 99re免费视频| 亚洲欧美国产日韩av野草社区| 亚洲成a人片在线观看久| a级毛片免费全部播放| 亚洲妇女熟BBW| 亚洲国产精品专区在线观看| 永久免费A∨片在线观看| 亚洲国产成人精品无码区在线秒播 | 国产精品亚洲综合网站| 亚洲国产精品无码专区在线观看| 色影音免费色资源| 一边摸一边爽一边叫床免费视频 | 久久99亚洲综合精品首页| 97久久免费视频|