1.工作流引擎 ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); 這是獲取工作流引擎的方式 ,根據後面的方法意思是 獲取(get) 默認的(Default) 工作流引擎 (ProcessEngine)
2. 我們導入源碼進入到 getDefaultProcessEngine() 方法中 看到有一個 init() 方法 我們跳到 init() 方法裏面去
來到 init() 方法裏面 看到 resources = classLoader.getResources("activiti.cfg.xml"); 這麼一段代碼,這裏會加載 配置文件,所以爲什麼要把 配置文件取名爲 activiti.cfg.xml ,就是這個原因,默認名稱 如果沒有表的話,這裏也會去創建的 ,然後我們就獲得了流程引擎對象
3. ProcessEngine
流程引擎對象是activiti的核心 它操作者 7個接口來 處理 各個表 之間的業務邏輯
org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl 這個類中,就可以看到這些接口服務
protected RepositoryService repositoryService = new RepositoryServiceImpl();
protected RuntimeService runtimeService = new RuntimeServiceImpl();
protected HistoryService historyService = new HistoryServiceImpl(this);
protected IdentityService identityService = new IdentityServiceImpl();
protected TaskService taskService = new TaskServiceImpl(this);
protected FormService formService = new FormServiceImpl();
protected ManagementService managementService = new ManagementServiceImpl();
protected DynamicBpmnService dynamicBpmnService = new DynamicBpmnServiceImpl(this);
還有關於這 28 張表的接口(interface)
我們進入到其中的一個 接口裏面 ,不難看出是使用Mybatis的寫法
重點就在於 7 大服務到底各自代表着什麼?,各自處理着什麼?,各自對應着什麼?
服務名稱 | 服務英文意思 | 服務中文意思 |
RepositoryService | Service providing access to the repository of process definitions and deployments | 服務提供過程定義和部署的存儲庫 |
HistoryService | Service exposing information about ongoing and past process instances. This is different from the runtime information in the sense that this runtime information only contains the actual runtime state at any given moment and it is optimized for runtime process execution performance. The history information is optimized for easy querying and remains permanent in the persistent storage. | 服務公開信息進行和過去的流程實例。這不同於運行時信息,這個運行時信息只包含實際的運行時狀態在任何給定的時刻,它是運行時流程執行性能的優化。歷史信息,便於查詢和優化是永久的持久存儲。 |
IdentityService | Service to manage {@link User}s and {@link Group}s. | 服務管理{ @link用戶}和{ @link組織/部門}。 |
TaskService | Service which provides access to {@link Task} and form related operations. | 服務提供訪問{ @link任務},形成相關操作。 |
FormService | Access to form data and rendered forms for starting new process instances and completing tasks | 對錶單數據的訪問和呈現形式,從而創建新的流程實例,完成任務。 |
ManagementService | Service for admin and maintenance operations on the process engine.These operations will typically not be used in a workflow driven application, but are used in for example the operational console. | 服務管理和維護操作流程引擎,這些操作通常不應用在工作流驅動的應用程序中,但是用於例如操作控制檯。 |
DynamicBpmnService | Service providing access to the repository of process definitions and deployments. | 這些操作通常不應用在工作流驅動的應用程序中,但是用於例如操作控制檯。 |