/** * Create an instance of {@link Database } * */ public Database createDatabase() { return new Database(); }
public Database withCatalogs(Catalog... values) { if (values!= null) { for (Catalog value: values) { getCatalogs().add(value); } } return this; }
public Database withCustomTypes(Collection<CustomType> values) { if (values!= null) { getCustomTypes().addAll(values); } return this; }
org.jooq.meta.jaxb.Database d = defaultIfNull(g.getDatabase(), new org.jooq.meta.jaxb.Database()); String databaseName = trim(d.getName()); Class<? extends Database> databaseClass = !isBlank(databaseName) ? (Class<? extends Database>) loadClass(databaseName) : databaseClass(j); database = databaseClass.newInstance(); database.setProperties(properties(d.getProperties())); List<Catalog> catalogs = d.getCatalogs(); List<Schema> schemata = d.getSchemata(); catalog.setInputCatalog(trim(d.getInputCatalog())); catalog.setOutputCatalog(trim(d.getOutputCatalog())); catalog.setOutputCatalogToDefault(d.isOutputCatalogToDefault()); catalogs.add(catalog); schema.setInputSchema(trim(d.getInputSchema())); schema.setOutputSchema(trim(d.getOutputSchema())); schema.setOutputSchemaToDefault(d.isOutputSchemaToDefault()); catalog.getSchemata().add(schema); if (!StringUtils.isBlank(d.getInputSchema())) log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/inputSchema and /configuration/generator/database/schemata"); if (!StringUtils.isBlank(d.getOutputSchema())) log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/outputSchema and /configuration/generator/database/schemata"); if (!StringUtils.isBlank(d.getInputCatalog())) log.warn("WARNING: Cannot combine configuration properties /configuration/generator/database/inputCatalog and /configuration/generator/database/catalogs");
public static void codegen() throws Exception { List<ForcedType> forcedTypes = JooqConfig.defaultForcedTypes(); HikariDataSource ds = CMSConnectionPools.processing(); Configuration configuration = new Configuration() .withJdbc(new Jdbc() .withDriver(Driver.class.getName()) .withUrl(ds.getJdbcUrl()) .withUser(ds.getUsername()) .withPassword(ds.getPassword())) .withGenerator(new Generator() .withDatabase(new Database() .withName(MySQLDatabase.class.getName()) .withIncludes(".*") .withExcludes("") .withIncludeExcludeColumns(true) .withForcedTypes(forcedTypes) .withInputSchema("sj_cms")) .withGenerate(new Generate() .withJavaTimeTypes(true)) .withStrategy(new Strategy() .withName(CustomGeneratorStrategy.class.getName())) .withTarget(new Target() .withPackageName("com.stubbornjava.cms.server.generated") .withDirectory("src/generated/java"))); GenerationTool.generate(configuration); }
public Database withEnumTypes(Collection<EnumType> values) { if (values!= null) { getEnumTypes().addAll(values); } return this; }
public Database withSchemata(Collection<Schema> values) { if (values!= null) { getSchemata().addAll(values); } return this; }
public Database withForcedTypes(ForcedType... values) { if (values!= null) { for (ForcedType value: values) { getForcedTypes().add(value); } } return this; }
public Database withRegexFlags(Collection<RegexFlag> values) { if (values!= null) { getRegexFlags().addAll(values); } return this; }
public Database withProperties(Property... values) { if (values!= null) { for (Property value: values) { getProperties().add(value); } } return this; }
if (!database.equals(other.database)) { return false;
public Database withEnumTypes(EnumType... values) { if (values!= null) { for (EnumType value: values) { getEnumTypes().add(value); } } return this; }
public Database withSchemata(Schema... values) { if (values!= null) { for (Schema value: values) { getSchemata().add(value); } } return this; }
public Database withForcedTypes(Collection<ForcedType> values) { if (values!= null) { getForcedTypes().addAll(values); } return this; }
public Database withRegexFlags(RegexFlag... values) { if (values!= null) { for (RegexFlag value: values) { getRegexFlags().add(value); } } return this; }
public Database withProperties(Collection<Property> values) { if (values!= null) { getProperties().addAll(values); } return this; }
public Database withCatalogs(Collection<Catalog> values) { if (values!= null) { getCatalogs().addAll(values); } return this; }
public Database withCustomTypes(CustomType... values) { if (values!= null) { for (CustomType value: values) { getCustomTypes().add(value); } } return this; }