Flowable 6.6.0 用户指南相关文档下载
- BPMN用户指南 第一部分 - 中文PDF精编版
- BPMN用户指南 第二部分 - 中文PDF精编版
- BPMN用户指南 第三部分 - 中文PDF精编版
- 应用程序指南 - 中文PDF精编版
- 应用程序指南 - 中英对照PDF精编版
- 应用程序指南 - Eclipse设计器中文PDF精编版
- 表单用户指南 - 中文PDF精编版
- 事件注册表用户指南 - 中文PDF精编版
《Flowable 6.6.0 BPMN用户指南》
1. 入门
2. 配置
3 The Flowable API
4 Flowable 6.6.0 BPMN用户指南 - (4)Spring集成
5 Spring Boot
6 部署
7 BPMN 2.0简介
8 BPMN 2.0的构造
9 表单(Forms)
10 流程实例迁移
11 JPA
有关Flowable的更多文档,参见:
11.3.2 查询JPA流程变量
You can query for ProcessInstances and Executions that have a certain JPA-entity as variable value. Note that only variableValueEquals(name, entity) is supported for JPA-Entities on ProcessInstanceQuery and ExecutionQuery. Methods variableValueNotEquals, variableValueGreaterThan, variableValueGreaterThanOrEqual, variableValueLessThan and variableValueLessThanOrEqual are unsupported and will throw an FlowableException when a JPA-Entity is passed as value.
您可以通过变量值查询具有特定JPA实体的ProcessInstances和Executions。注意,ProcessInstanceQuery和ExecutionQuery上的JPA实体只支持variableValueEquals(name, entity)。不支持variableValueNotEquals、variableValueGreaterThan、variableValueGreaterThanOrEqual、variableValueLessThan和variableValueLessThanOrEqual等方法,当JPA实体作为值传递时,将引发FlowableException。
ProcessInstance result = runtimeService.createProcessInstanceQuery()
.variableValueEquals("entityToQuery", entityToQuery).singleResult();
11.3.3 使用Sping Bean和JPA的复杂示例
A more advanced example, JPASpringTest, can be found in flowable-spring-examples. It describes the following simple use case:
JPASpringTest是一个更复杂的示例,可以在flowable-spring-examples中找到。它描述了以下简单的用例:
- An existing Spring-bean which uses JPA entities already exists which allows for Loan Requests to be stored.
- Using Flowable, we can use the existing entities, obtained through the existing bean, and use them as variable in our process. Process is defined in the following steps:
- 存在一个Spring-bean,它使用已有的JPA实体,以保存Loan Requests。
- 在Flowable中,我们可以使用现有实体(通过现有bean获取),并将它们用作流程中的变量。流程定义步骤如下:
- Service task that creates a new LoanRequest, using the existing LoanRequestBean using variables received when starting the process (e.g. could come from a start form). The created entity is stored as a variable, using flowable:resultVariable which stores the expression result as a variable.
- UserTask that allows a manager to review the request and approve/disapprove, which is stored as a boolean variable approvedByManager
- ServiceTask that updates the loan request entity so the entity is in sync with the process.
- Depending on the value of the entity property approved, an exclusive gateway is used to make a decision about what path to take next: When the request is approved, process ends, otherwise, an extra task will become available (Send rejection letter), so the customer can be notified manually by a rejection letter.
- 创建新LanRequest的服务任务,使用现有的LanRequestBean,使用启动流程时接收到的变量(例如,可能来自启动表单)。使用flowable:resultVariable(它将表达式结果存储为变量),创建的实体存储为一个变量。
- UserTask,允许经理审查请求并批准/不批准,它存储为布尔变量apprvedByManager
- ServiceTask,更新贷款申请实体(loan request entity)以便实体与流程同步
- 根据实体属性approved的值,使用一个独占网关来决定下一步要采取的路径:当请求被批准时,流程结束,否则,将有一个额外的任务可用(发送拒绝信,Send rejection letter),这样可以通过拒绝信手动通知客户。
Please note that the process doesn’t contain any forms, since it is only used in a unit test.
请注意,这个流程不包含任何表单,因为它只在单元测试中使用。
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flowable="http://flowable.org/bpmn"
targetNamespace="org.flowable.examples">
<process id="LoanRequestProcess" name="Process creating and handling loan request">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='createLoanRequest' />
<serviceTask id='createLoanRequest' name='Create loan request'
flowable:expression="${loanRequestBean.newLoanRequest(customerName, amount)}"
flowable:resultVariable="loanRequest"/>
<sequenceFlow id='flow2' sourceRef='createLoanRequest' targetRef='approveTask' />
<userTask id="approveTask" name="Approve request" />
<sequenceFlow id='flow3' sourceRef='approveTask' targetRef='approveOrDissaprove' />
<serviceTask id='approveOrDissaprove' name='Store decision'
flowable:expression="${loanRequest.setApproved(approvedByManager)}" />
<sequenceFlow id='flow4' sourceRef='approveOrDissaprove' targetRef='exclusiveGw' />
<exclusiveGateway id="exclusiveGw" name="Exclusive Gateway approval" />
<sequenceFlow id="endFlow1" sourceRef="exclusiveGw" targetRef="theEnd">
<conditionExpression xsi:type="tFormalExpression">${loanRequest.approved}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="endFlow2" sourceRef="exclusiveGw" targetRef="sendRejectionLetter">
<conditionExpression xsi:type="tFormalExpression">${!loanRequest.approved}</conditionExpression>
</sequenceFlow>
<userTask id="sendRejectionLetter" name="Send rejection letter" />
<sequenceFlow id='flow5' sourceRef='sendRejectionLetter' targetRef='theOtherEnd' />
<endEvent id='theEnd' />
<endEvent id='theOtherEnd' />
</process>
</definitions>
Although the example above is quite simple, it shows the power of using JPA combined with Spring and parametrized method-expressions. The process requires no custom Java code at all (except for the Spring-bean off course) and speeds up development drastically.
尽管上面的例子非常简单,但它展示了使用JPA与Spring和参数化方法表达式相结合的强大功能。这个过程根本不需要任何定制的Java代码(除了Spring-bean以外),从而大大加快了开发速度。