- 浏览: 129168 次
- 性别:
文章分类
最新评论
-
cultivator129:
匿名用户没办法下载,也没找到登陆的地方,大家是怎么登陆的?
signavio-core-components编译初体验 -
511039003:
...
如何使用Guava的缓存管理 -
string2020:
activiti如何整合OSGI
Activiti User Guide -- Activit 用户指南 Part06 -
刺客8882010:
楼主可否给我份Demo,谢谢,控制部分代码在哪里写我不是很清楚 ...
利用Spring动态对Quartz定时任务管理 -
yu120:
有源码吗?
利用Spring动态对Quartz定时任务管理
Chapter 7. BPMN
第七章 BPMN
Table of Contents
Getting started: 10 minute tutorial
什么是BPMN?
See our FAQ entry on BPMN 2.0
示例
Examples for the BPMN 2.0 constructs described in the following sections can be found in the docs/examples folder.
本章所讨论的的BPMN2.0可以在docs/examples 目录下找到相应的示例。
See the specific section on examples for more information.
更多的可以参考示例 章节。
流程定义
To create a new BPMN 2.0 process definition, it's best to have your Eclipse properly set up.
为了创建BPMN2.0的流程定义文件,最好你的Eclipse中已经设置好相应的属性。
Create a new XML file (New->Other->XML-XML) and give it a name. Make sure that the file ends with .bpmn20.xml, since otherwise the engine won't pick up this file for deployment.
创建一个XML文件(New->Other->XML-XML))并赋一个指定的名称。XML文件名称必须以.bpmn20.xml作为结尾,否则流程引擎将不会部署此文件。
The root element of the BPMN 2.0 schema is the definitions element. Within this element, multiple process definitions can be defined (although we advise to have only one process definition in each file, since this simplifies maintenance later in the development process). An empty process definition looks as follows. Note that the minimal definitions element only needs the xmlns and targetNamespacedeclaration.
BPMN2.0定义文件中的根元素是definitions。使用该元素可以在一个定义文件中定义多个流程(尽管如此,我们还是建议一个文件中最好只定义一个流程,因为这样以后维护起来更简单)。一个空的流程定义文件大概如下面所示。注意此时定义元素仅仅需要声明 xmlns 和 targetNamespace。
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn-extensions" targetNamespace="http://www.activiti.org/bpmn2.0"> <process id="myProcess" name="My First Process"> </process> </definitions>
The process element has two attributes:
流程元素有两个属性:
- id: this attribute is required and maps to the key property of an Activiti ProcessDefinition object. This id can then be used to start a new process instance of the process definition, through the startProcessInstanceByKey method on the ProcessService. This method will always take the latest deployed version of the process definition.
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess");
Important to note here is that this is not the same as calling the startProcessInstanceById method. This method expects the String id that was generated at deploy time by the Activiti engine, and can be retrieved by calling the processDefinition.getId() method. The format of the generated id is 'key:version', and the length is constrained to 64 characters. If you get an ActivitiException stating that the generated id is too long, limit the text in the key field of the process.
- id: 必须属性。该属性用来映射为Activiti流程定义中可以属性。此属性可以通过ProcessService 的startProcessInstanceByKey 来启动一个新的流程实例。该方法总是使用流程定义的最终版本来启动一个新的流程实例。
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess");
这里需要注意的是与startProcessInstanceById 方法的区别。startProcessInstanceById 方法传入的参数是id字符串,该id是在Activiti引擎部署一个流程定义自动生成的,该id的值可以通过调用 processDefinition.getId() 方法获取。 Id格式为 'key:version', 长度为64位。如果你在部署时得到一个id长度太长的ActivitiException异常,那么最好修改key字段的长度。
- name: this attribute is optional and maps to the name property of a ProcessDefinition. The engine itself doesn't use this property, so it can for example be used for displaying a more human-friendly name in a user interface.
- name: 可选属性。用例映射流程定义中name属性。引擎本身并不使用该值,它可以显示在与用户交互的界面,这样更人性化一点。
Getting started: 10 minute tutorial
启航:10分钟教程
In this section we will cover a (simple) business process that we will use to introduce some basic Activiti concepts and the Activiti API.
在本小节中,我们将通过一个(简单)的业务流程用来介绍Activiti的基本概念以及Activiti API。
用例
The use case is very simple: we have a company, let's call it BPMCorp. In BPMCorp, a financial report needs to be written every month for the company shareholders. This is the responsibility of the accountancy department. When the report is finished, one of the members of the upper management needs to approve the document before it is sent to all the shareholders.
这个用例非常简单:假如我们有一家名叫BPM的公司。在BPM公司,每个月财务部门需要将新的财务报表发送给公司的股东。当财务报表编写完毕后,需要经过上级管理部门进行审批,审批通过后才能发送给公司股东。
All files and code snippets used through the next sections can be found in the examples shipped with the Activiti distribution. Look for the package org.activiti.examples.bpmn.usertask.
接下来我们所使用的所有的文件以及代码都在Activiti发行包的examples目录中可以找到。具体可以参看 org.activiti.examples.bpmn.usertask package。
流程图
The business process as described above, can be graphically visualized using the Activiti Modeler. The end result, in BPMN 2.0 notation, looks like this:
上面所说的业务流程可以使用Activiti Modeler建模工具进行绘制。下图就是我们所绘制出的流程图:
There is nothing spectacular here. What we see is a none start event (circle on the left), followed by two user tasks: 'Write monthly financial report' and 'Verify monthly financial report', ending in a none end event (circle with thick border on the right).
这里没有什么好解释的。正如我们所看到的一个 none start event(左面那个圆圈),接下来是两个 user task:“Write monthly financial report”和“Verify monthly financial report”,最后是一个 none end event(右面那个带厚边框的圆)。
XML 表示
The XML version of this business process (FinancialReportProcess.bpmn20.xml) looks as shown below. It's easy to recognize the main elements of our process (click on the links for going to the detailed section of that BPMN 2.0 construct):
(FinancialReportProcess.bpmn20.xml)业务流程的XML表示如下面所示。我们可以清晰的辨识出主要的元素(点击链接查看BPMN2.0具体元素章节):
- The (none) start event learns us where to start with the process
- (none) start event表示流程从哪里开始
- The user tasks declarations are the representation of the human tasks of our process. Note that the first task is assigned to theaccountancy group, while the second task is assigned to the management group. See the section on user task assignment for more information on how users and groups can be assigned to user tasks.
- user task 则表示流程中需要人工进行处理的任务。需要注意的是第一个任务分配给accountancy 小组,而第二个任务则是分配给management 小组。 请参考人员任务分配章节来了解如何将人员和小组分配给user task.
- The process ends when the none end event is reached.
- 流程则是以none end event结束。
<process id="financialReport" name="Monthly financial report reminder process"> <startEvent id="theStart" /> <sequenceFlow id='flow1' sourceRef='theStart' targetRef='writeReportTask' /> <userTask id="writeReportTask" name="Write monthly financial report" > <documentation> Write monthly financial report for publication to shareholders. </documentation> <potentialOwner> <resourceAssignmentExpression> <formalExpression>accountancy</formalExpression> </resourceAssignmentExpression> </potentialOwner> </userTask> <sequenceFlow id='flow2' sourceRef='writeReportTask' targetRef='verifyReportTask' /> <userTask id="verifyReportTask" name="Verify monthly financial report" > <documentation> Verify monthly financial report composed by the accountancy department. This financial report is going to be sent to all the company shareholders. </documentation> <potentialOwner> <resourceAssignmentExpression> <formalExpression>management</formalExpression> </resourceAssignmentExpression> </potentialOwner> </userTask> <sequenceFlow id='flow3' sourceRef='verifyReportTask' targetRef='theEnd' /> <endEvent id="theEnd" /> </process>
Starting a process instance
启动流程实例
We now have defined the process definition of our business process. From such a process definition, we can create at runtime process instances. In this case, one process instance would match with the creation and verification of the financial report every month.
现在,我们已经为我们的业务流程定义了一个流程定义。通过该流程定义,我们就可以创建一个流程实例。在本示例中,一个流程实例也就是每个月创建并验证财务报表。
To be able to create process instances from a given process definition, we must first deploy this process definition. Deploying a process definition means two things:
为了能够从一个给定的流程定义中创建流程实例,我们必须首先部署该流程定义。部署流程定义也就意味着需要做下面两件事:
- The process definition will be stored in the persistent datastore that is configured for your Activiti engine. So by deploying our business process, we make sure that the engine will find the process definition after an engine reboot.
- 流程定义必须存放在我们为Activiti所配置的持久化数据库存储中。因此部署我们的业务流程,也就是可以让Activiti引擎重启后依然可以找到我们所部署的流程定义。
- The BPMN 2.0 process file will be parsed to an in-memory object model that can be manipulated through the Activiti API.
- BPMN2.0流程文件将被解析成一个可以通过Activiti API进行管理的内存对象。
More information on deployment can be found in the dedicated deployment section.
更多关于如何进行部署的内容可以在 dedicated deployment section小节中找到。
As described in that section, deployment can happen in several ways. One way is through the API as follows:
正如该章节所描述的,部署一个流程可以通过多种方式。下面通过API进行部署就是其中一种:
Deployment deployment = repositoryService.createDeployment() .addClasspathResource("org/activiti/examples/bpmn/usertask/FinancialReportProcess.bpmn20.xml") .deploy();
al
评论
请问我包这错是什么原因啊
发表评论
-
signavio-core-components编译初体验
2012-03-28 11:17 4695最近又开始研究Acti ... -
Activiti User Guide -- Activit 用户指南 Part11
2010-10-31 10:24 4681User task 用户任务 Descript ... -
Activiti User Guide -- Activit 用户指南 Part10
2010-10-31 10:15 7244Gateways 网关 A gateway is u ... -
Activiti User Guide -- Activit 用户指南 Part09
2010-10-31 10:08 4004Sequence flow 顺序流 Descript ... -
Activiti User Guide -- Activit 用户指南 Part08
2010-10-30 15:04 4574BPMN 2.0 constructs BPMN 2. ... -
Activiti User Guide -- Activit 用户指南 Part07
2010-10-30 14:53 3220Now we can start a new proce ... -
Activiti User Guide -- Activit 用户指南 Part05
2010-10-24 17:09 3113Chapter 6. Deployment 第六章 部 ... -
Activiti User Guide -- Activit 用户指南 Part04
2010-10-24 17:07 3663Chapter 5. API 第五章 API Tab ... -
Activiti User Guide -- Activit 用户指南 Part03
2010-10-19 22:04 3461Chapter 4. Spring integratio ... -
Activiti User Guide -- Activit 用户指南 Part02
2010-10-17 18:36 3535Chapter 3. Configuration ... -
Activiti User Guide -- Activit 用户指南 Part01
2010-10-17 18:33 6117终于告一个段落了,前一段时间忙着开发一个流转引擎,所以 ...
相关推荐
赠送jar包:activiti-json-converter-5.21.0.jar; 赠送原API文档:activiti-json-converter-5.21.0-javadoc.jar; 赠送源代码:activiti-json-converter-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
这个“activiti-userguide-5-16”压缩包文件包含了 Activiti 5.16 版本的用户指南,帮助我们深入理解并有效使用这个流程管理工具。 1. **BPMN 2.0 规范**:Business Process Model and Notation 2.0(业务流程模型...
赠送jar包:activiti-engine-5.21.0.jar; 赠送原API文档:activiti-engine-5.21.0-javadoc.jar; 赠送源代码:activiti-engine-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-engine-5.21.0.pom; 包含...
赠送jar包:activiti-json-converter-5.21.0.jar; 赠送原API文档:activiti-json-converter-5.21.0-javadoc.jar; 赠送源代码:activiti-json-converter-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
赠送jar包:activiti-image-generator-5.21.0.jar; 赠送原API文档:activiti-image-generator-5.21.0-javadoc.jar; 赠送源代码:activiti-image-generator-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
赠送jar包:activiti-common-rest-5.21.0.jar; 赠送原API文档:activiti-common-rest-5.21.0-javadoc.jar; 赠送源代码:activiti-common-rest-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-common-rest-...
赠送jar包:activiti-bpmn-model-5.21.0.jar; 赠送原API文档:activiti-bpmn-model-5.21.0-javadoc.jar; 赠送源代码:activiti-bpmn-model-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-bpmn-model-...
activiti-spring-boot-starter-7.1.0.M1
赠送jar包:activiti-image-generator-5.21.0.jar; 赠送原API文档:activiti-image-generator-5.21.0-javadoc.jar; 赠送源代码:activiti-image-generator-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
activiti-spring-boot-starter-basic-6.0.0适配springboot2.1.2
activiti-bpmn-converter-5.18.0-sources.jar
赠送jar包:activiti-process-validation-5.21.0.jar; 赠送原API文档:activiti-process-validation-5.21.0-javadoc.jar; 赠送源代码:activiti-process-validation-5.21.0-sources.jar; 赠送Maven依赖信息文件:...
赠送jar包:activiti-bpmn-converter-5.21.0.jar; 赠送原API文档:activiti-bpmn-converter-5.21.0-javadoc.jar; 赠送源代码:activiti-bpmn-converter-5.21.0-sources.jar; 赠送Maven依赖信息文件:activiti-...
activiti-bpmn-converter-5.16.4.jar
本文将详细介绍如何在SpringBoot项目中整合Activiti,并通过提供的"springboot-activiti-test-master.zip"压缩包进行实战演练。 首先,我们需要了解SpringBoot与Activiti的基本概念。SpringBoot旨在简化Spring应用...
1、将以下四个文件(见附件Activiti Designer 5.18.1插件补丁)拷贝到自己的eclipse的plugin文件夹下面,重启eclipse ...2、将activiti-designer-5.18.0文件夹copy到eclipse\dropins目录下; 3、重启eclipse即可
eclipse 安装activiti activiti-designer-5.18.0.zip 附带eclipse 以及activiti-designer-5.18.0.zip 安装包 eclipse下载链接https://www.eclipse.org/downloads/packages/release/luna/sr2
【 activiti-explorer-eclipse项目 】是一个基于Activiti工作流引擎的Eclipse插件项目。 Activiti 是一个开源的业务流程管理系统(BPMN 2.0)和工作流引擎,它允许开发者轻松地在应用程序中集成业务流程管理功能。这...
Activiti的Eclipse插件activiti-designer安装资料包,包含activiti-designer-5.18.0.zip、org.eclipse.emf.transaction_1.4.0.201306111400.jar、org.eclipse.emf.validation.ui_1.7.0.201403111711.jar、org....
1. **流程建模**: Activiti Designer 提供了一个图形化用户界面,通过拖放方式可以轻松创建和配置各种流程元素,如开始事件、结束事件、任务、网关和泳道等。这使得非技术背景的业务人员也能参与到流程设计中,提升...