@Test public void genRepositories() { }
public void genRepositories() { if (!generatorConfig.isGenRepository()) { return; } String repositoriesPackage = this.generatorConfig.getRepositoryPackage(); String entitiesPackage = this.generatorConfig.getEntityPackage(); boolean coverIfExist = this.generatorConfig.isCoverRepositoryIfExists(); String queryPackage = repositoriesPackage.concat(".query"); String repositoryPackage = repositoriesPackage.concat(".repo"); Map<String, Object> params = new HashMap<>(); params.put("entitiesPackage", entitiesPackage); params.put("repositoriesPackage", repositoriesPackage); params.put("queryPackage", queryPackage); params.put("repositoryPackage", repositoryPackage); String render = generatorTemplate.render("/baseQuery.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseQuery"), render, coverIfExist); render = generatorTemplate.render("/baseRepository.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseRepository"), render, coverIfExist); for (TableDefinition tableDefinition : generatorMeta.getTableDefinitions()) { final String entity = tableDefinition.getClassName(); params.put("class", entity); params.put("columns", tableDefinition.getColumns()); render = generatorTemplate.render("/query.txt", params); outputFile(getFilePath(queryPackage, entity + "Query"), render, coverIfExist); render = generatorTemplate.render("/repository.txt", params); outputFile(getFilePath(repositoryPackage, entity + "Repository"), render, coverIfExist); } }
CodeGenerator { public void genRepositories() { if (!generatorConfig.isGenRepository()) { return; } String repositoriesPackage = this.generatorConfig.getRepositoryPackage(); String entitiesPackage = this.generatorConfig.getEntityPackage(); boolean coverIfExist = this.generatorConfig.isCoverRepositoryIfExists(); String queryPackage = repositoriesPackage.concat(".query"); String repositoryPackage = repositoriesPackage.concat(".repo"); Map<String, Object> params = new HashMap<>(); params.put("entitiesPackage", entitiesPackage); params.put("repositoriesPackage", repositoriesPackage); params.put("queryPackage", queryPackage); params.put("repositoryPackage", repositoryPackage); String render = generatorTemplate.render("/baseQuery.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseQuery"), render, coverIfExist); render = generatorTemplate.render("/baseRepository.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseRepository"), render, coverIfExist); for (TableDefinition tableDefinition : generatorMeta.getTableDefinitions()) { final String entity = tableDefinition.getClassName(); params.put("class", entity); params.put("columns", tableDefinition.getColumns()); render = generatorTemplate.render("/query.txt", params); outputFile(getFilePath(queryPackage, entity + "Query"), render, coverIfExist); render = generatorTemplate.render("/repository.txt", params); outputFile(getFilePath(repositoryPackage, entity + "Repository"), render, coverIfExist); } } }
CodeGenerator { public void genRepositories() { if (!generatorConfig.isGenRepository()) { return; } String repositoriesPackage = this.generatorConfig.getRepositoryPackage(); String entitiesPackage = this.generatorConfig.getEntityPackage(); boolean coverIfExist = this.generatorConfig.isCoverRepositoryIfExists(); String queryPackage = repositoriesPackage.concat(".query"); String repositoryPackage = repositoriesPackage.concat(".repo"); Map<String, Object> params = new HashMap<>(); params.put("entitiesPackage", entitiesPackage); params.put("repositoriesPackage", repositoriesPackage); params.put("queryPackage", queryPackage); params.put("repositoryPackage", repositoryPackage); String render = generatorTemplate.render("/baseQuery.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseQuery"), render, coverIfExist); render = generatorTemplate.render("/baseRepository.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseRepository"), render, coverIfExist); for (TableDefinition tableDefinition : generatorMeta.getTableDefinitions()) { final String entity = tableDefinition.getClassName(); params.put("class", entity); params.put("columns", tableDefinition.getColumns()); render = generatorTemplate.render("/query.txt", params); outputFile(getFilePath(queryPackage, entity + "Query"), render, coverIfExist); render = generatorTemplate.render("/repository.txt", params); outputFile(getFilePath(repositoryPackage, entity + "Repository"), render, coverIfExist); } } CodeGenerator(GeneratorConfig generatorConfig); }
CodeGenerator { public void genRepositories() { if (!generatorConfig.isGenRepository()) { return; } String repositoriesPackage = this.generatorConfig.getRepositoryPackage(); String entitiesPackage = this.generatorConfig.getEntityPackage(); boolean coverIfExist = this.generatorConfig.isCoverRepositoryIfExists(); String queryPackage = repositoriesPackage.concat(".query"); String repositoryPackage = repositoriesPackage.concat(".repo"); Map<String, Object> params = new HashMap<>(); params.put("entitiesPackage", entitiesPackage); params.put("repositoriesPackage", repositoriesPackage); params.put("queryPackage", queryPackage); params.put("repositoryPackage", repositoryPackage); String render = generatorTemplate.render("/baseQuery.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseQuery"), render, coverIfExist); render = generatorTemplate.render("/baseRepository.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseRepository"), render, coverIfExist); for (TableDefinition tableDefinition : generatorMeta.getTableDefinitions()) { final String entity = tableDefinition.getClassName(); params.put("class", entity); params.put("columns", tableDefinition.getColumns()); render = generatorTemplate.render("/query.txt", params); outputFile(getFilePath(queryPackage, entity + "Query"), render, coverIfExist); render = generatorTemplate.render("/repository.txt", params); outputFile(getFilePath(repositoryPackage, entity + "Repository"), render, coverIfExist); } } CodeGenerator(GeneratorConfig generatorConfig); GeneratorConfig getGeneratorConfig(); void setGeneratorConfig(GeneratorConfig generatorConfig); GeneratorTemplate getGeneratorTemplate(); void setGeneratorTemplate(GeneratorTemplate generatorTemplate); GeneratorMeta getGeneratorMeta(); void setGeneratorMeta(GeneratorMeta generatorMeta); void genEntities(); void genRepositories(); }
CodeGenerator { public void genRepositories() { if (!generatorConfig.isGenRepository()) { return; } String repositoriesPackage = this.generatorConfig.getRepositoryPackage(); String entitiesPackage = this.generatorConfig.getEntityPackage(); boolean coverIfExist = this.generatorConfig.isCoverRepositoryIfExists(); String queryPackage = repositoriesPackage.concat(".query"); String repositoryPackage = repositoriesPackage.concat(".repo"); Map<String, Object> params = new HashMap<>(); params.put("entitiesPackage", entitiesPackage); params.put("repositoriesPackage", repositoriesPackage); params.put("queryPackage", queryPackage); params.put("repositoryPackage", repositoryPackage); String render = generatorTemplate.render("/baseQuery.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseQuery"), render, coverIfExist); render = generatorTemplate.render("/baseRepository.txt", params); outputFile(getFilePath(repositoriesPackage, "BaseRepository"), render, coverIfExist); for (TableDefinition tableDefinition : generatorMeta.getTableDefinitions()) { final String entity = tableDefinition.getClassName(); params.put("class", entity); params.put("columns", tableDefinition.getColumns()); render = generatorTemplate.render("/query.txt", params); outputFile(getFilePath(queryPackage, entity + "Query"), render, coverIfExist); render = generatorTemplate.render("/repository.txt", params); outputFile(getFilePath(repositoryPackage, entity + "Repository"), render, coverIfExist); } } CodeGenerator(GeneratorConfig generatorConfig); GeneratorConfig getGeneratorConfig(); void setGeneratorConfig(GeneratorConfig generatorConfig); GeneratorTemplate getGeneratorTemplate(); void setGeneratorTemplate(GeneratorTemplate generatorTemplate); GeneratorMeta getGeneratorMeta(); void setGeneratorMeta(GeneratorMeta generatorMeta); void genEntities(); void genRepositories();  }