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;
}
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);
}
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;
}
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);
}
Aggregations