%@ page import="core.db.DbFunc" %>
<%@ page import="core.db.DbConnB" %>
<%@ page import="ss.db.DbC" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="org.apache.commons.io.FileUtils" %>
<%@ page import="java.nio.charset.StandardCharsets" %>
<%@ page import="core.db.TableRunB" %>
<%@ page import="biz.pwj.ObjXmlMake" %>
<%@ page import="biz.pwj.PwjlbE" %>
<%@ page import="org.dom4j.Document" %>
<%@ page import="ss.xml.XmlU" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="ss.bpm.BpmC" %>
<%@ page import="org.dom4j.Element" %>
<%@ page
contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
%>
MakeXml
<%
String ipStr = request.getParameter("ip");
if (StringUtils.isBlank(ipStr)) {
out.println("指定IP:ip=10.0.3.107");
return;
}
String pwdStr = request.getParameter("pwd");
if (StringUtils.isBlank(pwdStr)) {
out.println("指定PWD:pwd=???");
return;
}
String bizName = request.getParameter("biz");
if (StringUtils.isBlank(bizName)) {
out.println("指定业务名:biz=ry");
return;
}
String objName = request.getParameter("obj");
if (StringUtils.isBlank(objName)) {
out.println("指定对象名:obj=dw");
return;
}
String objDesc = request.getParameter("desc");
if (StringUtils.isBlank(objDesc)) {
out.println("指定对象名:desc=单位");
return;
}
//
// String cfgType = request.getParameter("type");
// if (StringUtils.isBlank(cfgType)) {
// out.println("指定类型:type=obj");
// return;
// }
String cont;
String xmlFileName;
File xmlFile;
ObjXmlMake objXmlMake = new ObjXmlMake();
PrintWriter writer = response.getWriter();
///// 摘选自 PwjServ.makeObjXml()。Lin
//switch (cfgType) {
// case "obj" -> {
DbConnB info = new DbConnB(ipStr, 1521, "free", "C##DC", pwdStr, DbC.DB_oracleType);
try (DbFunc dbFunc = DbFunc.newDbFunc(info, null)) { // null = RmtConn。Lin
TableRunB tb = dbFunc.rdTableInfo(objName);
cont = objXmlMake.makeObjXml(bizName, objName, tb.desc, tb);
xmlFileName = objName + PwjlbE.objXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
} catch (SQLException | CloneNotSupportedException e) {
throw new RuntimeException(e);
}
// }
// case "serv" -> {
File objXmlFile = new File("D:/temp/" + objName + PwjlbE.objXml.ext);
Document doc = XmlU.rdByFile(objXmlFile, null); // null = XMLErrorHandler。Lin
String lvlStr = doc.getRootElement().element("obj").attributeValue("lvl");
cont = objXmlMake.makeServXml(bizName, objName, objDesc, lvlStr);
xmlFileName = objName + PwjlbE.servXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// }
//}
// case "page" -> {
cont = objXmlMake.makePageXml(bizName, objName, objDesc);
xmlFileName = objName + PwjlbE.pageXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// }
// case "ichk" -> {
cont = objXmlMake.makeIchkXml(bizName, objName);
xmlFileName = objName + PwjlbE.ichkXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// }
// case "cb" -> {
cont = objXmlMake.makeCbXml(bizName, objName, objDesc);
xmlFileName = objName + PwjlbE.cbXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// }
// case "bpm" -> {
/* 改。Lin
cont = objXmlMake.makeBpmXml(wj.getLclbm(), wj.getLcm(), wj.getLcms(),
wj.getYwm(), wj.getDxm(), objDesc);
*/
// 增加。Lin
cont = objXmlMake.makeBpmXml(BpmC.CHG_addType, "zj", "增加", bizName, objName, objDesc);
xmlFileName = objName +"_zj"+ PwjlbE.bpmXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// 变动。Lin
cont = objXmlMake.makeBpmXml(BpmC.CHG_chgType, "bd", "变动", bizName, objName, objDesc);
xmlFileName = objName +"_bd"+ PwjlbE.bpmXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// 停用。Lin
cont = objXmlMake.makeBpmXml(BpmC.CHG_susType, "ty", "停用", bizName, objName, objDesc);
xmlFileName = objName +"_ty"+ PwjlbE.bpmXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// 启用。Lin
cont = objXmlMake.makeBpmXml(BpmC.CHG_resType, "qy", "启用", bizName, objName, objDesc);
xmlFileName = objName +"_qy"+ PwjlbE.bpmXml.ext;
xmlFile = new File("D:/temp/" + xmlFileName);
FileUtils.write(xmlFile, cont, StandardCharsets.UTF_8);
writer.write("生成 "+ xmlFileName +" 成功
");
// }
/////
%>