Ejemplo n.º 1
0
 public void setTitles(List<LanguageString> titles) {
   if (titles != null) {
     this.titles = titles;
   } else {
     this.titles = emptyList();
   }
   langToTitle = new HashMap<String, LanguageString>();
   for (LanguageString title : this.titles) {
     langToTitle.put(title.getLanguage(), title);
   }
 }
Ejemplo n.º 2
0
 public void setAbstracts(List<LanguageString> abstracts) {
   if (abstracts != null) {
     this.abstracts = abstracts;
   } else {
     this.abstracts = emptyList();
   }
   langToAbstract = new HashMap<String, LanguageString>();
   for (LanguageString abstr : this.abstracts) {
     langToAbstract.put(abstr.getLanguage(), abstr);
   }
 }
Ejemplo n.º 3
0
 private String getAsLocaleString(List<LanguageString> languageStrings) {
   Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
   for (LanguageString ls : languageStrings) {
     if (locale.getLanguage().equals(ls.getLanguage())) {
       return ls.getString();
     }
   }
   if (!languageStrings.isEmpty()) {
     return languageStrings.get(0).getString();
   }
   return "";
 }