use of org.openforis.idm.model.species.TaxonVernacularName in project collect by openforis.
the class SpeciesManager method fromVernacularNamesToTaxonOccurrences.
private List<TaxonOccurrence> fromVernacularNamesToTaxonOccurrences(CollectTaxonomy taxonomy, List<TaxonVernacularName> vernacularNames, TaxonSearchParameters parameters) {
List<TaxonOccurrence> result = new ArrayList<TaxonOccurrence>();
for (TaxonVernacularName vernacularName : vernacularNames) {
Taxon taxon = taxonDao.loadById(taxonomy, vernacularName.getTaxonSystemId());
TaxonRank highestRank = parameters.getHighestRank();
if (highestRank == null || highestRank == taxon.getTaxonRank() || highestRank.isHigherThan(taxon.getTaxonRank())) {
TaxonOccurrence o = new TaxonOccurrence(taxon, vernacularName);
if (parameters.isIncludeAncestorTaxons()) {
loadAncestorTaxons(taxon, o);
}
result.add(o);
}
}
return result;
}
Aggregations