*/
public void rollbackToActivityFroRecentManual(final long currentActInstID) {
final ActivityInst activityInst = this.actInstRep.findActivityInst(currentActInstID);
//判断环节是否处于运行状态,才可执行回退
if(StarFlowState.ACT_INST_RUNING != activityInst.getCurrentState())
throw new ProcessEngineException("当前环节(activityInstId="+activityInst.getActivityInstId()+")不处于运行状态,"+
"不能执行回退。");
final ProcessInstance processInstance = this.procInstRep.findProcessInstance(activityInst.getProcessInstId());
List<TransCtrl> trans = this.actInstRep.findTransCtrls(activityInst.getProcessInstId());
String recentActDefId = null;
String destActId = activityInst.getActivityDefId();
for(TransCtrl transCtrl : trans) {
if(transCtrl.getDestActDefId().equalsIgnoreCase(destActId) //如果不是人工环节,继续向前循环
&& !Constants.ACT_TYPE_MANUL.equalsIgnoreCase(transCtrl.getSrcActType())) {
destActId = transCtrl.getSrcActDefId();
} else if(transCtrl.getDestActDefId().equalsIgnoreCase(destActId)
&& Constants.ACT_TYPE_MANUL.equalsIgnoreCase(transCtrl.getSrcActType())) {
recentActDefId = transCtrl.getSrcActDefId();
break;
}
}
if(recentActDefId == null)
throw new ProcessEngineException("最近一个人工环节没有找到,无法回退");
rollBackExecute(currentActInstID, activityInst, processInstance,
recentActDefId);
}