<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.6//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
<workflow>
<initial-actions>
<action id="100" name="启动请假申请工作流">
<pre-functions>
<!-- OSWorkflow提供了一些内置的常用函数。其中一个称为“Caller”,
这个函数会获得当前调用工作流的用户,并把它放入一个名为“caller”的字符型变量中。 -->
<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="请假申请">
<actions>
<action id="1" name="提交需求申请">
<restrict-to>
<conditions type="AND">
<condition type="class">
<arg name="class.name">
com.opensymphony.workflow.util.OSUserGroupCondition
</arg>
<!-- 属于employee组才能执行,那么是怎么判断申请人是employee组的呢! -->
<arg name="group">employee</arg>
</condition>
</conditions>
</restrict-to>
<pre-functions>
<function type="class">
<arg name="class.name">
<!-- 这是一个函数,也是一个类! 考虑到应该会执行类里的execute方法 -->
com.qiny.leave.ApplyFunction
</arg>
</function>
</pre-functions>
<results>
<!-- 满足条件的处理 ,请假天数大于3 才执行,否则到人事部经理-->
<result old-status="Finished" status="Underway"
step="2" owner="manager1">
<conditions type="AND">
<condition type="beanshell">
<arg name="script">
<!-- 进行了天数的判断,必须大于3天吗 -->
propertySet.getInt("dayCount")>3
</arg>
</condition>
</conditions>
<post-functions>
<function type="beanshell">
<arg name="script">
System.out.println("步骤 1 提交需求申请满足条件结果 需部门经理审批...");
</arg>
</function>
</post-functions>
</result>
<unconditional-result old-status="Finished"
status="Underway" step="3" owner="hr1" />
</results>
</action>
</actions>
</step>
<step id="2" name="请假申请审核">
<actions>
<action id="2" name="部门主管审批请假申请">
<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.OSUserGroupCondition
</arg>
<arg name="group">manager</arg>
</condition>
</conditions>
</restrict-to>
<pre-functions>
<function type="class">
<arg name="class.name">
com.qiny.leave.ApproveFunction
</arg>
</function>
</pre-functions>
<results>
<result old-status="Finished" status="Underway"
step="5">
<conditions type="AND">
<condition type="beanshell">
<arg name="script">
propertySet.getInt("opinion")==2
</arg>
</condition>
</conditions>
<post-functions>
<function type="beanshell">
<arg name="script">
System.out.println("步骤 2 请假申请审核部门经理审批没有通过 ...");
</arg>
</function>
</post-functions>
</result>
<unconditional-result old-status="Finished"
status="Underway" step="3" owner="hr1" />
</results>
</action>
</actions>
</step>
<step id="3" name="请假申请审核">
<actions>
<action id="3" name="人力资源主管审批请假申请">
<pre-functions>
<function type="class">
<arg name="class.name">
com.qiny.leave.ApproveFunction
</arg>
</function>
</pre-functions>
<results>
<result old-status="Finished" status="Underway"
step="5">
<conditions type="AND">
<condition type="beanshell">
<arg name="script">
propertySet.getInt("opinion")==2
</arg>
</condition>
</conditions>
</result>
<unconditional-result old-status="Finished"
status="Underway" step="5" />
</results>
</action>
</actions>
</step>
<step id="4" name="请假申请结果通知">
<actions>
<action id="4" auto="true" name="请假申请获准邮件通知">
<pre-functions>
<function type="beanshell">
<arg name="script">
System.out.println("步骤 4 自动动作 请假申请获准邮件通知Send mail 祝贺你");
</arg>
</function>
</pre-functions>
<results>
<unconditional-result old-status="Finished"
status="Finished" step="6" />
</results>
</action>
</actions>
</step>
<step id="5" name="请假申请结果通知">
<actions>
<action id="5" auto="true" name="请假申请没能获准邮件通知">
<pre-functions>
<function type="beanshell">
<arg name="script">
System.out.println("步骤 5 自动动作 请假申请未获准邮件通知Send mail ");
</arg>
</function>
</pre-functions>
<results>
<unconditional-result old-status="Finished" status="Finished" step="6" />
</results>
</action>
</actions>
</step>
<step id="6" name="flow over"></step>
</steps>
</workflow>