Transaction t = copyService.currentTransaction();
try {
t.begin();
DOBO boForm = DOBO.getDOBOByName("do_ui_formmodel");
DOBO boFormTarget = DOBO.getDOBOByName("DO_UI_FormTargets");
DOBO boFormLink = DOBO.getDOBOByName("DO_UI_FormLinks");
for(int i = 0; i < checks.length ; i++){
BOInstance biForm = boForm.getInstance(checks[i]);
DOFormModel aFm = DOFormModel.getFormModelByID(biForm.getUid());
biForm.putValue("objuid", null);
biForm.putValue("gridModelUid", gridModelUid);
BOInstance newBiForm = copyService.invokeUpdate(biForm);
// //保存FormModel
for(Iterator<DOFormTarget> itTargetGrid = aFm.getTargetGridModels().iterator();itTargetGrid.hasNext(); ){
DOFormTarget aFt = itTargetGrid.next();
BOInstance biFt = boFormTarget.getInstance(aFt.getObjUid());
biFt.putValue("objuid", null);
biFt.putValue("formUid", newBiForm.getUid());
boFormTarget.getDInsertService().invokeUpdate(biFt);
}
// //FormModel linkForms
for(Iterator<DOFormModel> itLinkForms = aFm.getLinkForms().iterator(); itLinkForms.hasNext();){
DOFormModel linkForm = itLinkForms.next();
Map<String,String> paras = new HashMap<String,String>();
paras.put("formuid", newBiForm.getUid());
paras.put("linkformuid", linkForm.getObjUid());
boFormLink.getDInsertService().invokeUpdate(paras);
}
}
t.end();