3.8.12. Task: Script Task(脚本任务)
A script task is a
an automatic activity upon which the process engine will execute a script when
the task is reached. The script task is used as follows:
脚本任务时一个自动活动,当任务到达的时候 流程引擎会执行一个脚本。脚本任务使用方式如下:
<scriptTask id="scriptTask" name="Script Task" scriptLanguage="bsh">
<script><![CDATA[
for(int i=0; i < input.length; i++){
System.out.println(input[i] + " x 2 = " + (input[i]*2));
}]]>
</script>
</scriptTask>
The script task,
besides the required id and the optional name, allows for specifying a scriptLanguage and a script. Since we're using JSR-223
('Scripting for the Java platform'), changing the script language involves
脚本任务,除了必须的id和可选的 name之外,还允许指定 scriptLanguage和script。因为我们使用了JSR-223(java平台的脚本语言),修改脚本语言就需要:
- changing the scriptLanguage attribute to the JSR-223
compliant name
- 把scriptLanguage 属性修改为JSR-223兼容的名称
- adding the ScriptEngine implementation of the JSR
specification to the classpath
- 在classpath下添加JSR规范的ScriptEngine实现
The XML above is
visualized as follows (adding a none start and end event).
上面的XML对应图形如下所示(添加了空开始和结束事件)。
As shown in the
example, process variables can be used inside the scripts. We can now start a
process instance for this example process, while also supplying some random
input variables:
像上面例子中显示的那样,可以在脚本中使用流程变量。我们现在可以启动一个这个例子的流程,同时提供一些随机生成的输入变量:
Map<String, Object> variables = new HashMap<String, Object>();
Integer[] values = { 11, 23, 56, 980, 67543, 8762524 };
variables.put("input", values);
executionService.startProcessInstanceBykey("scriptTaskExample", variables);
In the output console,
we can now see the script being executed:
在输出控制台里,我们现在可以看到脚本的执行:
11 x 2 = 22
23 x 2 = 46
56 x 2 = 112
980 x 2 = 1960
67543 x 2 = 135086
8762524 x 2 = 17525048
3.8.13. Task:
Manual task(任务:手工任务)
A manual task is a
task that is performed by an external actor, but without the aid of a BPM
system or a service that is invoked. In the real world, examples are plenty:
the installation of telephone system, sending of a letter using regular mail,
calling a customer by phone, etc.
手工任务时一个由外部人员执行的任务,但是它的执行没有BPM系统或服务帮助。在真实世界里,有很多这样的例子,如安装一个电话系统、使用定期邮件发送一封信、用电话联系客户,等等。
<manualTask id="myManualTask" name="Call customer" />
The purpose of the
manual task is more documentation/modeling-wise, as it has no meaning for
execution on a process engine. As such, the process engine will simply pass
through a manual task when it encounters one.
手工任务的目的更像是为了文档或建模提醒,因为它对流程引擎的运行没有任何意义。因此,当流程引擎遇到一个手工任务时会简单略过。
3.8.14. Task: Java Receive
task(Java Receive任务)
A receive task is a task that waits for the arrival
of an external message. Besides the obvious use case involving webservices, the
specification is liberal in what to do in other environments. The web service
use case is not yet implemented, but the receive task can already be used in a
Java environment.
receive task是一个任务会等到外部消息的到来。除了广泛使用的web service用例,规范在其他环境中的使用也是一样的。 web service用例还没有实现, 但是receive task已经可以在java环境中使用了。
The receive task is
depicted as a rounded rectangle (= task shape) with a little enveloppe in the
left top corner.
receive task显示为一个圆角矩形(和task图形一样) 在左上角有一个小信封的图标。
In a Java
environment, the receive task without any other attribute filled in besides an
id and (optionally) a name, behaves as a wait state. To introduce a wait state
in your business process, just add the following line:
在java环境中,receive
task除了id和name(可选)属性外,没有其他属性,其行为就像是一个等待状态。为了在你的业务流程中使用等待状态,只需要加入如下几行:
<receiveTask id="receiveTask" name="wait" />
Process execution
will wait in such a receive task. The process can then be continued using the
familiar jBPM signal
methods. Note that this will probably change in the future,
since a 'signal' has a completely different meaning in BPMN 2.0.
流程执行当遇到一个receive task是将会进入等待状态。流程可以使用我们熟悉的jBPM signal
方法来继续执行。注意,这些可能在未来改变,因为'signal'在BPMN
2.0中拥有完全不同的含义。
Execution execution = processInstance.findActiveExecutionIn("receiveTask");
executionService.signalExecutionById(execution.getId());
- 大小: 6.1 KB
- 大小: 3.4 KB
- 大小: 5.4 KB
分享到:
相关推荐
yaoqiang BPMN2.0设计器是一款专为流程图设计打造的工具,主要用于支持Activiti和JBPM等流行的业务流程管理系统。BPMN(Business Process Modeling Notation)是一种国际标准,它为业务流程建模提供了图形化表示,...
jbpm-bpmn2-5.1.0.Final.jar jbpm5
jeecg-jbpm-framework 20130202.zipjeecg-jbpm-framework 20130202.zipjeecg-jbpm-framework 20130202.zipjeecg-jbpm-framework 20130202.zipjeecg-jbpm-framework 20130202.zipjeecg-jbpm-framework 20130202....
jbpm-jpdl-suite-3.2.GA.zip
jbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3.zipjbpm-jpdl-suite-3.2.3....
jbpm-flow-builder-5.1.0.Final.jar jbpm5
jbpm-jpdl-designer-site-3.1.7.zip jbpm-jpdl-designer-site-3.1.7.zip jbpm-jpdl-designer-site-3.1.7.zip
5. **创建工作流程定义(BPMN2文件)**: 利用jBPM插件提供的流程设计器,可以创建和编辑`.bpmn2`文件,定义业务流程。设计器会自动生成对应的XML文件,描述流程的结构和逻辑。 6. **编写测试代码**: `src`目录下...
jbpm-jpdl-suite-3.2.GA.zip
jbpm-jpdl-suite-3.2.GA.zip
jbpm-7.3.0.Final-bin是一个包含jBPM框架核心组件的压缩包,jBPM是一个全面的开源业务流程管理系统,专注于提供企业级的流程自动化和管理能力。这个版本是7.3.0.Final,代表了该框架在特定时间点的稳定版本。 jBPM...
BPMN 2.0是业务流程模型与符号的第二版标准,旨在提供一套广泛适用于业务分析、流程设计、实现以及用户管理监控的流程建模符号。它主要被业务用户和建模者使用,通过一套清晰的图形化表示方法,允许业务流程的各个...
jbpm-jpdl-suite-3.2.GA.zip
jbpm-designer作为jBPM的一部分,通过Web界面提供了一个用户友好的BPMN2.0模型创建环境。用户可以利用其拖放式界面,创建、编辑和保存流程图,这些流程图符合BPMN2.0标准,确保了流程图的标准化和可交换性。此外,...
jbpm-persistence-jpa-5.1.0.Final.jar jbpm5
jbpm-6.0.0.Final-installer-full.tar.gz
常用jar包二十几个 bsh-1.3.0.jar commons-dbcp-1.2.1.jar commons-fileupload-1.2.1.jar commons-io-1.3.2.jar commons-logging-1.0.4.jar commons-pool-1.2.jar dom4j-1.6.1.jar freemarker-2.3.13.jar jbpm.sar....
jbpm-flow-5.1.0.Final.jar jbpm5