| | |
| | | import org.yeshi.utils.generater.annotation.admin.DaoQueryCondition; |
| | | import org.yeshi.utils.generater.annotation.admin.Show; |
| | | import org.yeshi.utils.generater.annotation.admin.form.Text; |
| | | import org.yeshi.utils.generater.entity.ClassInfo; |
| | | import org.yeshi.utils.generater.entity.admin.FormVerifyType; |
| | | import org.yeshi.utils.generater.vo.xmlconfig.admin.*; |
| | | import org.yeshi.utils.generater.vo.xmlconfig.admin.form.*; |
| | |
| | | */ |
| | | public class XmlConfigParseUtil { |
| | | |
| | | public static GenertorConfig parse(InputStream inputStream) throws Exception { |
| | | public static GenertorConfig parse(InputStream inputStream, ClassLoader classLoader) throws Exception { |
| | | if (inputStream == null) { |
| | | throw new FileNotFoundException(); |
| | | } |
| | |
| | | } |
| | | Node rootNode = nodelist.item(0); |
| | | String clazz = rootNode.getAttributes().getNamedItem("class").getNodeValue(); |
| | | genertorConfig.setEntity(Class.forName(clazz)); |
| | | genertorConfig.setEntity(classLoader.loadClass(clazz)); |
| | | |
| | | nodelist = rootNode.getChildNodes(); |
| | | for (int i = 0; i < nodelist.getLength(); i++) { |
| | |
| | | genertorConfig.setAdmin(parseAdmin(node)); |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | data.setInterPackage(getNodeAttributeValue(node, "interPackage")); |
| | | data.setImplPackage(getNodeAttributeValue(node, "implPackage")); |
| | | data.setQueryPackage(getNodeAttributeValue(node, "queryPackage")); |
| | | data.setAdminVOPackage(getNodeAttributeValue(node, "adminVOPackage")); |
| | | |
| | | NodeList nodeList = node.getChildNodes(); |
| | | for (int i = 0; i < nodeList.getLength(); i++) { |
| | |
| | | ExceptionData exceptionData = new ExceptionData(); |
| | | exceptionData.setPkg(getNodeAttributeValue(nodeList.item(i), "package")); |
| | | exceptionData.setName(getNodeAttributeValue(nodeList.item(i), "name")); |
| | | String base = getNodeAttributeValue(nodeList.item(i), "base"); |
| | | if (base != null) { |
| | | exceptionData.setBase(new ClassInfo(base.split("\\.")[base.split("\\.").length - 1], base)); |
| | | } |
| | | data.setException(exceptionData); |
| | | break; |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | GenertorConfig config = XmlConfigParseUtil.parse(new FileInputStream("D:\\workspace\\server\\utils\\src\\test\\test.xml")); |
| | | GenertorConfig config = XmlConfigParseUtil.parse(new FileInputStream("D:\\workspace\\server\\utils\\src\\test\\test.xml"), null); |
| | | GeneraterManagerV2.getInstance().init("D:\\workspace\\server\\utils\\src\\test\\java", config); |
| | | GeneraterManagerV2.getInstance().createWholeFunction(); |
| | | System.out.println(config); |