Workflow Introduction
What is a workflow
This simply means that the process works, here refers to the process to complete a specific business enterprise of a series of work steps , all the steps together are the business from the beginning to the end of the transfer process.
From the perspective of a computer system in terms of workflow system, it said: part of overall business processes and computer applications in environments automate operations
Three elements of the workflow
Workflow Example - leave
Composition workflow system
Related concepts Workflow
Activiti5 Profile
The origin of Activiti5 framework
JBPM
, Stands Java Business Process Management
(Business Process Management), which is covered by the Business Process Management, an open source in the field of workflow, collaboration services, flexible, and extensible framework executable process language. JBPM
It is the open source project.
JBPM 2004 October 18, released version 2.0, and joined the same day JBoss
, has become JBoss
an integral part of the enterprise middleware platform, and its name is also changed JBoss jBPM
.
In the JBPM4
following, the company planning software for the occurrence of differences, so when the project architect from the original company, to join the new company, the name changed Activiti5
.
JBPM
Using Hibernte
(JBPM core has undergone great changes)
Activiti5
Using MyBatis
(MyBatis 3, 1 and 2 are called iBatis)
Activiti5 composition
The ProcessEngine : This class is the core of Activiti5, all services need to be created by ProcessEngine, the class is thread-safe
Activiti5 persistence layer uses Mybatis, so good portability
Activiti5主要包括7个Service,这些Service都是通过ProcessEngine创建
repositoryService:(持久化服务) 与数据库进行交互的
runtimeService:(运行时服务) 与运行流程有关
formService:(表单服务)
identityService:(身份信息)
taskService:(任务服务) 与流程中的每一个步骤有关
historyService:(历史信息) 查看历史的流程步骤
managementService:(管理定时任务)在固定的时间点完成固定的任务
Activiti5框架表结构
Activiti使用到的表都是ACT_开头的。默认会生成25张表。
ACT_RE_*
: ‘RE’表示repository
(存储),RepositoryService
接口所操作的表。带此前缀的表包含的是静态信息,如,流程定义,流程的资源(图片,规则等)。
ACT_RU_*
: ‘RU’表示runtime
,运行时表-RuntimeService
。这是运行时的表存储着流程变量,用户任务,变量,职责(job)等运行时的数据。Activiti只存储实例执行期间的运行时数据,当流程实例结束时,将删除这些记录。这就保证了这些运行时的表小且快。
ACT_ID_*
: ’ID’表示identity
(组织机构),IdentityService
接口所操作的表。用户记录,流程中使用到的用户和组。这些表包含标识的信息,如用户,用户组,等等。
ACT_HI_*
: ’HI’表示history
,历史数据表,HistoryService
。就是这些表包含着流程执行的历史相关数据,如结束的流程实例,变量,任务,等等。
ACT_GE_*
: 全局通用数据及设置(general),各种情况都使用的数据。
Activiti5框架表详解
表明 | 数据 |
---|---|
act_ge_bytearray | 二进制数据表 |
act_ge_property | 属性数据表存储整个流程引擎级别的数据,初始化表结构时,会默认插入三条记录 |
act_hi_actinst | 历史节点表 |
act_hi_attachment | 历史附件表 |
act_hi_comment | 历史意见表 |
act_hi_identitylink | 历史流程人员表 |
act_hi_detail | 历史详情表,提供历史变量的查询 |
act_hi_procinst | 历史流程实例表 |
act_hi_taskinst | 历史任务实例表 |
act_hi_varinst | 历史变量表 |
act_id_group | 用户组信息表 |
act_id_membership | 用户与用户组对应信息表 |
act_id_user | 用户信息表 |
act_re_deployment | 部署信息表 |
act_re_model | 流程设计模型部署表 |
act_re_procdef | 流程定义数据表 |
act_ru_event_subscr 、throwEvent、catchEvent | 时间监听信息表 |
act_ru_execution | 运行时流程执行实例表 |
act_ru_identitylink | 运行时流程人员表,主要存储任务节点与参与者的相关信息 |
act_ru_job | 运行时定时任务数据表 |
act_ru_task | 运行时任务节点表 |
act_ru_variable | 运行时流程变量数据表 |
流程的相关概念
流程定义
部署流程后,数据库中会有3张表的数据发生变化,用于存储当前部署及流程定义相关的数据,图形,文件内容
流程实例
流程实例其实就是流程定义的具体应用,通过startXXXXX方法启动流程实例,
启动流程后,会在RU表及HI表中增加相应的数据
任务
所谓的任务其实就是流程中的工作步骤,可以将任务委派给某个人完成,也可以委派给某个小组后再分配给个人完成,当流程中所有的任务完成后,流程结束。
开始,结束
流程的边界,由框架自动完成,不需要人工参与
变量
将流程中固定不变的内容通过变量来表示,可以让流程更具备通用性
EL expressions used in the process defined in FIG (${tl})
incrementing the variable, the process variable transmission at start
Map<String, Object> var = new HashMap<String, Object>() ;
var.put(“tl”, “zhangsan”);
Gateway
The gateway determines that the branch flow can be increased in the process definition determination condition implemented in FIG.
Framework gateway is divided into three kinds:
Exclusive gateway : a plurality of logical branches can only be executed at the same time a branch is finished, the process ends
Parallel gateway : simultaneously performing a plurality of logical branches, a branch of the finished, the process does not end, it is necessary to wait for the implementation of the other branches, the branches of all the finished, the process ends
The gateway comprising : a plurality of logical branches if the condition is true, then the gateway is equivalent to the exclusive, if a plurality of conditions are satisfied, then the gateway is equivalent to parallel.