Search in sources :

Example 11 with LocalizedString

use of org.obiba.mica.core.domain.LocalizedString 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

LocalizedString (org.obiba.mica.core.domain.LocalizedString)11 StudyTable (org.obiba.mica.core.domain.StudyTable)2 Timed (com.codahale.metrics.annotation.Timed)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Strings (com.google.common.base.Strings)1 Maps (com.google.common.collect.Maps)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 Nullable (javax.annotation.Nullable)1 Inject (javax.inject.Inject)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 QueryParam (javax.ws.rs.QueryParam)1 RequiresAuthentication (org.apache.shiro.authz.annotation.RequiresAuthentication)1 NoSuchDatasetException (org.obiba.mica.dataset.NoSuchDatasetException)1 HarmonizationDataset (org.obiba.mica.dataset.domain.HarmonizationDataset)1 StudyDataset (org.obiba.mica.dataset.domain.StudyDataset)1 FileResource (org.obiba.mica.file.rest.FileResource)1