Activiti User Guide -- Activit 用户指南 Part09

Sequence flow

顺序流

Description

描述

A sequence flow is the connector between two elements of a process. After an element is visited during process execution, all outgoing sequence flow will be followed. This means that the default nature of BPMN 2.0 is to be parallel: two outgoing sequence flow will create two separate, parallel paths of execution.

顺序流用来连接流程中的两个元素。流程执行完一个元素时就会获取接下来获取所有外出顺序流进行执行。也就是说BPMN2.0天然就是并行执行的:两个外出顺序流就会创建两个独立的、并行的流程执行路径。

Graphical notation

流程表示

A sequence flow is visualized as an arrow going from the source element towards the target element. The arrow always points towards the target.

顺序流表示为一个带有箭头的,从起始元素指向目标元素的线。箭头通常指向目标元素。

 

XML representation

XML 表示

Sequence flow need to have a process-unique id, and a reference to an existing source and target element.

顺序流必须有一个流程唯一的id,并且指向存在起始元素和目标元素。

<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" />
  Conditional sequence flow

条件顺序流

Description

描述

A sequence flow can have a condition defined on it. When a BPMN 2.0 activity is left, the default behavior is to evaluate the conditions on the outgoing sequence flow. When a condition evaluates to true, that outgoing sequence flow is selected. When multiple sequence flow are selected that way, multiple executions will be generated and the process will be continued in a parallel way.

可以为顺序流定义一个条件。当BPMN2.0中的Activity离开时,默认将先对所有外出顺序流的条件进行评估。当评估为真时,该顺序流就会被选中执行。当多个顺序流同时被选中时,流程就会创建多个流程执行,并进入并行模式继续执行。

Note: the above holds for BPMN 2.0 activities (and events), but not for gateways. Gateways will handle sequence flow with conditions in specific ways, depending on the gateway type.

Graphical notation

图形符号

A conditional sequence flow is visualized as a regular sequence flow, with a small diamond at the beginning. The condition expression is shown next to the sequence flow.

条件顺序流的图形表示与普通顺序流差不多,只是在起始点加一个小的菱形符号。流程条件则显示在图形表示附近。



XML representation

XML 表示

A conditional sequence flow is represented in XML as a regular sequence flow, containing a conditionExpression sub-element. Note that for the moment only tFormalExpressions are supported, Omitting the xsi:type="" definition will simply default to this only supported type of expressions.

条件顺序流的XML表示与普通顺序流一样,并增加了一个conditionExpression的子元素。注意现在只有tFormalExpressions 被支持,所以可以忽略xsi:type="" 的值定义,来缺省使用当前被支持的表达式类型。

<sequenceFlow id="flow" sourceRef="theStart" targetRef="theTask">
  <conditionExpression xsi:type="tFormalExpression">
    <![CDATA[${order.price > 100 && order.price < 250}]]>
  </conditionExpression>
</sequenceFlow> 

  

Activiti supports two kind of expressions: UEL-value and UEL-method expressions (UEL stands for Unified Expression Language and is part of the EE6 specification, see the EE6 specification for detailed information)

Activiti支持两种表达式: UEL-value UEL-method (UEL Unified Expression Language EE6标准中的一部分,可以参考 the EE6 specification 获取更多的信息)

 

Specifying the type of expression, is done through the language attribute on the expression element:

可以通过expression元素中的language属性来指定表达式的类型:

<conditionExpression xsi:type="tFormalExpression" language="uel-value | uel-method">
  <![CDATA[${order.isStandard}]]>
</conditionExpression>
 
  • uel-value: references data of a process variable, in the typical JavaBean style through getters.
  • uel-value: 表示一个流程变量,可以通过JavaBeangetter方法获取。
<conditionExpression xsi:type="tFormalExpression" language="uel-value">
  <![CDATA[${order.price > 100 && order.price < 250}]]>
</conditionExpression>
 
  • uel-method: invokes a method that resolves to a boolean value.
  • uel-method: 表示调用一个方法,该方法返回一个布尔值。

<conditionExpression xsi:type="tFormalExpression" language="uel-method">
  <![CDATA[${order.isStandardOrder}]]>
