@Override public Locale retrieveLocale(String orcid) { String locale = profileDao.retrieveLocale(orcid); return Locale.valueOf(locale); }
private Locale getLocaleFromProfile(ProfileEntity profile){ org.orcid.jaxb.model.common_v2.Locale orcidLocale = org.orcid.jaxb.model.common_v2.Locale.valueOf(profile.getLocale()); String value = orcidLocale.value(); Locale locale = null; if(value!= null) { if(value.contains("_")){ String [] localeTokens = value.split("_"); locale = new Locale(localeTokens[0], localeTokens[1]); } else { locale = new Locale(value); } } return locale; }
private Preferences getPreferences(String orcid) { Preferences preferences = new Preferences(); ProfileEntity profile = profileEntityCacheManager.retrieve(orcid); Locale profileEntityLocale = Locale.valueOf(profile.getLocale()); if (profileEntityLocale != null) { preferences.setLocale(profileEntityLocale); } return preferences; }
private Locale getUserLocaleFromProfileEntity(ProfileEntity profile) { String locale = profile.getLocale(); if (locale != null) { org.orcid.jaxb.model.common_v2.Locale loc = org.orcid.jaxb.model.common_v2.Locale.valueOf(locale); return LocaleUtils.toLocale(loc.value()); } return LocaleUtils.toLocale("en"); }
private Locale getUserLocaleFromProfileEntity(ProfileEntity profile) { String locale = profile.getLocale(); if (locale != null) { org.orcid.jaxb.model.common_v2.Locale loc = org.orcid.jaxb.model.common_v2.Locale.valueOf(locale); return LocaleUtils.toLocale(loc.value()); } return LocaleUtils.toLocale("en"); }
private Locale getUserLocale(String localeStr) { if (PojoUtil.isEmpty(localeStr)) { return LocaleUtils.toLocale("en"); } org.orcid.jaxb.model.common_v2.Locale locale = org.orcid.jaxb.model.common_v2.Locale.valueOf(localeStr); if (locale != null) { return LocaleUtils.toLocale(locale.value()); } return LocaleUtils.toLocale("en"); } }
protected Locale getUserLocale(String localeStr) { if(!LOCALIZED) { return Locale.ENGLISH; } if (PojoUtil.isEmpty(localeStr)) { return LocaleUtils.toLocale("en"); } org.orcid.jaxb.model.common_v2.Locale locale = org.orcid.jaxb.model.common_v2.Locale.valueOf(localeStr); if (locale != null) { return LocaleUtils.toLocale(locale.value()); } return LocaleUtils.toLocale("en"); }
org.orcid.jaxb.model.common_v2.Locale locale = org.orcid.jaxb.model.common_v2.Locale.valueOf(managedEntity.getLocale()); userLocale = LocaleUtils.toLocale(locale.value());
@Override public void sendAutoDeprecateNotification(String primaryOrcid, String deprecatedOrcid) { ProfileEntity primaryProfileEntity = profileEntityCacheManager.retrieve(primaryOrcid); ProfileEntity deprecatedProfileEntity = profileEntityCacheManager.retrieve(deprecatedOrcid); ClientDetailsEntity clientDetails = clientDetailsEntityCacheManager.retrieve(SourceEntityUtils.getSourceId(deprecatedProfileEntity.getSource())); Locale userLocale = LocaleUtils .toLocale(primaryProfileEntity.getLocale() == null ? org.orcid.jaxb.model.common_v2.Locale.EN.value() : org.orcid.jaxb.model.common_v2.Locale.valueOf(primaryProfileEntity.getLocale()).value()); // Create map of template params Map<String, Object> templateParams = new HashMap<String, Object>(); String subject = getSubject("email.subject.auto_deprecate", userLocale); String assetsUrl = getAssetsUrl(); Date deprecatedAccountCreationDate = deprecatedProfileEntity.getDateCreated(); // Create map of template params templateParams.put("primaryId", primaryOrcid); templateParams.put("name", deriveEmailFriendlyName(primaryProfileEntity)); templateParams.put("assetsUrl", assetsUrl); templateParams.put("subject", subject); templateParams.put("clientName", clientDetails.getClientName()); templateParams.put("deprecatedAccountCreationDate", deprecatedAccountCreationDate); templateParams.put("deprecatedId", deprecatedOrcid); addMessageParams(templateParams, userLocale); // Generate html from template String html = templateManager.processTemplate("auto_deprecated_account_html.ftl", templateParams); NotificationAdministrative notification = new NotificationAdministrative(); notification.setNotificationType(NotificationType.ADMINISTRATIVE); notification.setSubject(subject); notification.setBodyHtml(html); createNotification(primaryOrcid, notification); }
@Override public void sendAutoDeprecateNotification(String primaryOrcid, String deprecatedOrcid) { ProfileEntity primaryProfileEntity = profileEntityCacheManager.retrieve(primaryOrcid); ProfileEntity deprecatedProfileEntity = profileEntityCacheManager.retrieve(deprecatedOrcid); ClientDetailsEntity clientDetails = clientDetailsEntityCacheManager.retrieve(SourceEntityUtils.getSourceId(deprecatedProfileEntity.getSource())); Locale userLocale = LocaleUtils .toLocale(primaryProfileEntity.getLocale() == null ? org.orcid.jaxb.model.common_v2.Locale.EN.value() : org.orcid.jaxb.model.common_v2.Locale.valueOf(primaryProfileEntity.getLocale()).value()); // Create map of template params Map<String, Object> templateParams = new HashMap<String, Object>(); String subject = getSubject("email.subject.auto_deprecate", userLocale); String assetsUrl = getAssetsUrl(); Date deprecatedAccountCreationDate = deprecatedProfileEntity.getDateCreated(); // Create map of template params templateParams.put("primaryId", primaryOrcid); templateParams.put("name", deriveEmailFriendlyName(primaryProfileEntity)); templateParams.put("assetsUrl", assetsUrl); templateParams.put("subject", subject); templateParams.put("clientName", clientDetails.getClientName()); templateParams.put("deprecatedAccountCreationDate", deprecatedAccountCreationDate); templateParams.put("deprecatedId", deprecatedOrcid); addMessageParams(templateParams, userLocale); // Generate html from template String html = templateManager.processTemplate("auto_deprecated_account_html.ftl", templateParams); NotificationAdministrative notification = new NotificationAdministrative(); notification.setNotificationType(NotificationType.ADMINISTRATIVE); notification.setSubject(subject); notification.setBodyHtml(html); createNotification(primaryOrcid, notification); }