首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

jBPM Developers Guide(jBPM开发指南)-Chapter 3. BPMN 2.0(第五一部分)

2012-10-14 
jBPM Developers Guide(jBPM开发指南)--Chapter 3. BPMN 2.0(第五部分)3.8.12.?Task: Script Task(脚本任

jBPM Developers Guide(jBPM开发指南)--Chapter 3. BPMN 2.0(第五部分)

3.8.12.?Task: Script Task(脚本任务)

?? ?A script task is aan automatic activity upon which the process engine will execute a script whenthe task is reached. The script task is used as follows:

?

?? ?脚本任务时一个自动活动,当任务到达的时候 流程引擎会执行一个脚本。脚本任务使用方式如下:

?? ?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之外,还允许指定?scriptLanguagescript。因为我们使用了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 isvisualized as follows (adding a none start and end event).

    ?

    ?? ?上面的XML对应图形如下所示(添加了空开始和结束事件)。


    jBPM Developers Guide(jBPM开发指南)-Chapter 3. BPMN 2.0(第五一部分)

    ?? ?As shown in theexample, process variables can be used inside the scripts. We can now start aprocess instance for this example process, while also supplying some randominput variables:

    ?

    ?? ?像上面例子中显示的那样,可以在脚本中使用流程变量。我们现在可以启动一个这个例子的流程,同时提供一些随机生成的输入变量:

    ?? ?A manual task is atask that is performed by an external actor, but without the aid of a BPMsystem 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系统或服务帮助。在真实世界里,有很多这样的例子,如安装一个电话系统、使用定期邮件发送一封信、用电话联系客户,等等。

    ?? ?The purpose of themanual task is more documentation/modeling-wise, as it has no meaning forexecution on a process engine. As such, the process engine will simply passthrough a manual task when it encounters one.

    ?

    ?? ?手工任务的目的更像是为了文档或建模提醒,因为它对流程引擎的运行没有任何意义。因此,当流程引擎遇到一个手工任务时会简单略过。

    ?

    3.8.14.?Task: Java Receivetask(Java Receive任务)

    ?

    ?? ?A?receive task?is a task that waits for the arrivalof an external message. Besides the obvious use case involving webservices, thespecification is liberal in what to do in other environments. The web serviceuse case is not yet implemented, but the receive task can already be used in aJava environment.

    ?

    ?? ?receive task是一个任务会等到外部消息的到来。除了广泛使用的web service用例,规范在其他环境中的使用也是一样的。 web service用例还没有实现, 但是receive task已经可以在java环境中使用了。

    ?

    ?? ?The receive task isdepicted as a rounded rectangle (= task shape) with a little enveloppe in theleft top corner.

    ?

    ?? ?receive task显示为一个圆角矩形(和task图形一样) 在左上角有一个小信封的图标。


    jBPM Developers Guide(jBPM开发指南)-Chapter 3. BPMN 2.0(第五一部分)

    ?? ?In a Javaenvironment, the receive task without any other attribute filled in besides anid and (optionally) a name, behaves as a wait state. To introduce a wait statein your business process, just add the following line:

    ?

    ?? ?在java环境中,receivetask除了id和name(可选)属性外,没有其他属性,其行为就像是一个等待状态。为了在你的业务流程中使用等待状态,只需要加入如下几行:

    ?? ?Process executionwill wait in such a receive task. The process can then be continued using thefamiliar jBPM?signalmethods. 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'在BPMN2.0中拥有完全不同的含义。

    Execution execution = processInstance.findActiveExecutionIn("receiveTask");executionService.signalExecutionById(execution.getId()); 

热点排行