sample

xml配置

 

 <start-state name="request" swimlane="requester">
    <transition to="BeginRequest"/>
 </start-state>

 

 <fork name="BeginRequest">
    <transition to="RequesterCancel"/>
    <transition to="IsChief"/>
 </fork>

 

 <decision name="IsChief">
    <delegation class="kellerdu.jbpm.delegation.ChiefDecision"/>
    <transition name="BossApprove"  to="BossApprove"/>
    <transition name="ChiefApprove"  to="ChiefApprove"/>
 </decision>

 

<state name="ChiefApprove">
    <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>

 

 <join name="Decided">
    <description>有一个先到达即进行父Token</description>
    <delegation class="kellerdu.jbpm.delegation.DecidedJoin"/>
    <transition to="DoSomething"/>
 </join>

 

 

代码示例

DecisionHandler

public String decide(ExecutionContext executionContext) {
        if(ac!=null&&(ac.equals("dali")||ac.equals("wang"))){
            return "BossApprove";
        }else{
            return "ChiefApprove";
        }
    }

 

JoinHandler

public void join(JoinContext joinContext) throws ExecutionException {
        Token arrivingToken = joinContext.getToken();
         if(to.getId().equals(arrivingToken.getId())){
                joinContext.getExecutionService().cancelToken(to.getId());
            }
        }
          joinContext.reactivateToken( arrivingToken.getParent() );
    }

 

AssignmentHandler

public String selectActor(AssignmentContext assignmentContext) {
       return "chief";
    }

 

你可能感兴趣的:(xml,jbpm)