use of name.abuchen.portfolio.model.Taxonomy.Visitor in project portfolio by buchen.
the class OpenSampleHandler method applyTaxonomyLabels.
private void applyTaxonomyLabels(TaxonomyTemplate template, Taxonomy taxonomy) {
Taxonomy original = template.buildOriginal();
taxonomy.setName(original.getName());
taxonomy.setDimensions(original.getDimensions());
Map<String, Classification> translated = //
original.getAllClassifications().stream().collect(Collectors.toMap(c -> c.getId(), c -> c));
taxonomy.foreach(new Visitor() {
@Override
public void visit(Classification classification) {
Classification t = translated.get(classification.getId());
if (t != null) {
classification.setName(t.getName());
classification.setNote(t.getNote());
}
}
});
}
Aggregations