</conditionExpression>
Note that these expressions support resolving primitives (incl. comparing them), beans, lists, arrays and maps. If no value for the language attribute is specified, by default the expression is resolved as a value expression.

注意,这些表达式支持解析基础类型(包含对比它们)、beanlistarraymap。如果language属性没有被指定,缺省则将解析为一个值表达式。

 

The Activiti distribution contains the following example process using value and method expressions (seeorg.activiti.examples.bpmn.expression):

Activiti发行包中包含俩了下面这个使用值和方法表达式的示例(参见org.activiti.examples.bpmn.expression):


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先,Activity是Android系统中的四大组件之一,可以用于显示View。Activity是一个与用记交互的系统模块,几乎所有的Activity都是和用户进行交互的,但是如果这样就能说Activity主要是用来显示View就不太正确了。 在深入了解Activity之前,我们先要知道一下MVC设计模式,在JAVAEE 中MVC设计模式已经很经典了,而且分的也比较清晰了,但是在Android中,好多人对MVC在Android开发中的应用不是很清楚,下面我就先来介绍一下MVC在Android开发中的应用: M(Model 模型):Model是应用程序的主体部分,所有的业务逻辑都应该写在这里,在Android中Model层与JavaEE中的变化不大,如:对数据库的操作,对网络等的操作都放在该层(但不是说它们都放在同一个包中,可以分开放,但它们统称为Model层)。 V(View 视图):是应用程序中负责生成用户界面的部分,也是在整个MVC架构中用户唯一可以看到的一层,接收用户输入,显示处理结果;在Android应用中一般采用XML文件里德界面的描述,使用的时候可以非常方便的引入,当然也可以使用JavaScript+Html等方式作为View。 C(Controller控制层)android的控制层的重任就要落在众多的activity的肩上了,所以在这里就要建议大家不要在activity中写太多的代码,尽量能过activity交割Model业务逻辑层处理。 好了,在介绍过Android应用开发中的MVC架构后,我们就可以很明确的知道,在Android中Activity主要是用来做控制的,它可以选择要显示的View,也可以从View中获取数据然后把数据传给Model层进行处理,最后再来显示出处理结果。 介绍过Activity的主要作用后,那么我们就要详细说一下Activity了。 Activity生命周期图 Activity 的生命周期是被以下的函数控制的。 public class Activity extends ApplicationContext { protected void onCreate(Bundle icicle); protected void onStart(); protected void onRestart(); protected void onResume(); protected void onFreeze(Bundle outIcicle); protected void onPause(); protected void onStop(); protected void onDestroy(); } onCreate(Bundle) 函数是你进行初始化的地方,这个也是执行 setContentView(View)函数的地方,setContentView(View)函数可以传入一个由XML 编制的UI界面,可以使UI和具体实现完全分离。 onPause()函数是处理用户离开当前 Activity 的地方。更重要的是,任何在当前 Activity中的任何改变都要在这个函数中提交。 Activity有四种状态: 活动状态,当Activity处于Stack(栈)顶时,就是手机当前的现实屏幕,这是 Activity就 处于activity或者运行状态。 运行但是失去焦点,当Activity还处于运行状态时,但是屏幕是有另外一个Activity 处于文档处于焦点状态,当前的Activity就处于pause。 停止,当Activity被另一个Activity完全覆盖的时候,就被停止了,其实就是虽然在 运行,但是用户却看不见。 结束,当Activity处于pause或者stop时,系统可以结束 Activity,回收资源,这 是Activity就是处于结束状态了。 处于结束状态的是Activity,如果要使用户可见,只要重启才可以。 Activity的响应时间 当前Activity所在的线程为主线程,它的响应时间为5秒,如果在当前运行的Activity中进行耗时的操作且响应时间起过5秒,那么程序就会报ANR错误。所以,这也是不建议在Activity中写太多复杂代码的原因之一。 当然,有些代码只能写在Activity中,不然就运行不了(它们不是生命周期方法),比如你想要获得android系统或者硬件一的些信息,就必须在Activity中写出来,如果单独写一个工具类获得不了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值