Activiti 用户手册
v 5.21.0
Table of Contents
1. 简介
1.1. 协议
1.2. 下载
1.3. 源码
1.4. 必要的软件
1.4.1. JDK 6+
1.4.2. Eclipse Indigo 和 Juno
1.5. 反馈问题
1.6. 实验性功能
1.7. 内部实现类
2. 开始
2.1. 一分钟入门
2.2. Activiti安装
2.3. Activiti数据库配置
2.4. 引入Activiti jar与依赖
2.5. 下一步
3. 配置 Configuration
3.1. 创建ProcessEngine Creating a ProcessEngine
3.2. ProcessEngineConfiguration bean
3.3. 数据库配置 Database configuration
3.4. JNDI数据源配置 JNDI Datasource Configuration
3.4.1. 使用 Usage
3.4.2. 配置 Configuration
3.5. 支持的数据库 Supported databases
3.6. 创建数据库表 Creating the database tables
3.7. 数据库表名说明 Database table names explained
3.8. 数据库升级 Database upgrade
3.9. 作业执行器与异步执行器(从5.17.0版本起) Job Executor and Async Executor (since version 5.17.0)
3.10. 启用作业执行器 Job executor activation
3.11. 启用异步执行器 Async executor activation
3.12. 配置邮件服务器 Mail server configuration
3.13. 配置历史 History configuration
3.14. 配置在表达式与脚本中暴露的bean Exposing configuration beans in expressions and scripts
3.15. 配置部署缓存 Deployment cache configuration
3.16. 日志 Logging
3.17. 映射诊断上下文 Mapped Diagnostic Contexts
3.18. 事件处理器 Event handlers
3.18.1. 事件监听器实现 Event listener implementation
3.18.2. 配置与安装 Configuration and setup
3.18.3. 在运行时增加监听器 Adding listeners at runtime
3.18.4. 为流程定义增加监听器 Adding listeners to process definitions
执行用户定义逻辑的监听器 Listeners executing userdefined logic
抛出BPMN事件的监听器 Listeners throwing BPMN events
关于流程定义监听器的说明 Notes on listeners on a processdefinition
3.18.5. 通过API分发事件 Dispatching events through API
3.18.6. 支持的事件类型 Supported event types
3.18.7. 附加信息 Additional remarks
4. The Activiti API
4.1. 流程引擎API与服务 The Process Engine API and services
4.2. 异常策略 Exception strategy
4.3. 使用Activiti services(Working with the Activiti services)
4.3.1. 部署流程 Deploying the process
4.3.2. 启动流程实例 Starting a process instance
4.3.3. 完成任务 Completing tasks
4.3.4. 暂停与激活流程 Suspending and activating a process
4.3.5. 扩展阅读 Further reading
4.4. 查询API (Query API)
4.5. 变量 Variables
4.6. 表达式 Expressions
4.7. 单元测试 Unit testing
4.8. Debug单元测试(Debugging unit tests)
4.9. Web应用中的流程引擎 The process engine in a web application
5. 集成Spring (Spring integration)
5.1. ProcessEngineFactoryBean
5.2. 事务 Transactions
5.3. 表达式 Expressions
5.4. 自动部署资源 Automatic resource deployment
5.5. 单元测试 Unit testing
5.6. 通过Hibernate 4.2.x使用JPA (JPA with Hibernate 4.2.x)
5.7. Spring Boot
5.7.1. 兼容性 Compatibility
5.7.2. 开始 Getting started
5.7.3. 更换数据源与连接池 Changing the database and connection pool
5.7.4. REST支持 (REST support)
5.7.5. JPA支持 (JPA support)
5.7.6. 扩展阅读 Further Reading
6. 部署 Deployment
6.1. 业务存档 Business archives
6.1.1. 编程方式部署 Deploying programmatically
6.1.2. 使用Activiti Exploreer部署 (Deploying with Activiti Explorer)
6.2. 外部资源 External resources
6.2.1. Java类 Java classes
6.2.2. 在流程中使用Spring bean (Using Spring beans from a process)
6.2.3. 创建单独应用 Creating a single app
6.3. 流程定义的版本 Versioning of process definitions
6.4. 提供流程图 Providing a process diagram
6.5. 生成流程图 Generating a process diagram
6.6. 类别 Category
7. BPMN 2.0介绍 BPMN 2.0 Introduction
7.1. BPMN是什么? What is BPMN?
7.2. 定义流程 Defining a process
7.3. 准备:十分钟教程 Getting started: 10 minute tutorial
7.3.1. 先决条件 Prerequisites
7.3.2. 目标 Goal
7.3.3. 用例 Use case
7.3.4. 流程图 Process diagram
7.3.5. XML表现 XML representation
7.3.6. 启动流程实例 Starting a process instance
7.3.7. 任务列表 Task lists
7.3.8. 申领任务 Claiming the task
7.3.9. 完成任务 Completing the task
7.3.10. 结束流程 Ending the process
7.3.11. 代码总结 Code overview
7.3.12. 继续提高 Future enhancements
8. BPMN 2.0 结构 BPMN 2.0 Constructs
8.1. 自定义扩展 Custom extensions
8.2. 事件 Events
8.2.1. 事件定义 Event Definitions
8.2.2. 定时器事件定义 Timer Event Definitions
8.2.3. 错误事件定义 Error Event Definitions
8.2.4. 信号事件定义 Signal Event Definitions
抛出信号事件 Throwing a Signal Event
捕获信号事件 Catching a Signal Event
查询信号事件订阅 Querying for Signal Event subscriptions
信号事件范围 Signal event scope
信号事件示例 Signal Event example(s)
8.2.5. 消息事件定义 Message Event Definitions
抛出消息事件 Throwing a Message Event
查询消息事件订阅 Querying for Message Event subscriptions
消息事件示例 Message Event example(s)
8.2.6. 启动事件 Start Events
8.2.7. 空启动事件 None Start Event
描述 Description
图示 Graphical notation
XML表示 XML representation
空启动事件的自定义扩展 Custom extensions for the none start event
8.2.8. 定时器启动事件 Timer Start Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.9. 消息启动事件 Message Start Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.10. 信号启动事件 Signal Start Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.11. 错误启动事件 Error Start Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.12. 结束事件 End Events
8.2.13. 空结束事件 None End Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.14. 错误结束事件 Error End Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.15. 终止结束事件 Terminate End Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.16. 取消结束事件 Cancel End Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.17. 边界事件 Boundary Events
8.2.18. 定时器边界事件 Timer Boundary Event
描述 Description
图示 Graphical Notation
XML表示 XML Representation
边界事件的已知问题 Known issue with boundary events
8.2.19. 错误边界事件 Error Boundary Event
描述 Description
图示 Graphical notation
XML表示 Xml representation
示例 Example
8.2.20. 信号边界事件 Signal Boundary Event
描述 Description
图示 Graphical notation
XML表示 XML representation
示例 Example
8.2.21. 消息边界事件 Message Boundary Event
描述 Description
图示 Graphical notation
XML表示 XML representation
示例 Example
8.2.22. 取消边界事件 Cancel Boundary Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.23. 补偿边界事件 Compensation Boundary Event
描述 Description
图示 Graphical notation
XML表示 XML representation
8.2.24. 捕获中间事件 Intermediate Catching Events
8.2.25. 定时器捕获中间事件 Timer Intermediate Catching Event
描述 Description
图示 Graphical Notation
XML表示 XML Representation
8.2.26. 信号捕获中间事件 Signal Intermediate Catching Event
描述 Description
图示 Graphical notation
XML表示 XML representation
示例 Example
8.2.27. 消息捕获中间事件 Message Intermediate Catching Event
描述 Description
图示 Graphical notation
XML表示 XML representation
示例 Example
8.2.28. 抛出中间事件 Intermediate Throwing Event
8.2.29. 空抛出中间事件 Intermediate Throwing None Event
8.2.30. 信号抛出中间事件 Signal Intermediate Throwing Event
描述 Description
图示 Graphical notation
XML表示 XML representation
示例 Example
8.2.31. 补偿抛出中间事件 Compensation Intermediate Throwing Event
描述 Description
图示 Graphical notation
Xml representation
8.3. 顺序流 Sequence Flow
8.3.1. 描述 Description
8.3.2. 图示 Graphical notation
8.3.3. XML表示 XML representation
8.3.4. 条件顺序流 Conditional sequence flow
描述 Description
图示 Graphical notation
XML表示 XML representation
8.3.5. 默认顺序流 Default sequence flow
描述 Description
图示 Graphical notation
XML表示 XML representation
8.4. 网关 Gateways
8.4.1. 排他网关 Exclusive Gateway
描述 Description
图示 Graphical notation
XML表示 XML representation
8.4.2. 并行网关 Parallel Gateway
描述 Description
图示 Graphical Notation
XML表示 XML representation
8.4.3. 包容网关 Inclusive Gateway
描述 Description
图示 Graphical Notation
XML表示 XML representation
8.4.4. 基于事件的网关 Eventbased Gateway
描述 Description
图示 Graphical notation
XML表示 XML representation
示例 Example(s)
8.5. 任务 Tasks
8.5.1. 用户任务 User Task
描述 Description
图示 Graphical notation
XML表示 XML representation
到期日期 Due Date
用户指派 User assignment
用于任务指派的Activiti扩展 Activiti extensions for task assignment
自定义身份联系类型(试验特性) Custom identity link types (Experimental)
通过任务监听器自定义指派 Custom Assignment via task listeners
8.5.2. 脚本任务 Script Task
描述 Description
图示 Graphical Notation
XML表示 XML representation
脚本中的变量 Variables in scripts
脚本结果 Script results
安全性 Security
8.5.3. Java服务任务 Java Service Task
描述 Description
图示 Graphical Notation
XML表示 XML representation
实现 Implementation
字段注入 Field Injection
字段注入与线程安全 Field injection and thread safety
服务任务的结果 Service task results
处理异常 Handling exceptions
抛出BPMN错误 Throwing BPMN Errors
异常映射 Exception mapping
异常顺序流 Exception Sequence Flow
在JavaDelegate中使用Activiti服务 Using an Activiti service from within a JavaDelegate
8.5.4. Web服务任务 Web Service Task
描述 Description
图示 Graphical Notation
XML表示 XML representation
Web服务任务IO规范 Web Service Task IO Specification
Web服务任务数据输入关联 Web Service Task data input associations
Web服务任务数据输出关联 Web Service Task data output associations
8.5.5. 业务规则任务 Business Rule Task
描述 Description
图示 Graphical Notation
XML表示 XML representation
8.5.6. 邮件任务 Email Task
邮件服务器配置 Mail server configuration
定义邮件任务 Defining an Email Task
使用示例 Example usage
8.5.7. Mule任务 Mule Task
定义Mule任务 Defining an Mule Task
使用示例 Example usage
8.5.8. Camel任务 Camel Task
定义Camel任务 Defining a Camel Task
简单Camel调用示例 Simple Camel Call example
连通性测试 Ping Pong example
返回变量 Returning back the variables
异步连通性测试 Asynchronous Ping Pong example
从Camel路由实例化工作流 Instantiate workflow from Camel route
8.5.9. 手动任务 Manual Task
描述 Description
图示 Graphical Notation
XML表示 XML representation
8.5.10. Java接收任务 Java Receive Task
描述 Description
图示 Graphical notation
XML表示 XML representation
8.5.11. Shell任务 Shell Task
描述 Description
定义Shell任务 Defining a shell task
使用示例 Example usage
8.5.12. 执行监听器 Execution listener
执行监听器上的字段注入 Field injection on execution listeners
8.5.13. 任务监听器 Task listener
8.5.14. 多实例 Multiinstance (for each)
描述 Description
图示 Graphical notation
XML表示 Xml representation
边界事件与多实例 Boundary events and multiinstance
多实例与执行监听器 Multi instance and execution listeners
8.5.15. 补偿处理器 Compensation Handlers
描述 Description
图示 Graphical notation
XML表示 XML representation
8.6. 子流程与调用活动 SubProcesses and Call Activities
8.6.1. 子流程 SubProcess
描述 Description
图示 Graphical Notation
XML表示 XML representation
8.6.2. 事件子流程 Event SubProcess
描述 Description
图示 Graphical Notation
XML表示 XML representation
示例 Example
8.6.3. 事务子流程 Transaction subprocess
描述 Description
图示 Graphical Notation
XML表示 XML representation
示例 Example
8.6.4. 调用活动(子流程) Call activity (subprocess)
描述 Description
图示 Graphical Notation
XML表现 XML representation
传递变量 Passing variables
示例 Example
8.7. 事务与并发 Transactions and Concurrency
8.7.1. 异步延续 Asynchronous Continuations
8.7.2. 失败重试 Fail Retry
8.7.3. 排他作业 Exclusive Jobs
为什么排他作业? Why exclusive Jobs?
什么是排他作业? What are exclusive jobs?
8.8. 流程启动认证 Process Initiation Authorization
8.9. 数据对象 Data objects
9. 表单 Forms
9.1. 表单参数 Form properties
9.2. 外部表单渲染 External form rendering
10. JPA(Java Persistence API Java持久化API)
10.1. 需求 Requirements
10.2. 配置 Configuration
10.3. 使用 Usage
10.3.1. 简单示例 Simple Example
10.3.2. 查询JPA流程变量 Query JPA process variables
10.3.3. 使用Spring bean与JPA的高级示例 Advanced example using Spring beans and JPA
11. 历史 History
11.1. 查询历史 Querying history
11.1.1. 历史流程实例查询 HistoricProcessInstanceQuery
11.1.2. 历史变量实例查询 HistoricVariableInstanceQuery
11.1.3. 历史活动实例查询 HistoricActivityInstanceQuery
11.1.4. 历史详情查询 HistoricDetailQuery
11.1.5. 历史任务示例查询 HistoricTaskInstanceQuery
11.2. 历史配置 History configuration
11.3. 审计目的历史 History for audit purposes
12. Eclipse Designer
12.1. 安装 Installation
12.2. Activiti Designer编辑器功能 Activiti Designer editor features
12.3. Activiti Designer BPMN功能 Activiti Designer BPMN features
12.4. Activiti Designer部署功能 Activiti Designer deployment features
12.5. 扩展Activiti Designer (Extending Activiti Designer)
12.5.1. 自定义画板 Customizing the palette
设置扩展 Extension setup (Eclipse/Maven)
在Activiti Designer中应用你的扩展 Applying your extension to Activiti Designer
为画板添加图形 Adding shapes to the palette
配置自定义服务任务的运行时执行 Configuring runtime execution of Custom Service Tasks
参数类型 Property types
PropertyType.TEXT
PropertyType.MULTILINE_TEXT
PropertyType.PERIOD
PropertyType.BOOLEAN_CHOICE
PropertyType.RADIO_CHOICE
PropertyType.COMBOBOX_CHOICE
PropertyType.DATE_PICKER
PropertyType.DATA_GRID
在画板中禁用默认图形 Disabling default shapes in the palette
12.5.2. 验证流程图与输出为自定义格式 Validating diagrams and exporting to custom output formats
创建ProcessValidator扩展 Creating a ProcessValidator extension
创建ExportMarshaller扩展 Creating an ExportMarshaller extension
13. Activiti Explorer
13.1. 配置 Configuration
13.2. 流程图 Process diagram
13.3. 任务 Tasks
13.4. 启动流程实例 Start process instances
13.5. 我的实例 My instances
13.6. 管理 Administration
13.7. 报告 Reporting
13.7.1. 报告数据JSON (Report data JSON)
13.7.2. 实例流程 Example process
13.7.3. 报告启动表单 Report start forms
13.7.4. 示例流程 Example processes
13.8. 改变数据库 Changing the database
14. Activiti Modeler
14.1. 编辑模型 Model editing
14.2. 导入现有模型 Importing existing models
14.3. 将已部署定义转换为可编辑模型 Convert deployed definitions to a editable model
14.4. 将模型导出为BPMN XML (Export model to BPMN XML)
14.5. 将模型部署至Activiti引擎 Deploy model to the Activiti Engine
15. REST API
15.1. Activiti REST一般原则 General Activiti REST principles
15.1.1. 安装与认证 Installation and Authentication
15.1.2. 配置 Configuration
15.1.3. 在Tomcat中使用 Usage in Tomcat
15.1.4. 方法与返回码 Methods and returncodes
15.1.5. 错误响应体 Error response body
15.1.6. 请求参数 Request parameters
URL片段 URL fragments
Rest URL查询参数 Rest URL query parameters
JSON体参数 JSON body parameters
分页与排序 Paging and sorting
JSON查询变量格式
变量表示 Variable representation
15.2. 部署 Deployment
15.2.1. 部署的列表 List of Deployments
15.2.2. 获取一个部署 Get a deployment
15.2.3. 创建一个新部署 Create a new deployment
15.2.4. 删除一个部署 Delete a deployment
15.2.5. 列表一个部署中的资源 List resources in a deployment
15.2.6. 获取一个部署资源 Get a deployment resource
15.2.7. 获取一个部署资源的内容 Get a deployment resource content
15.3. 流程定义 Process Definitions
15.3.1. 流程定义的列表 List of process definitions
15.3.2. 获取一个流程定义
15.3.3. 更新一个流程定义的分类 Update category for a process definition
15.3.4. 获取一个流程定义资源的内容 Get a process definition resource content
15.3.5. 获取一个流程定义的BPMN模型 Get a process definition BPMN model
15.3.6. 暂停一个流程定义 Suspend a process definition
15.3.7. 激活一个流程定义 Activate a process definition
15.3.8. 获取一个流程定义的所有候选启动者 Get all candidate starters for a processdefinition
15.3.9. 为一个流程定义添加一个候选启动者 Add a candidate starter to a process definition
15.3.10. 从一个流程定义中删除一个候选启动者 Delete a candidate starter from a process definition
15.3.11. 从一个流程定义中获取一个候选启动者 Get a candidate starter from a process definition
15.4. 模型 Models
15.4.1. 获取模型的列表 Get a list of models
15.4.2. 获取一个模型 Get a model
15.4.3. 更新一个模型 Update a model
15.4.4. 创建一个模型 Create a model
15.4.5. 删除一个模型 Delete a model
15.4.6. 获取一个模型的编辑器源码 Get the editor source for a model
15.4.7. 设置一个模型的编辑器源码 Set the editor source for a model
15.4.8. 获取一个模型的附加编辑器源码 Get the extra editor source for a model
15.4.9. 设置一个模型的附加编辑器源码 Set the extra editor source for a model
15.5. 流程实例 Process Instances
15.5.1. 获取一个流程实例 Get a process instance
15.5.2. 删除一个流程实例 Delete a process instance
15.5.3. 激活或暂停一个流程实例 Activate or suspend a process instance
15.5.4. 启动一个流程实例 Start a process instance
15.5.5. 流程实例的列表 List of process instances
15.5.6. 查询流程实例 Query process instances
15.5.7. 获取一个流程实例的流程图 Get diagram for a process instance
15.5.8. 获取流程实例的参与人 Get involved people for process instance
15.5.9. 为一个流程实例添加一个参与用户 Add an involved user to a process instance
15.5.10. 从一个流程实例中移除一个参与用户 Remove an involved user to from process instance
15.5.11. 一个流程实例的变量的列表 List of variables for a process instance
15.5.12. 获取一个流程实例的一个变量 Get a variable for a process instance
15.5.13. 为一个流程实例创建(或更新)变量 Create (or update) variables on a process instance
15.5.14. 为一个流程实例更新一个变量 Update a single variable on a process instance
15.5.15. 为一个流程实例创建一个新的二进制变量 Create a new binary variable on a processinstance
15.5.16. 为一个流程实例更新一个已有的二进制变量 Update an existing binary variable on a processinstance
15.6. 执行 Executions
15.6.1. 获取一个执行 Get an execution
15.6.2. 对一个执行进行操作 Execute an action on an execution
15.6.3. 获取一个执行中的激活活动 Get active activities in an execution
15.6.4. 执行的列表 List of executions
15.6.5. 查询执行 Query executions
15.6.6. 一个执行中的变量的列表 List of variables for an execution
15.6.7. 获取一个执行的一个变量 Get a variable for an execution
15.6.8. 为一个执行创建(或更新)变量 Create (or update) variables on an execution
15.6.9. 为一个执行更新一个变量 Update a variable on an execution
15.6.10. 为一个执行创建一个新的二进制变量 Create a new binary variable on an execution
15.6.11. 为一个执行更新一个已有二进制变量 Update an existing binary variable on a processinstance
15.7. 任务 Tasks