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

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

                                        -----第五部分:工作流的实例化

 

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

学习了这么多的开源框架,准备自己也实现一个。万事开头难,先说说如何用XPDL来描述流程中需要包含的信息和如何实例化一个流程。

shark中有一个Package-Business_Example 的例子。其中Customer Service - Request for Partial Shipment (客户服务对分装运输的要求)流程信息的xdpl描述如下:

<WorkflowProcess>

    <WorkflowProcess AccessLevel="PUBLIC" Id="Business_Example_Wor2" Name="Customer Service - Request for Partial Shipment">

        <ProcessHeader DurationUnit="D">

            <Created>13-03-2003</Created>

        </ProcessHeader>

        <RedefinableHeader PublicationStatus="UNDER_TEST"/>

        <FormalParameters>

            <FormalParameter Id="Customer_Name" Index="1" Mode="IN">

                <DataType>

                    <BasicType Type="STRING"/>

                </DataType>

                <Description>The customer (or customer organization) name</Description>

            </FormalParameter>

            <FormalParameter Id="Product_Name" Index="2" Mode="IN">

                <DataType>

                    <BasicType Type="STRING"/>

                </DataType>

                <Description>The product name</Description>

            </FormalParameter>

            <FormalParameter Id="Ordered_Quantity" Index="3" Mode="IN">

                <DataType>

                    <BasicType Type="INTEGER"/>

                </DataType>

                <Description>The number of ordered items</Description>

            </FormalParameter>

            <FormalParameter Id="No_Of_Stocked_Items" Index="4" Mode="IN">

                <DataType>

                    <BasicType Type="INTEGER"/>

                </DataType>

                <Description>The number of ordered items on stock</Description>

            </FormalParameter>

            <FormalParameter Id="Partial_Ship_Status" Index="5" Mode="OUT">

                <DataType>

                    <DeclaredType Id="Business_Example_Typ2"/>

                </DataType>

                <Description>If customer aggreed on partial shipment, set the value of this variable to "OK", otherwise to anything else ("NOT_OK" for e.g.)</Description>

            </FormalParameter>

        </FormalParameters>

        <Activities>

            <Activity Id="Business_Example_Wor2_Act4" Name="notify sales">

                <Description>Enter the customer response ("OK" if customer accepts partial shipment)</Description>

                <Implementation>

                    <No/>

                </Implementation>

                <Performer>Participant_Repository_Par10</Performer>

                <StartMode>

                    <Automatic/>

                </StartMode>

                <FinishMode>

                    <Automatic/>

                </FinishMode>

                <ExtendedAttributes>

                    <ExtendedAttribute Name="ParticipantID" Value="Participant_Repository_Par10"/>

                    <ExtendedAttribute Name="XOffset" Value="381"/>

                    <ExtendedAttribute Name="YOffset" Value="70"/>

                    <ExtendedAttribute Name="VariableToProcess_UPDATE" Value="Partial_Ship_Status"/>

                </ExtendedAttributes>

            </Activity>

            <Activity Id="Business_Example_Wor2_Act2" Name="ask customer for partial shipment">

                <Description>Asks customer if it is OK to partialy ship the existing number of wanted items</Description>

                <Implementation>

                    <No/>

                </Implementation>

                <Performer>Participant_Repository_Par10</Performer>

                <StartMode>

                    <Automatic/>

                </StartMode>

                <FinishMode>

                    <Automatic/>

                </FinishMode>

                <ExtendedAttributes>

                    <ExtendedAttribute Name="ParticipantID" Value="Participant_Repository_Par10"/>

                    <ExtendedAttribute Name="XOffset" Value="226"/>

                    <ExtendedAttribute Name="YOffset" Value="70"/>

                    <ExtendedAttribute Name="VariableToProcess_VIEW" Value="Customer_Name"/>

                    <ExtendedAttribute Name="VariableToProcess_VIEW" Value="Product_Name"/>

                    <ExtendedAttribute Name="VariableToProcess_VIEW" Value="Order_Quantity"/>

                    <ExtendedAttribute Name="VariableToProcess_VIEW" Value="No_Of_Stocked_Items"/>

                </ExtendedAttributes>

            </Activity>

        </Activities>

        <Transitions>

            <Transition From="Business_Example_Wor2_Act2" Id="Business_Example_Wor2_Tra23" Name="Transition" To="Business_Example_Wor2_Act4">

                <ExtendedAttributes>

                    <ExtendedAttribute Name="RoutingType" Value="NOROUTING"/>

                </ExtendedAttributes>

            </Transition>

        </Transitions>

        <ExtendedAttributes>

            <ExtendedAttribute Name="StartOfWorkflow" Value="Participant_Repository_Par10;Business_Example_Wor2_Act2;128;70;NOROUTING"/>

            <ExtendedAttribute Name="EndOfWorkflow" Value="Participant_Repository_Par10;Business_Example_Wor2_Act4;527;70;NOROUTING"/>

            <ExtendedAttribute Name="ParticipantVisualOrder" Value="Participant_Repository_Par10;"/>

        </ExtendedAttributes>

    </WorkflowProcess>

</WorkflowProcess>

解释如下:

这个流程只有两个活动:

1<Activity Id="Business_Example_Wor2_Act2" Name="ask customer for partial shipment">

    询问用户时候需要分装运输

2<Activity Id="Business_Example_Wor2_Act4" Name="notify sales">

        告诉客户销售

 

两个活动的转移:

     <Transition From="Business_Example_Wor2_Act2" Id="Business_Example_Wor2_Tra23" Name="Transition" To="Business_Example_Wor2_Act4">

上面的描述只是一个基本的XPDL的实现,在现实世界里所需要的信息是不充分的。

比如:

1、          当用户A登陆后,需要知道和用户A相关的那些活动已经启动,并提示用户A,操作这个活动。这样在实例化的流程中需要包含参与者的信息。

2、          上面的描述中只是包含了工作流本身的信息,很显然,工作流任务执行的具体最后要落实在业务过程上,那么在实例化后的工作流中应该包含业务的数据,最少应该包含能够找到这个业务的连接数据。

3、          工作流具体的状态业务状态在实例化的流程中应该保存起来。

 

   从上面的对比中可以看出,工作流引擎对如何实例化工作信息和业务信息应该是不同的,因为这并不是WMFC规范中的内容。

 

待续

田春峰

accesine@163.com

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JCJC错别字检测-田春峰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值