Search in sources :

Example 1 with TaxonRank

use of org.openforis.idm.model.species.Taxon.TaxonRank in project collect by openforis.

the class SpeciesImportProcess method findParentTaxon.

private Taxon findParentTaxon(SpeciesLine line) throws ParsingException {
    TaxonRank rank = line.getRank();
    TaxonRank parentRank = rank.getParent();
    String scientificName;
    switch(parentRank) {
        case FAMILY:
            scientificName = line.getFamilyName();
            break;
        case GENUS:
            scientificName = line.getGenus();
            break;
        case SPECIES:
            scientificName = line.getSpeciesName();
            break;
        default:
            throw new RuntimeException("Unsupported rank");
    }
    Taxon result = taxonTree.findTaxonByScientificName(scientificName);
    return result;
}
Also used : TaxonRank(org.openforis.idm.model.species.Taxon.TaxonRank) Taxon(org.openforis.idm.model.species.Taxon)

Example 2 with TaxonRank

use of org.openforis.idm.model.species.Taxon.TaxonRank in project collect by openforis.

the class TaxonAttributeDefinition method setHighestRank.

@Deprecated
public void setHighestRank(String highestRank) {
    TaxonRank rank = TaxonRank.fromName(highestRank);
    setHighestTaxonRank(rank);
}
Also used : TaxonRank(org.openforis.idm.model.species.Taxon.TaxonRank)

Example 3 with TaxonRank

use of org.openforis.idm.model.species.Taxon.TaxonRank 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)

Example 4 with TaxonRank

use of org.openforis.idm.model.species.Taxon.TaxonRank in project collect by openforis.

the class TaxonAttributeXS method attributes.

@Override
protected void attributes(TaxonAttributeDefinition defn) throws IOException {
    super.attributes(defn);
    // attribute(QUALIFIABLE, defn.getQualifiers());
    attribute(TAXONOMY, defn.getTaxonomy());
    TaxonRank highestRank = defn.getHighestTaxonRank();
    attribute(HIGHEST_RANK, highestRank == null ? null : highestRank.getName());
    writeQualifiers(defn);
}
Also used : TaxonRank(org.openforis.idm.model.species.Taxon.TaxonRank)

Aggregations

TaxonRank (org.openforis.idm.model.species.Taxon.TaxonRank)4 Taxon (org.openforis.idm.model.species.Taxon)2 ArrayList (java.util.ArrayList)1 TaxonOccurrence (org.openforis.idm.model.TaxonOccurrence)1 TaxonVernacularName (org.openforis.idm.model.species.TaxonVernacularName)1