use of de.alpharogroup.db.resource.bundles.service.api.LanguageLocalesService in project bundle-app-ui by astrapi69.
the class SpringApplicationContext method initDb.
protected void initDb(final ApplicationContext ac) {
final LanguagesService languagesService = (LanguagesService) ac.getBean("languagesService");
final LanguageLocalesService languageLocalesService = (LanguageLocalesService) ac.getBean("languageLocalesService");
final BundleApplicationsService bundleApplicationsService = getBundleApplicationsService();
final List<Languages> languages = DataObjectFactory.newLanguages();
for (final Languages language : languages) {
final Languages found = languagesService.find(language.getName(), language.getIso639Dash1());
if (found == null) {
languagesService.merge(language);
}
}
final List<LanguageLocales> languageLocales = DataObjectFactory.newLanguageLocales();
for (final LanguageLocales languageLocale : languageLocales) {
final LanguageLocales found = languageLocalesService.find(languageLocale.getLocale());
if (found == null) {
languageLocalesService.merge(languageLocale);
}
}
BundleApplications baseBundleApplication = bundleApplicationsService.find(BundleApplications.BASE_BUNDLE_APPLICATION);
if (baseBundleApplication == null) {
baseBundleApplication = BundleApplications.builder().name(BundleApplications.BASE_BUNDLE_APPLICATION).build();
baseBundleApplication = bundleApplicationsService.merge(baseBundleApplication);
}
}
Aggregations