예제 #1
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);
   }
 }
예제 #2
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);
   }
 }
예제 #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 "";
 }
 private void writeKeywordList(
     final XMLStreamWriter writer, final List<Pair<List<LanguageString>, CodeType>> keywordList)
     throws XMLStreamException {
   if (keywordList != null && !keywordList.isEmpty()) {
     writer.writeStartElement("KeywordList");
     for (final Pair<List<LanguageString>, CodeType> kws : keywordList) {
       for (final LanguageString ls : kws.first) {
         // <!ELEMENT Keyword (#PCDATA) >
         writeElement(writer, "Keyword", ls.getString());
       }
     }
     writer.writeEndElement();
   }
 }