			
		boolean createNew = true;
		for (DBDefinitionGenerator dbd:dbDefinitionGenerators){
			sql.append(dbd.generateDBSql(createNew)).append("\n");
			if (createNew) createNew = false;
       }
		
		String fPath = this.getProjectFolderPath()+"sql/"+this.dbName+".sql";
		writeToFile(fPath,sql.toString());
		
		if (this.getSgsSource()!= null &&!this.getSgsSource().equals("")){
			String myfPath = this.getProjectFolderPath()+"sgs/"+this.getStandardName()+"_original.sgs";
			writeToFile(myfPath,this.getSgsSource());
		}
		
        for (ConfigFile cf : this.configFiles){
        	if (cf.isTopLevel()){
        		String myfPath0 = this.getProjectFolderPath()+cf.getStandardName();
        		writeToFile(myfPath0, cf.generateConfigFileString());
        	}else if (cf.isSettingParamFile()){
        		String myfPath1 = this.getProjectFolderPath()+".settings/"+cf.getStandardName();
        		writeToFile(myfPath1, cf.generateConfigFileString());
        	}else if (cf.isPutInsideSrcAndClasses == false){
	        	String myfPath2 = this.getProjectFolderPath()+"WebContent/WEB-INF/"+cf.getStandardName();
	    		writeToFile(myfPath2, cf.generateConfigFileString());
        	} else {
        		String myfPath3 = this.getProjectFolderPath()+"src/"+cf.getStandardName();
        		writeToFile(myfPath3, cf.generateConfigFileString());
	    		
	    		String myfPath4 = this.getProjectFolderPath()+"WebContent/WEB-INF/classes/"+cf.getStandardName();
	    		writeToFile(myfPath4, cf.generateConfigFileString());
        	}
        }
	} catch (Exception e){
		e.printStackTrace();
		throw new ValidateException("源码生成错误");
	}
	}
		
	public void writeToFile(String filePath, String content) throws Exception{
		File f = new File(filePath);
		if (!f.getParentFile().exists()) {
			f.getParentFile().mkdirs();
		}
		f.createNewFile();
		try (Writer fw = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(f.getAbsolutePath()),"UTF-8"))){			
	        fw.write(content,0,content.length());
		}
	}
	
	public String getSourceFolderPath() {
		return sourceFolderPath;
	}

	public void setSourceFolderPath(String sourceFolderPath) {
		this.sourceFolderPath = sourceFolderPath;
	}

	public void generateProjectZip() throws ValidateException{
		delAllFile(this.folderPath+this.standardName+".zip");
		delFolder(this.getProjectFolderPath());
		File f = new File(this.getProjectFolderPath());
		if (!f.getParentFile().exists()) {
			f.getParentFile().mkdirs();
		}
				
		generateProjectFiles();
		ZipCompressor compressor = new ZipCompressor(this.folderPath+this.standardName+".zip");
		compressor.compressExe(this.getProjectFolderPath());
		delFolder(this.getProjectFolderPath());
	}
	
	public String getFolderPath() {
		return this.folderPath;
	}
	
	public String getProjectFolderPath(){
		if ( this.getStandardName()!= null &&!"".equals(this.getStandardName())){
			return folderPath + this.getStandardName() + "/";
		}
		else return folderPath;
	}
	public void setFolderPath(String folderPath) {
		this.folderPath = folderPath;
	}
	
	public static String packagetokenToFolder(String packageToken){
		String folder = "";
		if (packageToken!= null)
			 folder = packageToken.replace('.','/');
		folder += "/";
		return folder;
	}
	
	public static String folderToPackageToken(String folder){
		String packagetoken = folder.replace('/', '.');
		if (packagetoken.charAt(packagetoken.length()-1) == '.')
			packagetoken = packagetoken.substring(0, packagetoken.length() -1);
		return packagetoken;
	}
	public List<DBDefinitionGenerator> getDbDefinitionGenerators() {
		return dbDefinitionGenerators;
	}
	public void setDbDefinitionGenerators(
			List<DBDefinitionGenerator> dbDefinitionGenerators) {
		this.dbDefinitionGenerators = dbDefinitionGenerators;
	}
	
	public void addDBDefinitionGenerator(DBDefinitionGenerator generator){
		this.dbDefinitionGenerators.add(generator);
	}
	public String getDbName() {
		return dbName;
	}
	
	public void setDbName(String dbName) {
		this.dbName = dbName;
		if (this.technicalstack==null || "".equals(this.technicalstack) || this.technicalstack.equals("jsp") || this.technicalstack.equalsIgnoreCase("simplejee")) ((DbconfigXml)this.utils.get(4)).setDbName(dbName);
	}	
	
	public TestSuite getProjectTestSuite() {
		return projectTestSuite;
	}
	public void setProjectTestSuite(TestSuite projectTestSuite) {
		this.projectTestSuite = projectTestSuite;
	}
	
	public void addTestSuite(TestSuite testSuite){
		this.projectTestSuite.testSuites.add(testSuite);
	}
	
	public void addTestCase(TestCase testCase){
		this.projectTestSuite.testCases.add(testCase);
	}
	
	public void addTestCases(List<TestCase> testCases){
		this.projectTestSuite.testCases.addAll(testCases);
	}
	public List<ConfigFile> getConfigFiles() {
		return configFiles;
	}
	public void setConfigFiles(List<ConfigFile> configFiles) {
		this.configFiles = configFiles;
	}
	
	public void addConfigFile(ConfigFile configFile){
		this.configFiles.add(configFile);
	}
	
	public void addConfigFiles(List<ConfigFile> configFiles){
		this.configFiles.addAll(configFiles);
	}
	
	public static void zipFile(File inFile, ZipOutputStream zos, String dir) throws IOException {
		if (inFile.isDirectory()) {
			File[] files = inFile.listFiles();
			for (File file:files)
				zipFile(file, zos, dir + "/" + inFile.getName());
		} else {
			String entryName = null;
			if (!"".equals(dir))
				entryName = dir + "/" + inFile.getName();
			else
				entryName = inFile.getName();
			ZipEntry entry = new ZipEntry(entryName);
			zos.putNextEntry(entry);
			InputStream is = new FileInputStream(inFile);
			int len = 0;
			while ((len = is.read())!= -1)
				zos.write(len);
			is.close();
		}
	}

	public static void delFolder(String folderPath) {
		try {
			delAllFile(folderPath); // 删除完里面所有内容
			String filePath = folderPath;
			filePath = filePath.toString();
			java.io.File myFilePath = new java.io.File(filePath);
			myFilePath.delete(); // 删除空文件夹
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static boolean delAllFile(String path) {
		boolean flag = false;
		File file = new File(path);
		if (!file.exists()) {
			return flag;
		}
		if (!file.isDirectory()) {
			return flag;
		}
		String[] tempList = file.list();
		File temp = null;
		for (int i = 0; i < tempList.length; i++) {
			if (path.endsWith(File.separator)) {
				temp = new File(path + tempList[i]);
			} else