try {
DAOUtil.BUSI().store(processInstance);
// /数据表转移到历史表中
DOService dosPi = DOService
.getService("do_wfi_his_processinstance_insert");
DOService dosNi = DOService
.getService("do_wfi_his_nodeinstance_insert");
DOService dosVi = DOService
.getService("do_wfi_his_varinstance_insert");
DOService dosNid = DOService
.getService("do_wfi_his_ni_dependency_insert");
List<NodeInstance> nis = processInstance.retrieveNodeInstances();
DAOUtil.BUSI().store(processInstance, dosPi);
for (Iterator<NodeInstance> it = nis.iterator(); it.hasNext();) {
NodeInstance ni = (NodeInstance) it.next();
DAOUtil.BUSI().store(ni, dosNi);
List<NIDependency> nidepes = ni.getPostNodeDepes();
for (Iterator<NIDependency> itNi = nidepes.iterator(); itNi
.hasNext();) {
NIDependency niD = itNi.next();
DAOUtil.BUSI().store(niD, dosNid);
}
}
List<VarInstance> piVals = processInstance.retrieveVarInstances();
for (Iterator<VarInstance> it = piVals.iterator(); it.hasNext();) {
VarInstance vi = it.next();
DAOUtil.BUSI().store(vi, dosVi);
}
// ////删除运行时表
DOService deletePI = DOService
.getService("do_wfi_processinstance_delete");
deletePI.invokeUpdate(processInstance.getObjUid());
DOService deleteVars = DOService
.getService("do_wfi_varinstance_deletebypiuid");
deleteVars.invokeUpdate(processInstance.getObjUid());
DOService deleteNIs = DOService
.getService("do_wfi_nodeinstance_deletebypiuid");
deleteNIs.invokeUpdate(processInstance.getObjUid());
DOService deleteNIRels = DOService
.getService("do_wfi_ni_dependency_deleterubbish");
deleteNIRels.invokeUpdate();
} catch (Exception ex1) {
ts.rollback();
ex1.printStackTrace();
throw new WFException("流程结束,保存结束状态出错::" + ex1.toString(), ex1);