PowerFolder 工作流服务器版本0.5 试驾之旅(6)

类别:Java 点击:0 评论:0 推荐:

Developing Scripts and Script Tags
开发脚本和脚本的标签

 4.1 Overview概述
To create or edit existing scripts, from the PowerFolder Console click 'Develop', then 'Scripts'.
You can script by entering its name in the box next to 'New Script' and clicking 'Create'.
Remember, new and editted scripts do not take affect until they are deployed under the
'Administer' section.
为了创建脚本或编辑已存在的脚本,从PowerFolder控制台中单击'Develop',然后
'Scripts'。你可以在New Script旁边的文本框中输入脚本的名称,单击'Create'来创建
脚本。记住,新的和编辑的脚本不会发生作用,直到他们在'Administer'部分被发布。

Scripts consist a hierarchy of tags. Tags have names, can have properties, and contain other tags.
脚本包括一系列的标签。标签有名字,可以有属性,而且可以包括其他标签。

There are two types of tags - core and returnable. Core tags represent workflow framework (e.g.
states, transitions, attributes, etc.). Returnable tags either evaluate (e.g. get an attribute's value,
add two values, get trigger text) or 'do something' (e.g. set an attribute, send an email, print to the
console).
有两种标签—核心标签和可运行标签。核心标签表示了工作流的框架结构(例如,状
态,转变,属性等等)。可运行标签或者求值(例如,得到一个属性的值,两个值相加,
得到触发器文本),或者做某些事情(例如,设置一个属性,发送一份电子邮件,打印到
控制台).

Core tags form the foundation of a script. 'Process Map' is at the base of this foundation, no tag
contains 'Process Map'. It contains the 'Attributes', 'Starts', 'States', and 'Stops' of the script. These
tags in turn hold other core tags. Some core tags, however, contain returnable tags. 'Execute'
needs one or more tags to evaluate or 'do something', 'If Transition' needs to evaluate whether its
path is taken, etc.
核心标签形成了脚本的基础。路线图是在这个基础之上,没有标签包含路线图。路线图包
括脚本的属性,开始,状态,结束。这些标签又可以包含其它核心标签。然而,一些核心
标签包含可运行标签。'Execute'标签需要一个或多个标签来求值或者做某些事情。'If
Transition'标签需要计算采用那条路径等等。

Returnable tags cannot contain core tags, but may contain other returnable tags.
可运行标签不能包括核心标签,但可以包含其他可运行标签。
 4.2 Core Tags核心标签

 4.2.1 Attribute属性
An attribute is a variable that can be set and read from within a script and externally using the
Web Client API. It has a type. This type can be a Boolean (true or false), Decimal (a number), a
String (character data), or a Java class.
属性是一个变量,它可以在一个脚本内被设置和读取,也可以使用web client
API来设置和读取。它有一个类型。这个类型可以是Boolean,Decimal,String,或者一个Jav
a类 。
 4.2.2 Attributes属性集合
Attributes, or attribute set, holds all script-specific Attributes and Interal Attributes.
属性集合,保持了所有脚本特定属性和内部属性 。
 4.2.3 Branch分支
A Branch allows a workflow to go in two or more directions simultaneously.
一个分支容许一个工作流同时进入两个或更多的方向。
 4.2.4 Default Transition默认转换
The path a workflow will take unless it is preempted by an If Transition.
一个工作流所采用的默认路径,除非它被IfTransition所截获。
 4.2.5 Execute执行
Execute holds all actions that take place at a State.
执行保持了所有在一个状态所发生的行为。
 4.2.6 If Transition条件转移
The path a workflow may take, instead of the one from Default Transition, if its condition
evaluates to true.
如果条件计算为真,一个工作流将采取的路径,而不是缺省转移的路径。
 4.2.7 Internal Attribute内部属性
An internal attribute is a variable that can be set and read from within a script, but not using the
Web Client API. In addition, it can't be queried. It has a type. This type can be a Boolean (true or
false), Decimal (a number), a String (character data), or a Java class.
一个内部属性是一个变量,可以被在脚本内读写,但是不可以使用web client
api来读些。另外,它也不能被查询。它有一个类型。这个类型可以是Boolean , Decimal, 
String ,或者一个 Java类。
 4.2.8 Process Map过程图
The container holding the Attributes, Starts, States, and Stops that constitute a workflow script. It
has a name and a version.
这个容器包含了属性,开始,状态和结束,它们构成了一个工作流脚本。它有一个名字和
版本。

 4.2.9 Starts开始集合
The container holding all possible points where a workflow can start.
这个容器保持了一个工作流所可能启动的所有点。
 4.2.10 Start开始
A point where a workflow can begin if its triggering condition evaluates to true. It must have a
Default Transition and can have zero or more If Transistions. In addition, it can have one or
more Branches to allow it to go in more than one direction at once.
工作流可以从此点启动,如果一个触发器条件计算为真。它必须有一个缺省转移,也可以
有0个或多个条件转移。另外,它可以有一个或多个分支,容许它一次进入多于一个方向

 4.2.11 States状态集合
The container holding all intermediary States of a workflow.
这个容器保持了工作流的所有交互状态点。
 4.2.12 State状态
A point where a workflow may reach during its life. It can Wait For Event and have one or more
Executes so that the State 'does something'. It must have a Default Transition and can have zero
or more If Transistions. In addition, it can have one or more Branches to allow it to go in more
than one direction at once.
工作流在其生命周期可以到达的一个点。它可以等待事件,而且有一个或多个执行标签,
这样状态标签可以做某些事情。它必须具有一个缺省转移而且可以有有0个或多个条件转
移。另外,它可以有一个或多个分支,容许它一次进入多于一个方向。
 4.2.13 Stops结束集合
