try {
// /删除选中模板的节点
if (curPt != null) {
DOService deleService = DOService
.getService("do_pt_node_deletebyptuid");
deleService.invokeUpdate(curPt.getUid());
////删除关联
DOService deleRelations = DOService
.getService("do_pt_node_denpendency_deleterubbish");
deleRelations.invokeUpdate();
}else{
this.setEchoValue(I18n.instance().get("当前Session丢失,请重新登录!"));
return NO_FORWARD;
}
String ptXml = DOGlobals.getInstance().getSessoinContext()
.getFormInstance().getValue("ptXml");
System.out.println("PT_XML::" + ptXml);
DOService insertNodeService = DOService.getService("do_pt_node_insert");
DOService getNodeByUid = DOService.getService("do_pt_node_browse");
DOService insertNodeDService = DOService
.getService("do_pt_node_denpendency_insert");
DOService getNodeDByUid = DOService.getService("do_pt_node_denpendency_browse");
StringReader read = new StringReader(ptXml);
// 创建新的输入源SAX 解析器将使用 InputSource 对象来确定如何读取 XML 输入
InputSource source = new InputSource(read);
Document doc = DOMXmlUtil.getInstance().getDocumentBuilder().parse(
source);
NodeList nList = doc.getElementsByTagName("node");
for (int i = 0; i < nList.getLength(); i++) {
Node node = nList.item(i);
if (node.getNodeType() == Document.ELEMENT_NODE) {
Element e = (Element) node;
PTNode ptNode = new PTNode();
List existNodes = getNodeByUid.invokeSelect(e.getAttribute("id"));
if(existNodes!=null && existNodes.size() > 0){
continue;
}
ptNode.setObjUid(e.getAttribute("id"));
ptNode.setNodeName(e.getAttribute("nodeName"));
ptNode.setAccessClass(e.getAttribute("accessClass"));
if (e.getAttribute("authType") != null
&& !e.getAttribute("authType").trim().equals("")) {
ptNode.setAuthType(Integer.parseInt(e
.getAttribute("authType")));
}
String autoService = e.getAttribute("autoService");
if(autoService!=null && !autoService.trim().equals("")){
DOService aService = DOService.getService(autoService);
if(aService!=null){
ptNode.setAutoExcutesService(aService);
}
}