OSWorkflow中的标签元素与概念[原]

原创 2004年09月23日 16:20:00

OSWorkflow的核心是一个使用XML定义的描述符文件,下面是对OSWorkflow的描述符文件标签以及OSWorkflow基本概念的说明:

 

一、名词说明:

1.  workflow        工作流

2.  step                步骤

3.  action             动作

4.  result                     执行结果

5.  split                步骤分割

6.  join                 步骤合并

7.  register           寄存器

8.  functions         函数

9.  conditions              条件

10. context            上下文

11. state                状态

 

二、标签及概念:

1.  一个工作流( workflow )可以包含多个step( 步骤 )

2.  一个step可以有多个action( 动作 )action可以被设置为自动执行,也可以是通过用户介入,而通过程序调用执行。

3.  一个action要至少有一个unconditional result和零个或多个conditional result(result是指action的执行结果)

4.  如果你指定了多个conditional results,那么符合执行条件的第一个result将被执行,如果没有指定conditional results或者没有任何一个conditional   results符合执行的条件,那么将执行unconditional result

5.  一个result可以仍然使流程驻留在当前step,可以指向一个新的step,可以指向一个split(步骤分割),还可以指向一个join(步骤合并)。在所述的所有情况下,workflow

    的状态也可以改变(例如:workflow的状态是Underway,QueuedFinished)

6.  如果一个result指向一个split,那么它所指向的split的属性是在splits的标签中描述的。

7.  一个split可以拥有一个或多个unconditional results,但是没有conditional resultsunconditional results指向了从这个split中即将进入的steps

8.  register(寄存器)是一个全局变量,它可以被每个workflow处理,而且也可以用在functions(函数)conditions(条件)中。

9.  propertySet是一个存放持久型数据的map,它可以被当作全局的调用。

10. transientVars是用于存放临时变量的一个map,所有的functionsconditions都可以使用它。它包含所有的registersuser inputs、以及当前workflowcontext(上下文)state(状态)。它仅仅在一个workflow调用的生命期存在。

 

三、OSWorkflow例子程序中的描述符文件:

下面是OSWorkflow例子程序中的描述符文件,可以参考上面的描述与下面的描述符文件对比理解:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_6.dtd">

<workflow>

       <initial-actions>

              <action id="1" name="Start Workflow">

                     <restrict-to>

                            <conditions type="AND">

                                   <condition type="beanshell">

                                          <arg name="script">true</arg>

                                   </condition>

                                   <condition type="class">

                                          <arg name="class.name">

com.opensymphony.workflow.util.OSUserGroupCondition

</arg>

                                          <arg name="group">foos</arg>

                                   </condition>

                            </conditions>

                     </restrict-to>

                     <pre-functions>

                            <function type="class">

                                   <arg name="class.name">com.opensymphony.workflow.util.Caller</arg>

                            </function>

                     </pre-functions>

                     <results>

                             <unconditional-result

old-status="Finished" status="Underway" step="1" owner="${caller}"/>

                     </results>

              </action>

       </initial-actions>

       <steps>

              <step id="1" name="First Draft">

                     <external-permissions>

                            <permission name="permA">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                            </permission>

                     </external-permissions>

                     <actions>

                            <action id="1" name="Finish First Draft">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="beanshell">

                                                        <arg name="script">true</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="beanshell">

                                                 <arg name="script">

                                String caller = context.getCaller();

                                propertySet.setString("caller", caller);

                                boolean test = true;

                                String yuck = null;

                                String blah = "987654321";

                                System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");

                            </arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <result old-status="Finished" split="1">

                                                 <conditions type="AND">

                                                        <condition type="beanshell">

                                                               <arg name="script">

                                                                      propertySet.getString("caller").equals("test")

                                                               </arg>

                                                        </condition>

                                                 </conditions>

                                                 <post-functions>

                                                        <function type="beanshell">

                                                               <arg name="script">

                                        System.out.println("11111111111111");

                                    </arg>

                                                        </function>

                                                 </post-functions>

                                          </result>

                                          <unconditional-result old-status="Finished" split="2"/>

                                   </results>

                                   <post-functions>

                                          <function type="beanshell">

                                                 <arg name="script">

                                System.out.println("22222222222222");

                            </arg>

                                          </function>

                                   </post-functions>

                            </action>

                     </actions>

              </step>

              <step id="2" name="Edit Doc">

                     <external-permissions>

                            <permission name="permB">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                            </permission>

                     </external-permissions>

                     <actions>

                            <action id="2" name="Sign Up For Editing">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Queued</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.OSUserGroupCondition

