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

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

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

    Java瑣事

    -I am not alone
    posts - 54, comments - 30, trackbacks - 0, articles - 1
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    手動發布流程定義(jbpm3)

    Posted on 2011-04-27 17:19 石子路口 閱讀(1761) 評論(0)  編輯  收藏 所屬分類: 工作流
         上一個文章介紹了在啟動tomat服務的時候自動發布流程。這里介紹如何手動的把定義好的processdefinition.xml持久化到數據庫中。這里使用的是junit測試代碼

    1. 建兩個包cn.edu.ujn.wsjx.test.process以及cn.edu.ujn.wsjx.test.service
    2. 在service包中新建測試基類BaseServiceTest.java
     1package cn.edu.ujn.wsjx.test.service;
     2
     3import org.springframework.context.ApplicationContext;
     4import org.springframework.context.support.ClassPathXmlApplicationContext;
     5
     6import junit.framework.TestCase;
     7
     8public class BaseServiceTest extends TestCase
     9{
    10    protected ApplicationContext context;
    11    
    12    public ApplicationContext getApplicationContext()
    13    {
    14        return context;
    15    }

    16
    17    @Override
    18    protected void setUp() throws Exception
    19    {
    20        // TODO Auto-generated method stub
    21        super.setUp();
    22
    23        context = new ClassPathXmlApplicationContext(new String[]
    24        "spring/applicationContext.xml""spring/applicationContext-jbpm.xml",
    25                "spring/applicationContext-shi.xml""spring/applicationContext-wu.xml",
    26                "spring/applicationContext-zhou.xml""spring/daoContext.xml" }
    );
    27    }

    28}

    29
    3. 在包process中新建類ProcessDeployTest繼承上面的類
    package cn.edu.ujn.wsjx.test.process;

    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.zip.ZipInputStream;

    import org.jbpm.JbpmConfiguration;
    import org.jbpm.JbpmContext;
    import org.jbpm.graph.def.ProcessDefinition;

    import cn.edu.ujn.wsjx.test.service.BaseServiceTest;

    public class ProcessDeployTest extends BaseServiceTest
    {
        
    public void testAddProcessDefinition()
        
    {
            JbpmConfiguration jbpmConfiguration 
    = (JbpmConfiguration)context.getBean("jbpmConfiguration");
            JbpmContext jbpmContext 
    = jbpmConfiguration.createJbpmContext();
            
            
    try
            
    {
                File file 
    = new File("E:/work/work.zip");
                FileInputStream fis 
    = new FileInputStream(file);
                ZipInputStream zip 
    = new ZipInputStream(fis);
                
                ProcessDefinition processDefinition 
    = ProcessDefinition.parseParZipInputStream(zip);
                
                jbpmContext.deployProcessDefinition(processDefinition);
            }
    catch(FileNotFoundException e)
            
    {
                e.printStackTrace();
            }
    finally
            
    {
                jbpmContext.close();
            }

            
        }

        
        
    public void testDestroyProcess()
        
    {
            JbpmConfiguration jbpmConfiguration 
    = (JbpmConfiguration)context.getBean("jbpmConfiguration");
            JbpmContext jbpmContext 
    = jbpmConfiguration.createJbpmContext();
            
            jbpmContext.getGraphSession().deleteProcessDefinition(
    1);
            
            jbpmContext.close();
        }

    }

    說明:testAddProcessDefinition()是發布流程定義的zip包到數據庫中,testDestroyProcess()是通過數據庫中存儲的流程id刪除相應的流程
    主站蜘蛛池模板: 日韩亚洲国产综合久久久| 国产成人精品久久免费动漫| 国产精品免费看久久久久| 亚洲五月综合缴情婷婷| 7m凹凸精品分类大全免费| 久久亚洲国产视频| 人妻丰满熟妇无码区免费 | 亚洲va中文字幕无码| 色欲aⅴ亚洲情无码AV蜜桃| 成人免费无码大片A毛片抽搐| 亚洲一区二区三区精品视频| 成年免费大片黄在线观看岛国| 亚洲国产成人综合| 精品久久久久国产免费| 亚洲精华液一二三产区| 日韩高清在线免费看| 免费人成再在线观看网站| 亚洲欧洲久久av| 成人性生交大片免费看好| 亚洲综合婷婷久久| 久久精品免费一区二区喷潮 | 亚洲视频2020| 24小时免费直播在线观看| 学生妹亚洲一区二区| 国产在线98福利播放视频免费| 一级特黄特色的免费大片视频| 在线亚洲精品福利网址导航| 成人性生交大片免费看好| 亚洲国产视频网站| 免费网站看v片在线香蕉| 一级做a毛片免费视频| 国产亚洲av片在线观看播放| 91免费在线播放| 国产精品亚洲一区二区三区| 久久亚洲中文字幕精品一区四 | 亚洲色偷偷偷综合网| 亚洲不卡无码av中文字幕| 日本免费在线观看| 亚洲av无码专区亚洲av不卡| 日韩亚洲欧洲在线com91tv| 免费看美女裸露无档网站|