com.jfinal.plugin.activerecord.generator.BaseModelGenerator Java Examples
The following examples show how to use
com.jfinal.plugin.activerecord.generator.BaseModelGenerator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JFinalConfigExt.java From jfinal-ext3 with Apache License 2.0 | 5 votes |
/** * DruidPlugin * @param prop : property * @return */ private DruidPlugin getDruidPlugin(String ds) { String url = this.getProperty(String.format("db.%s.url", ds)); url = String.format(URL_TEMPLATE, ds, url); String endsWith = "?characterEncoding=UTF8&zeroDateTimeBehavior=CONVERT_TO_NULL"; if (!url.endsWith(endsWith)) { url += endsWith; } String password = this.getProperty(String.format(PASSWORD_TEMPLATE, ds)); String pkey = this.getProperty(String.format(PASSWORD_PKEY_TEMPLATE, ds)); String user = this.getProperty(String.format(USER_TEMPLATE, ds)); DruidPlugin dp = new DruidPlugin(url, user, password); dp.setPublicKey(pkey); dp.setFilters("config,stat,wall"); dp.setInitialSize(this.getPropertyToInt(String.format(INITSIZE_TEMPLATE, ds))); dp.setMaxActive(this.getPropertyToInt(String.format(MAXSIZE_TEMPLATE, ds))); if (this.geRuned) { dp.start(); BaseModelGenerator baseGe = new BaseModelGenerator(this.getBaseModelPackage(), this.getBaseModelOutDir()); baseGe.setGenerateChainSetter(true); baseGe.setTemplate(base_model_template); ModelGenerator modelGe = new ModelGenerator(this.getModelPackage(), this.getBaseModelPackage(), this.getModelOutDir()); modelGe.setGenerateDaoInModel(this.getGeDaoInModel()); modelGe.setTemplate(model_template); Generator ge = new Generator(dp.getDataSource(), baseGe, modelGe); MappingKitGenerator mappingKitGe = new MappingKitGenerator(this.getModelPackage(), this.getModelOutDir()); mappingKitGe.setMappingKitClassName(ds.toUpperCase()+this.getMappingKitClassName()); mappingKitGe.setTemplate(mapping_kit_template); ge.setMappingKitGenerator(mappingKitGe); ge.setGenerateDataDictionary(this.getGeDictionary()); ge.generate(); } return dp; }