</arg>

                                                        <arg name="group">bars</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.Caller

</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

old-status="Finished" status="Underway" step="2" owner="${caller}"/>

                                   </results>

                            </action>

                            <action id="3" name="Finish Editing">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.MostRecentOwner

</arg>

                                                 <arg name="stepId">1</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

old-status="Finished" status="Underway" step="3" owner="${mostRecentOwner}"/>

                                   </results>

                            </action>

                            <action id="4" name="Requeue Editing">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <results>

                                          <unconditional-result old-status="Finished" status="Queued" step="2"/>

                                   </results>

                            </action>

                     </actions>

              </step>

              <step id="3" name="Review Doc">

                     <external-permissions>

                            <permission name="permA">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                            </permission>

                     </external-permissions>

                     <actions>

                            <action id="5" name="More Edits">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusConditio

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.MostRecentOwner

</arg>

                                                 <arg name="stepId">2</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

old-status="Finished" status="Underway" step="2" owner="${mostRecentOwner}"/>

                                   </results>

                            </action>

                            <action id="6" name="Peer Review">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <results>

                                          <unconditional-result old-status="Finished" status="Queued" step="4"/>

                                   </results>

                            </action>

                            <action id="7" name="Publish Doc">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.MostRecentOwner

</arg>

                                                 <arg name="stepId">2</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

                                                old-status="Finished" status="Underway" step="5" owner="${mostRecentOwner}"/>

                                   </results>

                            </action>

                     </actions>

              </step>

              <step id="4" name="Second Review">

                     <external-permissions>

                            <permission name="permC">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                            </permission>

                     </external-permissions>

                     <actions>

                            <action id="8" name="Finish Second Review">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.MostRecentOwner

</arg>

                                                 <arg name="stepId">3</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

old-status="Finished" status="Underway" step="3" owner="${mostRecentOwner}"/>

                                   </results>

                            </action>

                            <action id="9" name="Sign Up For Second Review">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Queued</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.OSUserGroupCondition

</arg>

                                                        <arg name="group">bazs</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.Caller

</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

old-status="Finished" status="Underway" step="4" owner="${caller}"/>

                                   </results>

                            </action>

                            <action id="10" name="Queue Second Review">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <results>

                                          <unconditional-result old-status="Finished" status="Queued" step="4"/>

                                   </results>

                            </action>

                     </actions>

              </step>

              <step id="5" name="Publish Doc">

                     <actions>

                            <action id="11" name="Publish Document">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <pre-functions>

                                          <function type="class">

                                                 <arg name="class.name">

com.opensymphony.workflow.util.Caller

</arg>

                                          </function>

                                   </pre-functions>

                                   <results>

                                          <unconditional-result

old-status="Finished" status="Finished" step="5" owner="${caller}"/>

                                   </results>

                            </action>

                     </actions>

              </step>

              <step id="6" name="Foo">

                     <actions>

                            <action name="Finish Foo" id="12">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                        <arg name="stepId">6</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                        <arg name="stepId">6</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <results>

                                          <unconditional-result old-status="Finished" join="1"/>

                                   </results>

                            </action>

                     </actions>

              </step>

              <step id="7" name="Bar">

                     <actions>

                            <action name="Finish Bar" id="13">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                        <arg name="stepId">7</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                        <arg name="stepId">7</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <results>

                                          <unconditional-result

 old-status="Finished" owner="test" status="Underway" step="8"/>

                                   </results>

                            </action>

                     </actions>

              </step>

              <step id="8" name="Baz">

                     <actions>

                            <action name="Finish Baz" id="14">

                                   <restrict-to>

                                          <conditions type="AND">

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.StatusCondition

</arg>

                                                        <arg name="status">Underway</arg>

                                                        <arg name="stepId">8</arg>

                                                 </condition>

                                                 <condition type="class">

                                                        <arg name="class.name">

com.opensymphony.workflow.util.AllowOwnerOnlyCondition

