/* (non-Javadoc)
* @see com.starit.wf.engine.domain.service.IActivityInstService#restartActivity(long)
*/
public void restartActivity(long processInstId, long activityInstId) {
ProcessInstance processInstance = procInstRep.findProcessInstance(processInstId);
if(StarFlowState.PROCESS_INST_RUNNING != processInstance.getCurrentState())
throw new ProcessEngineException("流程不处于运行状态,不能重启环节!");
ActivityInst activityInst = actInstRep.findActivityInst(activityInstId);
if(activityInst == null || activityInst.getCurrentState() == StarFlowState.ACT_INST_RUNING
|| activityInst.getCurrentState() == StarFlowState.ACT_INST_WAITING
|| activityInst.getCurrentState() == StarFlowState.ACT_APP_EXCEPTION) {
throw new ProcessEngineException("环节只有处在完成、终止、应用异常状态,才可以重启环节");
}
// if(!Constants.ACT_TYPE_MANUL.equals(activityInst.getActivityType())) {
// throw new ProcessEngineException("只有人工环节才可以重启环节,当前环节类型为:"+activityInst.getActivityType());
// }
ProcessDefine processDefine = this.procDefRep.findProcessDefine(processInstance.getProcessDefId());
ActivityElement activityXml = processDefine.getProcessObject().getActivitys().get(activityInst.getActivityDefId());
EventUtil.publishActivityRestartEvent(processEngine, processInstance, activityInst, activityXml);
}