Action指明的是当前状态要执行的一些额外的操作,如记录log、发邮件等。
(1)Swimline的delegation要做的就是判别当前Actor的身份。
package kellerdu.jbpm.delegation;
import org.jbpm.delegation.*;
import kellerdu.jbpm.LogsFactory;
import org.apache.commons.logging.Log;
public class BossSwimlane implements AssignmentHandler {
public BossSwimlane() {
}
/**
* 当前的状态有哪个actor来具体负责处理,选择是老板的actor来处理。
*
* 如果王林是老板,那么他请假可以用他的名称来开始一个请假流程,当他检查他需要批示的
* 请假时,使用actorId=boss来找出所有的批示。这时selectActor返回的值就是一个常量“boss”
*
*
* @param assignmentContext AssignmentContext
* @return String
* @todo Implement this org.jbpm.delegation.AssignmentHandler method
*/
public String selectActor(AssignmentContext assignmentContext) {
Log log = LogsFactory.getLogInstance(this.getClass());
log.info("任务分配给老板");
return "boss";
}
}
========================================
ackage kellerdu.jbpm.delegation;
import org.jbpm.delegation.*;
import kellerdu.jbpm.LogsFactory;
import org.apache.commons.logging.Log;
public class ChiefSwimlane implements AssignmentHandler {
public ChiefSwimlane() {
}
/**
* selectActor
* @see BossSwimlane
*
* @param assignmentContext AssignmentContext
* @return String
* @todo Implement this org.jbpm.delegation.AssignmentHandler method
*/
public String selectActor(AssignmentContext assignmentContext) {
Log log = LogsFactory.getLogInstance(this.getClass());
log.info("任务分配给上级主管");
return "chief";
}
}