use of org.jboss.pnc.common.json.moduleconfig.DemoDataConfig in project pnc by project-ncl.
the class DemoDataInitializer method initialize.
@PostConstruct
public void initialize() {
DemoDataConfig demoDataConfig = null;
try {
demoDataConfig = configuration.getModuleConfig(new PncConfigProvider<>(DemoDataConfig.class));
} catch (ConfigurationParseException e) {
logger.warn("Cannot read demo data config.", e);
}
if (demoDataConfig == null || !demoDataConfig.getImportDemoData()) {
logger.info("Demo data import is not enabled.");
return;
}
long numberOfProjectInDB = projectRepository.count();
if (numberOfProjectInDB != 0) {
logger.info("There are >0 ({}) projects in DB. Skipping initialization." + numberOfProjectInDB);
} else {
logger.info("Initializing DEMO data");
dbDataInitializer.initiliazeProjectProductData();
dbDataInitializer.initiliazeBuildRecordDemoData();
dbDataInitializer.verifyData();
logger.info("Finished initializing DEMO data");
}
}
Aggregations