作者:
nogocn
在某一公司中,部门员工要休假的话需要部门主管的批准。如果休假天数大于10天的话,在部门主管的同意后,还必须上级主管批准。如果是部门主管要休假只要上级主管批准即可。在休假被批准之前,申请人可以撤销休假申请。
每个员工还有多少天休假必须管理起来,在员工提交休假申请时要检查申请天数是否超过可用天数。申请批准后,要在可用天数里减去申请天数。每次休假申请结束之后,不管通过未通过或是否取消,都必须记录下来。主管在批复申请之后,系统要将批复结果Email给申请人。对于大于10天的申请,如果部门主管已批准同意而上级主管还未批准,这时申请人撤销申请后,系统应发Email通知部门主管申请已撤销。
processdefinition.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Keller (zju) -->
<!DOCTYPE process-definition PUBLIC
"-//jBpm/jBpm Mapping DTD 2.0//EN"
"http://jbpm.org/dtd/processdefinition-2.0.dtd">
<process-definition name="RequestLeave">
<swimlane name="requester">
<description>申请者</description>
</swimlane>
<swimlane name="chief">
<description>部门主管</description>
<delegation class="kellerdu.jbpm.delegation.ChiefSwimlane"/>
</swimlane>
<swimlane name="boss">
<description>上级主管</description>
<delegation class="kellerdu.jbpm.delegation.BossSwimlane"/>
</swimlane>
<start-state name="request" swimlane="requester">
<transition to="Begin Request"/>
</start-state>
<fork name="Begin Request">
<transition to="Requester Cancel"/>
<transition to="IsChief"/>
</fork>
<decision name="IsChief">
<delegation class="kellerdu.jbpm.delegation.ChiefDecision"/>
<transition name="Boss Approve" to="Boss Approve"/>
<transition name="Chief Approve" to="Chief Approve"/>
</decision>
<state name="Requester Cancel">
<assignment swimlane="requester"/>
<transition name="cancel" to="Decided">
<action>
<!-- 将请假的状态改变为“取消”-->
<delegation class="kellerdu.jbpm.action.RequestCancel"/>
</action>
</transition>
</state>
<state name="Chief Approve">
<assignment swimlane="chief"/>
<transition name="approve" to="NeedBossApprove">
<action>
<!-- 将请假的状态改变为“主管批准”-->
<delegation class="kellerdu.jbpm.action.ChiefApprove"/>
</action>
</transition>
<transition name="disapprove" to="Decided">
<action>
<!-- 将请假的状态改变为“主管否决”-->
<delegation class="kellerdu.jbpm.action.ChiefDisapprove"/>
</action>
</transition>
</state>
<state name="Boss Approve">
<assignment swimlane="boss"/>
<transition name="approve" to="Decided">
<action>
<!-- 将请假的状态改变为“老板批准”-->
<delegation class="kellerdu.jbpm.action.BossApprove"/>
</action>
</transition>
<transition name="disapprove" to="Decided">
<action>
<!-- 将请假的状态改变为“老板否决”-->
<delegation class="kellerdu.jbpm.action.BossDisapprove"/>
</action>
</transition>
</state>
<decision name="NeedBossApprove">
<!-- 请假天数大于10天的要老板批准 -->
<delegation class="kellerdu.jbpm.delegation.NeedBossApproveDecision"/>
<transition name="need" to="Boss Approve"/>
<transition name="notNeed" to="Decided"/>
</decision>
<join name="Decided">
<description>有一个先到达即进行父Token</description>
<delegation class="kellerdu.jbpm.delegation.DecidedJoin"/>
<transition to="Do Something"/>
</join>
<decision name="Do Something">
<description>
根据请求的状态决定。
(1)“主管或者老板批准”-‘approve’:修改员工休假的总天数,设定发给用户E-Mail的信息。
(2)“主管或者老板否决”-“disapprove”:设定发给用户E-Mail的信息。
(3)“撤销”-"cancel"-设定发给用户E-Mail的信息。如果主管批准,要发给主管消息说明已经撤销。
</description>
<delegation class="kellerdu.jbpm.delegation.DoSomethingDecision"/>
<transition name="disapprove" to="Finished">
<action>
<delegation class="kellerdu.jbpm.action.Disapprove"/>
</action>
</transition>
<transition name="approve" to="Finished">
<action>
<delegation class="kellerdu.jbpm.action.Approve"/>
</action>
</transition>
<transition name="cancel" to="Finished">
<action>
<delegation class="kellerdu.jbpm.action.Cancel"/>
</action>
</transition>
</decision>
<end-state name="Finished"/>
<action event-type="process-end">
<!-- 发送E-Mail消息给申请者,记录请假日志 -->
<delegation class="kellerdu.jbpm.action.ProcessEndAction"/>
</action>
</process-definition>
posted on 2007-09-11 13:47
jbpm 阅读(2415)
评论(0) 编辑 收藏 所属分类:
jbpm实例