@Override public void extendTerm(VocabularyInputTerm term, Vocabulary vocabulary) { MultiValuedMap<String, String> termData = this.data.get(term.getId()); if (termData == null || termData.isEmpty()) { return; } for (Map.Entry<String, Collection<String>> datum : termData.asMap().entrySet()) { if (!datum.getValue().isEmpty()) { term.set(datum.getKey(), datum.getValue()); } } }
@Override public void extendTerm(VocabularyInputTerm term, Vocabulary vocabulary) { Locale targetLocale = getTargetLocale(); String label = this.translator.getTranslation(vocabulary.getIdentifier(), term.getId().replace(':', '_') + KEY_MAP.get(NAME_KEY), targetLocale); String definition = this.translator.getTranslation(vocabulary.getIdentifier(), term.getId().replace(':', '_') + KEY_MAP.get(DESCRIPTION_KEY), targetLocale); String synonyms = this.translator.getTranslation(vocabulary.getIdentifier(), term.getId().replace(':', '_') + KEY_MAP.get(SYNONYM_KEY), targetLocale); if (StringUtils.isNotBlank(label)) { term.set(String.format(TRANSLATED_FIELD_FORMAT, NAME_KEY, targetLocale), label); } if (StringUtils.isNotBlank(definition)) { term.set(String.format(TRANSLATED_FIELD_FORMAT, DESCRIPTION_KEY, targetLocale), definition); } if (StringUtils.isNotBlank(synonyms)) { term.set(String.format(TRANSLATED_FIELD_FORMAT, SYNONYM_KEY, targetLocale), splitMultiValuedText(synonyms)); } }
@Override public void extendTerm(VocabularyInputTerm term, Vocabulary vocabulary) { if (!isTargetLocaleEnabled()) { return; } Locale targetLocale = getTargetLocale(); String label = this.translator.getTranslation(vocabulary.getIdentifier(), term.getId().replace(':', '_') + KEY_MAP.get(NAME_KEY), targetLocale); String definition = this.translator.getTranslation(vocabulary.getIdentifier(), term.getId().replace(':', '_') + KEY_MAP.get(DESCRIPTION_KEY), targetLocale); String synonyms = this.translator.getTranslation(vocabulary.getIdentifier(), term.getId().replace(':', '_') + KEY_MAP.get(SYNONYM_KEY), targetLocale); if (StringUtils.isNotBlank(label)) { term.set(String.format(TRANSLATED_FIELD_FORMAT, NAME_KEY, targetLocale), label); } if (StringUtils.isNotBlank(definition)) { term.set(String.format(TRANSLATED_FIELD_FORMAT, DESCRIPTION_KEY, targetLocale), definition); } if (StringUtils.isNotBlank(synonyms)) { term.set(String.format(TRANSLATED_FIELD_FORMAT, SYNONYM_KEY, targetLocale), splitMultiValuedText(synonyms)); } }