Search in sources :

Example 6 with Term

use of org.obiba.opal.core.domain.taxonomy.Term in project mica2 by obiba.

the class TaxonomyAggregationMetaDataProvider method getAllLocalizedMetadata.

private Map<String, LocalizedMetaData> getAllLocalizedMetadata(String aggregation) {
    Optional<Vocabulary> vocabulary = getVocabulary(aggregation);
    if (vocabulary.isPresent()) {
        Map<String, LocalizedMetaData> r = Maps.newHashMap();
        for (Term t : vocabulary.get().getTerms()) {
            LocalizedString title = new LocalizedString();
            title.putAll(t.getTitle());
            LocalizedString description = new LocalizedString();
            description.putAll(t.getDescription());
            String className = t.getAttributeValue("className");
            if (Strings.isNullOrEmpty(className)) {
                className = t.getClass().getSimpleName();
            }
            if (!r.containsKey(t.getName())) {
                r.put(t.getName(), new LocalizedMetaData(title, description, className));
            }
        }
        return r;
    }
    return null;
}
Also used : Vocabulary(org.obiba.opal.core.domain.taxonomy.Vocabulary) LocalizedString(org.obiba.mica.core.domain.LocalizedString) Term(org.obiba.opal.core.domain.taxonomy.Term) LocalizedString(org.obiba.mica.core.domain.LocalizedString)

Aggregations

Term (org.obiba.opal.core.domain.taxonomy.Term)6 Vocabulary (org.obiba.opal.core.domain.taxonomy.Vocabulary)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 LocalizedString (org.obiba.mica.core.domain.LocalizedString)1 Taxonomy (org.obiba.opal.core.domain.taxonomy.Taxonomy)1