private void processByGeneratorModel(boolean isDelete, Generator g, GeneratorModel m) throws Exception, FileNotFoundException { try { if (isDelete) g.deleteBy(m.templateModel, m.filePathModel); else g.generateBy(m.templateModel, m.filePathModel); } catch (GeneratorException ge) { PrintUtils.printExceptionsSumary( ge.getMessage(), getGenerator().getOutRootDir(), ge.getExceptions()); throw ge; } }
public void processByAllTable(boolean isDelete) throws Exception { List<Table> tables = TableFactory.getInstance().getAllTables(); List exceptions = new ArrayList(); for (int i = 0; i < tables.size(); i++) { try { processByTable(getGenerator(), tables.get(i), isDelete); } catch (GeneratorException ge) { exceptions.addAll(ge.getExceptions()); } } PrintUtils.printExceptionsSumary("", getGenerator().getOutRootDir(), exceptions); if (!exceptions.isEmpty()) { throw new GeneratorException("batch generate by all table occer error", exceptions); } }
public void processByTable(String tableName, boolean isDelete) throws Exception { if ("*".equals(tableName)) { if (isDelete) deleteByAllTable(); else generateByAllTable(); return; } Generator g = getGenerator(); Table table = TableFactory.getInstance().getTable(tableName); try { processByTable(g, table, isDelete); } catch (GeneratorException ge) { PrintUtils.printExceptionsSumary( ge.getMessage(), getGenerator().getOutRootDir(), ge.getExceptions()); throw ge; } }