The container holding all points where a workflow can Stop.
这个容器保持了所有一个工作流可以结束的点。
 4.2.14 Stop结束
A point where a workflow reaches the end of its life. A workflow will still be active if there are
still active Branches.
一个工作流在其生命周期结束时到达的点。一个工作流将继续保持活动,如果仍然有活动
分支存在。

 4.2.15 Wait For Event等候事件
Pause the workflow until notified to continue by the Web Client's 'releaseWaitAtState'. If there
other active Branches, these will remain active.
暂停工作流直到被web
客户端的'释放等候状态'所通知。如果没有其他活动分支,工作流将保持活动。

 4.3 Returnable Tags可运行标签

- Add - add two Decimal's together and return a Decimal.加法--两个数值相加,返回一个数值
- Boolean - return a constant Boolean, true or false. 布尔--返回一个常量布尔,真或假
- Byte - return a Java 'byte' type. 字节--返回一个java字节类型
- Call a Static Method in a Java Class - call a 'static' Java method and return the
result.调用一个静态的java方法,返回结果
- Character - return a Java 'char' type.返回一个Java字符类型
- Constructor - return the class instance created by a Java
constructor.返回一个java构造函数生成的类的实例
- Convert String To Decimal - convert a String into a Decimal and return
it.将一个字符串转换成数值型并返回它
- Decimal - return a constant Decimal, decimal number.返回一个数值常数
- Divide - divide one Decimal from another and return the result.两个数值相除
- Double - return a Java 'double' type.返回一个java 双精度
- Equal - compare two Decimal's. If they are equal, return Boolean true, otherwise Boolean
false.比较两个数值。如果他们相等,返回真,否则返回假
- Evaluate Exponential - raise one Decimal to the power of another Decimal and return the
result.计算幂运算的值
- Float - return a Java 'float' type.返回一个java浮点值
- Get Application Attribute - return the value of an Attribute. The return type is the same as the
Attribute.得到应用程序属性--返回一个属性的值。返回类型和属性相同。
- Get Trigger Attribute - get the contents from an XML attribute in the trigger and return it as a
String.得到触发器属性--在一个触发器中,从一个xml属性中得到内容,按照字符串返回。
- Get Trigger Element Count - get the number of child elements contained in an element of the
trigger and return as a Decimal.得到一个元素中子元素的数量,返回数值。
- Get Trigger Text - get the text contained within a trigger element and return it as a
String.在一个触发器中,得到包含的文本,按照字符串返回
- Int - return a Java 'int' type.返回一个java int类型
- Integer - return an Integer (Java BigInteger). 返回一个Integer类型
- Is Trigger Attribute Present - return Boolean true if a specific attribute exists in an element of
the trigger, Boolean false otherwise.判断特定属性是否包含在触发器中,返回真或假
- Is Trigger Element Present - return Boolean true if a specific element exists in the trigger,
Boolean false otherwise.如果一个特定的元素存在于触发器中,那么返回真,否则为假。
- Is Trigger Text Present - return Boolean true if a specific element in the trigger contains text,
Boolean false otherwise.如果在触发器中特定元素包含文本,返回真,否则为假。
- Java Call - call a Java method on an instance and return the type and value returned by the
function.调用一个实例的java方法,返回此功能的类型和值。
- Java Long - return a Java 'long'.返回一个java long值
- Java Null Reference - return a Java 'null' reference of a specified type.返回一个java 空引用
- Java Short - return a Java 'short'. 返回一个java short值
- Logical And - compare two or more Booleans. If all are true, return Boolean true, otherwise
Boolean false.比较两个或者更多布尔值。如果都是真,返回真;否则为假。
- Logical Not - evaluate a Boolean. If it's true, return Boolean true, Boolean false
otherwise.逻辑非
- Logical Or - compare two or more Booleans. If at least one is true, return Boolean true,逻辑或
otherwise Boolean false.
- Logical 'Short-Circuit' And - return the Boolean result of a Java '&&'.逻辑短与,等价与&&
- Logical 'Short-Circuit' Or - return the Boolean result of a Java '||'.逻辑短或,等价于||
- Logical Xor - compare two Booleans. If one is true and the other is false, return Boolean true,
Boolean false otherwise.逻辑异或
- Multiply - multiply two or more Decimals and return the result as a Decimal.乘法运算
- Print To Console - print zero or more Strings to the console and return nothing.打印到控制台
- See If Greater Than Or Equal - compare two Decimals. If the first one is greater than or equal
to the second, return Boolean true, otherwise return Boolean false.看是否大于或等于
- See If Greater Than - compare two Decimals. If the first one is greater than the second, return
Boolean true, otherwise return Boolean false.看是否大于
- See If Less Than Or Equal - compare two Decimals. If the first one is less than or equal to the
second, return Boolean true, otherwise return Boolean false.看是否小于或等于
- See If Less Than - compare two Decimals. If the first one is less than the second, return
Boolean true, otherwise return Boolean false.看是否小于
- See If Not Equal - compare two Decimals. If the first one is not equal to the second, return
Boolean true, otherwise return Boolean false.看是否不等于
- Send Simple Email - send an email containing zero or more Strings as its context (body).
Return nothing.
 发送简单邮件--发送一份电子邮件,包含零或多个字符串作为其内容。无返回。
- Set Application Attribute - set an Attribute to a value and return that value with the attributes
type.
设置一个应用程序属性
- String - return a literal string (zero or more letters grouped together).字符串--返回一个字符串
- Subtract - subtract one Decimal from another Decimal, and return the result as a Decimal.减法-
-将一个数字减去另一个数字,将结果按照数字返回。

本文地址:http://com.8s8s.com/it/it13524.htm