use of org.obiba.opal.web.model.Opal in project mica2 by obiba.
the class OpalServiceHelper method getTaxonomies.
// opal root url as key
@Cacheable(value = "opal-taxonomies", key = "#opalJavaClient.newUri().build()")
public Map<String, Taxonomy> getTaxonomies(OpalJavaClient opalJavaClient) {
log.info("Fetching opal taxonomies");
URI uri = opalJavaClient.newUri().segment("system", "conf", "taxonomies").build();
List<Opal.TaxonomyDto> taxonomies = opalJavaClient.getResources(Opal.TaxonomyDto.class, uri, Opal.TaxonomyDto.newBuilder());
ConcurrentMap<String, Taxonomy> taxonomiesList = taxonomies.stream().collect(Collectors.toConcurrentMap(Opal.TaxonomyDto::getName, this::fromDto));
eventBus.post(new OpalTaxonomiesUpdatedEvent(taxonomiesList));
return taxonomiesList;
}
Aggregations