Search in sources :

Example 16 with TaxonVernacularName

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;
}
Also used : TaxonOccurrence(org.openforis.idm.model.TaxonOccurrence) TaxonRank(org.openforis.idm.model.species.Taxon.TaxonRank) Taxon(org.openforis.idm.model.species.Taxon) ArrayList(java.util.ArrayList) TaxonVernacularName(org.openforis.idm.model.species.TaxonVernacularName)

Aggregations

TaxonVernacularName (org.openforis.idm.model.species.TaxonVernacularName)16 Taxon (org.openforis.idm.model.species.Taxon)8 CollectTaxonomy (org.openforis.collect.model.CollectTaxonomy)5 ArrayList (java.util.ArrayList)3 TaxonomyDefinition (org.openforis.idm.metamodel.ReferenceDataSchema.TaxonomyDefinition)3 List (java.util.List)2 SelectConditionStep (org.jooq.SelectConditionStep)2 TaxonTree (org.openforis.collect.model.TaxonTree)2 Node (org.openforis.collect.model.TaxonTree.Node)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Stack (java.util.Stack)1 BatchBindStep (org.jooq.BatchBindStep)1 TableField (org.jooq.TableField)1 Test (org.junit.Test)1 CollectIntegrationTest (org.openforis.collect.CollectIntegrationTest)1 TaxonSummaries (org.openforis.collect.metamodel.TaxonSummaries)1 TaxonSummary (org.openforis.collect.metamodel.TaxonSummary)1 OfcTaxonVernacularNameRecord (org.openforis.collect.persistence.jooq.tables.records.OfcTaxonVernacularNameRecord)1 TaxonOccurrence (org.openforis.idm.model.TaxonOccurrence)1