private List<String> toJsp(DesignDefination design, File targetProject) throws IOException { List<String> fileList = new ArrayList<String>(); for (String mvcName : design.getMvcs().keySet()) { File mvcDir = new File( targetProject, "designFiles/mvcs/" + design.getProjectName() + "/" + design.getMvc(mvcName).getDirectoryName()); FileUtil.mkdir(mvcDir); fileList.addAll(generateJsps(design.getMvc(mvcName), mvcDir)); } return fileList; }
private List<String> toMvc(DesignDefination design, File targetProject) throws IOException { List<String> fileList = new ArrayList<String>(); for (String mvcName : design.getMvcs().keySet()) { File mvcDir = new File( targetProject, "designFiles/mvcs/" + design.getProjectName() + "/" + design.getMvc(mvcName).getDirectoryName()); FileUtil.mkdir(mvcDir); File mvcFile = new File(mvcDir, append(mvcName, ".mvc")); if (mvcFile.exists()) { log(mvcFile, true); } else { writeToFile(design.getMvc(mvcName).toXml(), mvcFile); fileList.add(log(mvcFile)); } } return fileList; }
private List<String> toBiz(DesignDefination design, File targetProject) throws IOException { List<String> fileList = new ArrayList<String>(); for (String bizName : design.getBizs().keySet()) { File bizDir = new File( targetProject, "designFiles/bizs/" + design.getProjectName() + "/" + design.getBiz(bizName).getDirectoryName()); FileUtil.mkdir(bizDir); File bizFile = new File(bizDir, append(bizName, ".biz")); if (bizFile.exists()) { log(bizFile, true); continue; } writeToFile(design.getBiz(bizName).toXml(), bizFile); fileList.add(log(bizFile)); log(bizFile); } return fileList; }
protected void writeToFile(String content, File toFile) throws IOException { FileUtil.writeString2File(content, toFile, CHARSET); }