Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
b5978310
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b5978310
编写于
1月 30, 2013
作者:
J
Joram Barrez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ACT-1553: added BpmnParseHandler docs to the user guide
上级
2c4fe0a5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
141 addition
and
8 deletion
+141
-8
distro/src/readme.html
distro/src/readme.html
+16
-6
modules/activiti-engine/src/main/java/org/activiti/engine/parse/BpmnParseHandler.java
...main/java/org/activiti/engine/parse/BpmnParseHandler.java
+2
-2
userguide/src/en/chapters/ch16-Advanced.xml
userguide/src/en/chapters/ch16-Advanced.xml
+121
-0
userguide/src/en/index.xml
userguide/src/en/index.xml
+2
-0
未找到文件。
distro/src/readme.html
浏览文件 @
b5978310
...
...
@@ -23,12 +23,7 @@
<li><a
href=
"docs/javadocs/index.html"
>
Javadocs
</a></li>
</ul>
<h1>
Links for demo setup
</h1>
<p>
After installing the Activiti distribution,
you can open the
<a
href=
"http://localhost:8080/activiti-explorer/"
>
Activiti Explorer
</a>
</p>
<h1>
Other Links
</h1>
<h1>
Links
</h1>
<ul>
<li><a
href=
"http://forums.activiti.org/en/viewforum.php?f=3"
>
Activiti User Forum
</a></li>
<li><a
href=
"http://forums.activiti.org/en/viewforum.php?f=4"
>
Activiti Developer Forum
</a></li>
...
...
@@ -40,6 +35,21 @@
<h1>
Activiti Release Notes
</h1>
<h3>
Release Notes - Activiti - Version 5.12
</h3>
<h4>
Important upgrade note
</h4>
<p>
The internal
<i>
org.activiti.engine.impl.bpmn.parser.BpmnParseListener
</i>
interface and related classes have been removed.
</p>
<p>
Yes, we know many people relied on its capabilities, altough it was a class in an internal package. But do not worry:
we have introduced a replacement in the
<b>
api package
</b>
that offers similar (and even more powerful) functionality.
The code is not backwards compatible, but the required changes should be minimal (eg the XML element is replaced by a
Java pojo representation of the element). Read more about it in the new 'Advanced' chapter of the userguide.
</p>
<h3>
Release Notes - Activiti - Version 5.11
</h3>
<h4>
Highlights
</h4>
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/parse/BpmnParseHandler.java
浏览文件 @
b5978310
...
...
@@ -12,7 +12,7 @@
*/
package
org.activiti.engine.parse
;
import
java.util.
Set
;
import
java.util.
Collection
;
import
org.activiti.bpmn.model.BaseElement
;
import
org.activiti.engine.impl.bpmn.parser.BpmnParse
;
...
...
@@ -22,7 +22,7 @@ import org.activiti.engine.impl.bpmn.parser.BpmnParse;
*/
public
interface
BpmnParseHandler
{
Set
<
Class
<?
extends
BaseElement
>>
getHandledTypes
();
Collection
<
Class
<?
extends
BaseElement
>>
getHandledTypes
();
void
parse
(
BpmnParse
bpmnParse
,
BaseElement
element
);
...
...
userguide/src/en/chapters/ch16-Advanced.xml
0 → 100644
浏览文件 @
b5978310
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "../../../target/docbook-tool-1.0/docbook-xml/docbookx.dtd">
<chapter>
<title>
Advanced
</title>
<para>
The following sections cover advanced use cases of using Activiti, that go beyond typical execution of BPMN 2.0 processes.
As such, a certain proficiency and experience with Activiti is advisable to understand the material here.
</para>
<section
id=
"advanced_parseHandlers"
>
<title>
Hooking into process parsing
</title>
<para>
A bpmn 2.0 xml needs to be parsed to the Activiti internal model to be executed on the Activiti engine. This parsing
happens during a deployment of the process or when a process is not found in memory, and the
xml is fetched from the database.
</para>
<para>
For each of these processes, the
<literal>
BpmnParser
</literal>
class creates a new
<literal>
BpmnParse
</literal>
instance.
This instance will be used as container for all things that are done during parsing. The parsing on itself is very simple:
for each BPMN 2.0 element, there is a matching instance of the
<literal>
org.activiti.engine.parse.BpmnParseHandler
</literal>
available in the engine. As such, the parser has a map which basically maps an BPMN 2.0 element class to an instance of
<literal>
BpmnParseHandler
</literal>
. By default, Activiti has
<literal>
BpmnParseHandler
</literal>
instances to handle
all supported elements and also uses it to attach execution listeners to steps of the process for creating the history.
</para>
<para>
It is possible to add custom instances of
<literal>
org.activiti.engine.parse.BpmnParseHandler
</literal>
to the Activiti engine.
An often seen use case is for example to add execution listeners to certain steps that fire events to some queue for event processing.
The history handling is done in such a way internally in Activiti.
To add such custom handlers, the Activiti configuration needs to be tweaked:
<programlisting>
<
property name=
"
preBpmnParseHandlers
">
<
list
>
<
bean class=
"
org.activiti.parsing.MyFirstBpmnParseHandler
"
/
>
<
/list
>
<
/property
>
<
property name=
"
postBpmnParseHandlers
">
<
list
>
<
bean class=
"
org.activiti.parsing.MySecondBpmnParseHandler
"
/
>
<
bean class=
"
org.activiti.parsing.MyThirdBpmnParseHandler
"
/
>
<
/list
>
<
/property
>
</programlisting>
The list of
<literal>
BpmnParseHandler
</literal>
instances that is configured in the
<literal>
preBpmnParseHandlers
</literal>
property
are added before any of the default handlers. Likewise, the
<literal>
postBpmnParseHandlers
</literal>
are added after those.
This can be important if the order of things matter for the logic contained in the custom parse handlers.
</para>
<para>
<literal>
org.activiti.engine.parse.BpmnParseHandler
</literal>
is a simple interface:
<programlisting>
public interface BpmnParseHandler {
Collection
<
Class
>
? extends BaseElement
>>
getHandledTypes();
void parse(BpmnParse bpmnParse, BaseElement element);
}
</programlisting>
The
<literal>
getHandledTypes()
</literal>
method returns a collection of all the types handled by this parser.
The possible types are a subclass of
<literal>
BaseElement
</literal>
, as directed by the generic type of the collection.
You can also extend the
<literal>
AbstractBpmnParseHandler
</literal>
class and override the
<literal>
getHandledType()
</literal>
method, which only returns one Class and not a collection. This class contains also some helper methods
shared by many of the default parse handlers.
The
<literal>
BpmnParseHandler
</literal>
instance will be called when the parser encounters any of the returned
types by this method. In the following example, whenever a process contained in a BPMN 2.0 xml is encountered, it
will execute the logic in the
<literal>
executeParse
</literal>
method (which is a typecasted method that replaces
the regular
<literal>
parse
</literal>
method on the
<literal>
BpmnParseHandler
</literal>
interface).
<programlisting>
public class TestBPMNParseHandler extends AbstractBpmnParseHandler
<
Process
>
{
protected Class
<
? extends BaseElement
>
getHandledType() {
return Process.class;
}
protected void executeParse(BpmnParse bpmnParse, Process element) {
..
}
}
</programlisting>
</para>
<para>
It is possible (but less common) to replace the default
<literal>
BpmnParseHandler
</literal>
instances
that are responsible for the parsing of the BPMN 2.0 elements to the internal Activiti model.
This can be done by following snippet of logic:
<programlisting>
<
property name=
"
customDefaultBpmnParseHandlers
">
<
list
>
...
<
/list
>
<
/property
>
</programlisting>
A simple example could for example be to force all of the service tasks to be asynchronous:
<programlisting>
public class CustomUserTaskBpmnParseHandler extends ServiceTaskParseHandler {
protected void executeParse(BpmnParse bpmnParse, ServiceTask serviceTask) {
// Do the regular stuff
super.executeParse(bpmnParse, serviceTask);
// Make always async
ActivityImpl activity = findActivity(bpmnParse, serviceTask.getId());
activity.setAsync(true);
}
}
</programlisting>
</para>
</section>
</chapter>
\ No newline at end of file
userguide/src/en/index.xml
浏览文件 @
b5978310
...
...
@@ -16,6 +16,7 @@
<!ENTITY ch13 SYSTEM "chapters/ch13-Modeler.xml">
<!ENTITY ch14 SYSTEM "chapters/ch14-REST.xml">
<!ENTITY ch15 SYSTEM "chapters/ch15-Cdi.xml">
<!ENTITY ch16 SYSTEM "chapters/ch16-Advanced.xml">
]>
<book>
...
...
@@ -40,5 +41,6 @@
&ch13;
&ch14;
&ch15;
&ch16;
</book>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录