Activiti工作流学习(一)——Activiti服务类

Activity有9个service
1.DynamicBpmnService动态Bpmn服务
Service providing access to the repository of process definitions and deployments.
服务提供对流程定义和部署的存储库的访问。

这个服务是5.19版本后新增的一个服务,和RepositoryService的作用相似,都是与流程定义有关,但是却完全不同。从名字上来看是动态的BPMN服务,看里面的方法都是改变流程的相关属性。这个方法就可以直接操作流程定义,而不需要读取模型,再设计部署(一个流程基本要经过创建模型,设计画图,生产BPMN的XML文件,再部署成流程定义,这个服务就可以直接操作流程定义,不会改变原本的文件,个人感觉可能会带来一些的问题,但是目前对于流程流转内部实现还没有完全理解,使用要谨慎,比如有的流程正在运行老版本的定义,这个时候改变流程定义,接下来怎么流转之类的都是问题)。
2.EngineService引擎服务
Interface implemented by all classes that expose the Activiti services.
接口实现的所有类都公开了Activiti服务。

一共提供了9个接口

//获取RepositoryService
RepositoryService getRepositoryService();
//获取RuntimeService
RuntimeService getRuntimeService();
//获取FormService
FormService getFormService();
//获取TaskService
TaskService getTaskService();
//获取HistoryService
HistoryService getHistoryService();
//获取IdentityService
IdentityService getIdentityService();
//获取ManagementService
ManagementService getManagementService();
//获取DynamicBpmnService
DynamicBpmnService getDynamicBpmnService();
//获取流程引擎配置
ProcessEngineConfiguration getProcessEngineConfiguration();

其中8个接口是用来获取其他Service的,1个接口用来获取流程引擎配置
用引擎获取其他service方法

ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();//获取引擎
DynamicBpmnService dbService =  processEngine.getDynamicBpmnService();//获取需要的Service


3.FormService表单服务
Access to form data and rendered forms for starting new process instances and completing tasks.
访问表单数据和呈现表单以启动新的流程实例和完成任务。


4.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.
服务公开正在进行的和过去的流程实例的信息。
这与运行时信息不同,因为这个运行时信息只包含任何给定时刻的实际运行时状态,并且对运行时流程执行性能进行了优化。
历史信息是为了便于查询而优化的,并且在持久存储中保持永久不变。


5.IdentityService身份服务
Service to manage {@link User}s and {@link Group}s.
服务来管理{@link用户}和{@link组}。


6.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.
服务于流程引擎上的管理和维护操作。
这些操作通常不会在工作流驱动的应用程序中使用,
但是在操作控制台中使用。


7.RepositoryService库服务
Service providing access to the repository of process definitions and deployments.
服务提供对流程定义和部署的存储库的访问。


8.RuntimeService运行时服务
Starts a new process instance in the latest version of the process definition with the given key..
使用给定的键在流程定义的最新版本中启动一个新的流程实例。


9.TaskService任务服务
Service which provides access to {@link Task} and form related operations.
提供访问{@link任务}和表单相关操作的服务。

原文地址:https://www.cnblogs.com/cxiang/p/11189491.html