Shark工作流的实现和WMFC&OMG规范的对比
2004-02-07 22:51
465 查看
Shark工作流的实现和WMFC&OMG规范的对比
-----第七部分:工作流信息和业务信息如何建立连接
关键字:Shark 工作流 WMFC OMG 规范
工作流实例化后就需要把具体的活动和业务过程连接起来,如果是用户交互的活动,还需要指定与这个活动相关的界面。
这一部分的工作是具体实现的内容,WMFC规范没有提及。
下面我们看看jbpm的做法:jbpm-1.0-src/jbpm-1.0/examples/process/holiday/processdefinition[/b].xml
Jbpm并没有采用标准的xpdl工作流描述语言[/b],具体如下:
<?xml version="1.0"?>
<process-definition>
<name>Holiday[/b] request[/b]</name>
<description>This process manages a planned absence of an employee.</description>
<responsible>ae</responsible>
<start-state name="start holiday request">
<description>start a request for a holiday</description>
<role>requester</role>
<field attribute="start date" access="write-only-required" />
<field attribute="end date" access="write-only-required" />
<field attribute="comment" access="write-only" />
<transition to="evaluating">[/b]
<action event="transition" handler="org.jbpm.workflow.delegation.impl.action.MsgQueueAction" on-exception="log">[/b]
<parameter name="msg.destination.jndi.name">queue/A</parameter>
<parameter name="msg.connection.factory.jndi.name">ConnectionFactory</parameter>
<parameter name="msg.text">a holiday was requested from ${start date} to ${end date} with comment ${comment}</parameter>
</action>
<action event="transition" handler="org.jbpm.workflow.delegation.impl.action.EmailAction" on-exception="log">[/b]
<parameter name="to">previousActor</parameter>
<parameter name="subject">you requested a holiday</parameter>
<parameter name="message">you requested a holiday from ${start date} to ${end date} with comment ${comment}</parameter>
</action>
</transition>
</start-state>
<end-state name="end" />
<attribute name="requester" type="actor" />
<attribute name="boss" type="actor" />
<attribute name="hr-responsible" type="actor" />
<attribute name="start date" type="date" />
<attribute name="end date" type="date" />
<attribute name="comment" type="text" initial-value="Put your comments here." />
<attribute name="evaluation result" type="evaluation" />
<activity-state name="evaluating">
<description>In this activity, You have to evaluate the holiday-request of your employee.</description>
<assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver">
<parameter name="expression" >previousActor->group(hierarchy)->role(boss)</parameter>
</assignment>
<role>boss</role>
<field attribute="requester" access="read-only" />
<field attribute="start date" access="read-only" />
<field attribute="end date" access="read-only" />
<field attribute="evaluation result" access="write-only" />
<transition to="evaluation" />
</activity-state>
<decision name="evaluation" [/b]handler="org.jbpm.workflow.delegation.impl.decision.EvaluationDecision">
<parameter name="attribute">evaluation result</parameter>
<transition name="approve" to="approved holiday fork" />
<transition name="disapprove" to="disapproval notification" />
</decision>
<activity-state name="disapproval notification">
<description>This is a notification of the refusal of your holiday request. By submitting this form you declare to have taken notice of the refusal.</description>
<role>requester</role>
<transition to="end" [/b]/>
</activity-state>
<concurrent-block>
<fork name="approved holiday fork">
<transition name="hr" to="HR notification" />
<transition name="requester" to="approval notification" />
</fork>
<join name="join before finish">
<transition to="end" [/b]/>
</join>
<activity-state name="HR notification">
<description>In this activity, You have to register that an employee is taking holiday.</description>
<assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver">
<parameter name="expression" >role(boss)->group(hierarchy)->role(hr-responsible)</parameter>
</assignment>
<role>hr-responsible</role>
<transition to="join before finish" [/b]/>
</activity-state>
<activity-state name="approval notification">
<description>You get notified that your holiday request has been approved.</description>
<assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver">
<parameter name="expression" >role(requester)</parameter>
</assignment>
<transition to="join before finish"[/b] />
</activity-state>
</concurrent-block>
</process-definition>
如果熟悉struts的读者看到上面的描述会发现, <transition to="join before finish" [/b]/> 这样的写法和struts配置文件中的页面跳转十分类似。
上面的写法非常直观,不过比较Shark的XPDL实现。推荐还是使用XPDL的流程描述。
XPDL 把jbpm中分散的跳转放到了一起:
<xpdl:Transitions>
<xpdl:Transition Id="3cb3f6d1-56c6-11d8-8fe6-8f02bbfa91d7" From="提交辞职申请" To="部门经理批准" Name=""/>
<xpdl:Transition Id="6264b4f6-56c6-11d8-8fe6-8f02bbfa91d7" From="部门经理复查" To="总经理批准" Name=""/>
<xpdl:Transition Id="b612ac69-56c6-11d8-8fe6-8f02bbfa91d7" From="部门经理批准" To="财务审查" Name=""/>
<xpdl:Transition Id="b762d31a-56c6-11d8-8fe6-8f02bbfa91d7" From="部门经理批准" To="人力资源审查" Name=""/>
<xpdl:Transition Id="b8a983eb-56c6-11d8-8fe6-8f02bbfa91d7" From="人力资源审查" To="部门经理复查" Name=""/>
<xpdl:Transition Id="bd8394ac-56c6-11d8-8fe6-8f02bbfa91d7" From="财务审查" To="部门经理复查" Name=""/>
</xpdl:Transitions>
但是jbpm的做法也有一个非常好的地方,就是把工作流程和业务系统建立了关系。
下文将具体的说说jbpm中做法的优点。
待续
田春峰
accesine@163.com
-----第七部分:工作流信息和业务信息如何建立连接
关键字:Shark 工作流 WMFC OMG 规范
工作流实例化后就需要把具体的活动和业务过程连接起来,如果是用户交互的活动,还需要指定与这个活动相关的界面。
这一部分的工作是具体实现的内容,WMFC规范没有提及。
下面我们看看jbpm的做法:jbpm-1.0-src/jbpm-1.0/examples/process/holiday/processdefinition[/b].xml
Jbpm并没有采用标准的xpdl工作流描述语言[/b],具体如下:
<?xml version="1.0"?>
<process-definition>
<name>Holiday[/b] request[/b]</name>
<description>This process manages a planned absence of an employee.</description>
<responsible>ae</responsible>
<start-state name="start holiday request">
<description>start a request for a holiday</description>
<role>requester</role>
<field attribute="start date" access="write-only-required" />
<field attribute="end date" access="write-only-required" />
<field attribute="comment" access="write-only" />
<transition to="evaluating">[/b]
<action event="transition" handler="org.jbpm.workflow.delegation.impl.action.MsgQueueAction" on-exception="log">[/b]
<parameter name="msg.destination.jndi.name">queue/A</parameter>
<parameter name="msg.connection.factory.jndi.name">ConnectionFactory</parameter>
<parameter name="msg.text">a holiday was requested from ${start date} to ${end date} with comment ${comment}</parameter>
</action>
<action event="transition" handler="org.jbpm.workflow.delegation.impl.action.EmailAction" on-exception="log">[/b]
<parameter name="to">previousActor</parameter>
<parameter name="subject">you requested a holiday</parameter>
<parameter name="message">you requested a holiday from ${start date} to ${end date} with comment ${comment}</parameter>
</action>
</transition>
</start-state>
<end-state name="end" />
<attribute name="requester" type="actor" />
<attribute name="boss" type="actor" />
<attribute name="hr-responsible" type="actor" />
<attribute name="start date" type="date" />
<attribute name="end date" type="date" />
<attribute name="comment" type="text" initial-value="Put your comments here." />
<attribute name="evaluation result" type="evaluation" />
<activity-state name="evaluating">
<description>In this activity, You have to evaluate the holiday-request of your employee.</description>
<assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver">
<parameter name="expression" >previousActor->group(hierarchy)->role(boss)</parameter>
</assignment>
<role>boss</role>
<field attribute="requester" access="read-only" />
<field attribute="start date" access="read-only" />
<field attribute="end date" access="read-only" />
<field attribute="evaluation result" access="write-only" />
<transition to="evaluation" />
</activity-state>
<decision name="evaluation" [/b]handler="org.jbpm.workflow.delegation.impl.decision.EvaluationDecision">
<parameter name="attribute">evaluation result</parameter>
<transition name="approve" to="approved holiday fork" />
<transition name="disapprove" to="disapproval notification" />
</decision>
<activity-state name="disapproval notification">
<description>This is a notification of the refusal of your holiday request. By submitting this form you declare to have taken notice of the refusal.</description>
<role>requester</role>
<transition to="end" [/b]/>
</activity-state>
<concurrent-block>
<fork name="approved holiday fork">
<transition name="hr" to="HR notification" />
<transition name="requester" to="approval notification" />
</fork>
<join name="join before finish">
<transition to="end" [/b]/>
</join>
<activity-state name="HR notification">
<description>In this activity, You have to register that an employee is taking holiday.</description>
<assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver">
<parameter name="expression" >role(boss)->group(hierarchy)->role(hr-responsible)</parameter>
</assignment>
<role>hr-responsible</role>
<transition to="join before finish" [/b]/>
</activity-state>
<activity-state name="approval notification">
<description>You get notified that your holiday request has been approved.</description>
<assignment handler="org.jbpm.workflow.delegation.impl.assignment.AssignmentExpressionResolver">
<parameter name="expression" >role(requester)</parameter>
</assignment>
<transition to="join before finish"[/b] />
</activity-state>
</concurrent-block>
</process-definition>
如果熟悉struts的读者看到上面的描述会发现, <transition to="join before finish" [/b]/> 这样的写法和struts配置文件中的页面跳转十分类似。
上面的写法非常直观,不过比较Shark的XPDL实现。推荐还是使用XPDL的流程描述。
XPDL 把jbpm中分散的跳转放到了一起:
<xpdl:Transitions>
<xpdl:Transition Id="3cb3f6d1-56c6-11d8-8fe6-8f02bbfa91d7" From="提交辞职申请" To="部门经理批准" Name=""/>
<xpdl:Transition Id="6264b4f6-56c6-11d8-8fe6-8f02bbfa91d7" From="部门经理复查" To="总经理批准" Name=""/>
<xpdl:Transition Id="b612ac69-56c6-11d8-8fe6-8f02bbfa91d7" From="部门经理批准" To="财务审查" Name=""/>
<xpdl:Transition Id="b762d31a-56c6-11d8-8fe6-8f02bbfa91d7" From="部门经理批准" To="人力资源审查" Name=""/>
<xpdl:Transition Id="b8a983eb-56c6-11d8-8fe6-8f02bbfa91d7" From="人力资源审查" To="部门经理复查" Name=""/>
<xpdl:Transition Id="bd8394ac-56c6-11d8-8fe6-8f02bbfa91d7" From="财务审查" To="部门经理复查" Name=""/>
</xpdl:Transitions>
但是jbpm的做法也有一个非常好的地方,就是把工作流程和业务系统建立了关系。
下文将具体的说说jbpm中做法的优点。
待续
田春峰
accesine@163.com
相关文章推荐
- 介绍.Text 中的TrackBack
- 珍惜生命啊,看几个新闻!
- 首页"进入我的博客"可以正常使用了
- The longest class name in Java and .NET Framework
- 准备养个蜥蜴
- ADO.NET: Close()与Dispose() 的讨论
- 折腾了我一个下午及吃晚饭时间的问题
- MSMQ
- 软件/团队/创业《程序员》杂志第12期
- 用C#修改Windows 2000用户密码
- 更新排行榜说明
- 程序员是如何喝酒的
- 有感学习
- 为你的企业建立竞争情报系统
- 让文本框“聪明”一点的深入探讨!
- .net多语言和数据集内多数据表的处理(3)
- 一个简单的学生成绩管理程序(二叉树实现)
- 如何包装窗口的部分非客户区并控制其大小
- 博客园的程序已从.Text 0.95升级到0.96
- PHP4之真OO