Search in sources :

Example 1 with LanguageLocalesService

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);
    }
}
Also used : BundleApplicationsService(de.alpharogroup.db.resource.bundles.service.api.BundleApplicationsService) LanguageLocales(de.alpharogroup.db.resource.bundles.entities.LanguageLocales) LanguagesService(de.alpharogroup.db.resource.bundles.service.api.LanguagesService) BundleApplications(de.alpharogroup.db.resource.bundles.entities.BundleApplications) Languages(de.alpharogroup.db.resource.bundles.entities.Languages) LanguageLocalesService(de.alpharogroup.db.resource.bundles.service.api.LanguageLocalesService)

Aggregations

BundleApplications (de.alpharogroup.db.resource.bundles.entities.BundleApplications)1 LanguageLocales (de.alpharogroup.db.resource.bundles.entities.LanguageLocales)1 Languages (de.alpharogroup.db.resource.bundles.entities.Languages)1 BundleApplicationsService (de.alpharogroup.db.resource.bundles.service.api.BundleApplicationsService)1 LanguageLocalesService (de.alpharogroup.db.resource.bundles.service.api.LanguageLocalesService)1 LanguagesService (de.alpharogroup.db.resource.bundles.service.api.LanguagesService)1