activiti 工作流学习 3

     1.工作流引擎  ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();  这是获取工作流引擎的方式 ,根据后面的方法意思是 获取(get) 默认的(Default) 工作流引擎 (ProcessEngine)

     2. 我们导入源码进入到 getDefaultProcessEngine() 方法中 看到有一个 init() 方法 我们跳到 init() 方法里面去

activiti 工作流学习 3

 

      来到 init() 方法里面 看到  resources = classLoader.getResources("activiti.cfg.xml"); 这么一段代码,这里会加载 配置文件,所以为什么要把 配置文件取名为 activiti.cfg.xml ,就是这个原因,默认名称 如果没有表的话,这里也会去创建的 ,然后我们就获得了流程引擎对象

 activiti 工作流学习 3

    3. ProcessEngine   

 流程引擎对象是activiti的核心  它操作者 7个接口来 处理 各个表 之间的业务逻辑

org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl  这个类中,就可以看到这些接口服务

activiti 工作流学习 3

  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)

activiti 工作流学习 3

我们进入到其中的一个 接口里面 ,不难看出是使用Mybatis的写法

activiti 工作流学习 3

    重点就在于 7 大服务到底各自代表着什么?,各自处理着什么?,各自对应着什么?

 

Activiti 工作流引擎 七大服务
服务名称 服务英文意思  服务中文意思
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. 这些操作通常不应用在工作流驱动的应用程序中,但是用于例如操作控制台。