jBPM4.4之流程引擎對象ProcessEngine

來源:互聯網
上載者:User

  在jBPM4.4中,所有的服務介面都是通過ProcessEngine對象獲得的。

1、關於ProcessEngine

  1)ProcessEngine通過Configuration類構建,Configuration以單例模式擷取ProcessEngine對象。

/** get the singleton ProcessEngine that is created from the default   * configuration file 'jbpm.cfg.xml'. */  public static ProcessEngine getProcessEngine() {    if (singleton == null) {      synchronized (Configuration.class) {        if (singleton == null) {          singleton = new Configuration().setResource("jbpm.cfg.xml").buildProcessEngine();        }      }    }    return Configuration.singleton;  }

  2)ProcessEngine是安全執行緒的,所有的線程和請求都可以使用同一個ProcessEngine對象。

2、擷取ProcessEngine對象

  1)方式一:使用classpath根目錄下的預設設定檔jbpm.cfg.xml建立一個單例的ProcessEngine。

 ProcessEngine processEngine = Configuration.getProcessEngine();

  2)方式二:指定其他位置的jBPM設定檔,如src根目錄config包下的my-jbpm-cfg.xml。

ProcessEngine processEngine = new Configuration()      .setResource("config/my-jbpm-cfg.xml")      .buildProcessEngine();

3、通過ProcessEngine對象擷取各種服務介面

  1)擷取RepositoryService介面。

RepositoryService repositoryService = processEngine.getRepositoryService();

  RepositoryService----流程資源服務介面。提供對流程定義的部署、查詢、刪除和流程圖查看等操作。

  2)擷取ExecutionService介面。

ExecutionService executionService = processEngine.getExecutionService();

  ExecutionService----流程執行服務介面。提供啟動流程執行個體、推進、刪除等操作。

  3)擷取TaskService介面。

TaskService taskService = processEngine.getTaskService();

  TaskService----人工任務服務介面。提供對任務的建立、提交、查詢、儲存、刪除等操作。

  4)擷取HistoryService介面。

HistoryService historyService = processEngine.getHistoryService();

  HistoryService----流程曆史服務介面。提供對任務的管理操作。提供對流程曆史庫中曆史流程執行個體、曆史活動執行個體等記錄的查詢。

  5)擷取ManagementService介面。

ManagementService managementService = processEngine.getManagementService();

  ManagementService----流程管理控制服務介面。

  6)擷取IdentityService介面。

IdentityService identityService = processEngine.getIdentityService();

  IdentityService----身份認證服務介面。提供對流程使用者、使用者組管理。

 

 

  

 

 

 

 

 

 

 

 

 

 

  

  

  

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.