前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Shark工作流的实现和WMFC&OMG规范的对比

Shark工作流的实现和WMFC&OMG规范的对比

作者头像
田春峰-JCJC错别字检测
发布2019-02-14 14:57:02
9270
发布2019-02-14 14:57:02
举报

Shark工作流的实现和WMFC&OMG规范的对比

-----第七部分:工作流信息和业务信息如何建立连接

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

关键字:Shark 工作流 WMFC OMG 规范

工作流实例化后就需要把具体的活动和业务过程连接起来,如果是用户交互的活动,还需要指定与这个活动相关的界面。

这一部分的工作是具体实现的内容,WMFC规范没有提及。

下面我们看看jbpm的做法:jbpm-1.0-src/jbpm-1.0/examples/process/holiday/processdefinition.xml

Jbpm并没有采用标准的xpdl工作流描述语言,具体如下:

<?xml version="1.0"?>

<process-definition>

<name><?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Holiday request</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">

<action event="transition" handler="org.jbpm.workflow.delegation.impl.action.MsgQueueAction" on-exception="log">

<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">

<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" 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" />

</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" />

</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" />

</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" />

</activity-state>

</concurrent-block>

</process-definition>

如果熟悉struts的读者看到上面的描述会发现, <transition to="join before finish" /> 这样的写法和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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2004年02月07日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档