</arg>

                                                        <arg name="stepId">8</arg>

                                                 </condition>

                                          </conditions>

                                   </restrict-to>

                                   <results>

                                          <unconditional-result old-status="Finished" join="1"/>

                                   </results>

                            </action>

                     </actions>

              </step>

       </steps>

       <splits>

              <split id="1">

                     <unconditional-result old-status="Finished" status="Underway" owner="test" step="6"/>

                     <unconditional-result old-status="Finished" status="Underway" owner="test" step="7"/>

              </split>

              <split id="2">

                     <unconditional-result old-status="Finished" status="Queued" step="2"/>

              </split>

       </splits>

       <joins>

              <join id="1">

                     <conditions type="AND">

                            <condition type="beanshell">

                                   <arg name="script">

<![CDATA["Finished".equals(jn.getStep(6).getStatus())

  && "Finished".equals(jn.getStep(8).getStatus())]]>

</arg>

                            </condition>

                     </conditions>

                     <unconditional-result old-status="Finished" status="Underway" owner="test" step="2"/>

              </join>

       </joins>

</workflow>

osworkflow学习笔记2-标签

 一、Step,Status ,ActionStep大致相当于流程所在的位置。譬如企业年检,年检报告书在企业端算一个step,在工商局算第二个step,在复核窗口算第三个step。每个step可以有多...
  • liumm1983
  • liumm1983
  • 2007年03月15日 14:03
  • 1314

OSWorkFlow流程配置文件详解

AbstractWorkflow>> osworkflow中有关工作流流转的所有核心代码都在AbstractWorkflow中,BasicWorkflow就是派生自它,不过这个BasicWorkfl...
  • lifuxiangcaohui
  • lifuxiangcaohui
  • 2014年09月04日 11:32
  • 3178

osworkflow与spring的整合

    经过两天的辛勤努力,一个简单Spring+osworkflow结构的代码框架终于搭建好了,用Spring来管理bean和实现页面的跳转,osworkflow来实现业务流程,在页面上显示,使得按...
  • zh417
  • zh417
  • 2007年08月12日 21:54
  • 5071

OSWorkflow源码分析

 OSWorkflow的关键包组成:-          com.opensymphony.workflow-          com.opensymphony.workflow.config-  ...
  • tanruitian
  • tanruitian
  • 2005年10月09日 15:56
  • 1908

用OSWorkFlow和JBPM开发工作流异同

一、用OSWorkFlow和JBPM开发工作流,首先要做的都是编写工作流描述文件,在此基础上再进一步做相关的配置和调用。二、编写流程描述文件方式1、  JBPM是通过图形化的编辑工具(JBPM自带的E...
  • victor16345
  • victor16345
  • 2010年05月21日 17:10
  • 13027

osworkflow工作流引擎学习笔记

本指导资料假定你已经部署OSWorkflow的范例应用在你的container上。范例应用部署是使用基于内存的数据存储,这样你不需要担心如何配置其他持久化的例子。范例应用的目的是为了说明如何应用OSW...
  • wacky
  • wacky
  • 2016年08月12日 10:55
  • 2006

osworkflow教程

转载:http://blog.csdn.net/chaishen10000/article/details/6453857 接口选择:   osworkflow提供几种实现com.opensymp...
  • sujiacheng_123
  • sujiacheng_123
  • 2017年05月02日 10:31
  • 728

osworkflow简单教程

osworkflow 基础api 接口选择:  osworkflow提供几种实现com.opensymphony.workflow.Workflow。     BasicWorkflow:  不提供事...
  • joliny
  • joliny
  • 2008年01月16日 17:12
  • 1579

OSWorkflow中的函数[原]

二、工作流中的函数OSWorkflow支持下面的函数:1. Java-based Functions(基于Java的函数)基于Java的函数必须要实现com.opensymphony.workflow...
  • tenwang1977
  • tenwang1977
  • 2004年09月06日 17:50
  • 2114

j2ee常用工作流比较(shart、osworkflow、jbpm)

工作流引擎   Shark(EnhydraShark) Osworkflow opensymphony Jbpm(JBoss JBPM) 工作流描述语言...
  • shadowkiss
  • shadowkiss
  • 2013年05月07日 15:14
  • 2293
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:OSWorkflow中的标签元素与概念[原]
举报原因:
原因补充:

(最多只允许输入30个字)