use of org.openforis.collect.metamodel.TaxonSummary in project collect by openforis.
the class SpeciesManager method loadFullTaxonSummariesOld.
public TaxonSummaries loadFullTaxonSummariesOld(CollectTaxonomy taxonomy) {
TaxonTree tree = loadTaxonTree(taxonomy);
List<TaxonSummary> summaries = tree.toSummaries(TaxonRank.GENUS, false);
List<String> sortedVernacularNamesLanguageCodes = new ArrayList<String>(tree.getVernacularLanguageCodes());
Collections.sort(sortedVernacularNamesLanguageCodes);
List<String> infoAttributeNames = taxonomy.getSurvey().getReferenceDataSchema().getTaxonomyDefinition(taxonomy.getName()).getAttributeNames();
return new TaxonSummaries(summaries.size(), summaries, sortedVernacularNamesLanguageCodes, infoAttributeNames);
}
use of org.openforis.collect.metamodel.TaxonSummary in project collect by openforis.
the class SpeciesBackupExportTask method execute.
@Override
protected void execute() throws Throwable {
CsvWriter writer = new CsvWriter(outputStream);
CollectTaxonomy taxonomy = speciesManager.loadTaxonomyById(survey, taxonomyId);
TaxonSummaries summaries = speciesManager.loadFullTaxonSummaries(taxonomy);
List<String> vernacularNamesLangCodes = getNotEmptyValues(summaries.getVernacularNamesLanguageCodes());
// consider Latin vernacular name as synonym
vernacularNamesLangCodes.remove(LATIN_LANG_CODE);
this.vernacularNamesLangCodes = vernacularNamesLangCodes;
// write headers
writeHeaders(writer);
for (TaxonSummary item : summaries.getItems()) {
writeTaxonSummary(writer, item);
}
writer.flush();
}
use of org.openforis.collect.metamodel.TaxonSummary in project collect by openforis.
the class SpeciesExportTask method execute.
@Override
protected void execute() throws Throwable {
CsvWriter writer = new CsvWriter(outputStream);
CollectTaxonomy taxonomy = speciesManager.loadTaxonomyById(survey, taxonomyId);
TaxonSummaries summaries = speciesManager.loadFullTaxonSummariesOld(taxonomy);
List<String> vernacularNamesLangCodes = getNotEmptyValues(summaries.getVernacularNamesLanguageCodes());
// consider Latin vernacular name as synonym
vernacularNamesLangCodes.remove(LATIN_LANG_CODE);
// write headers
ArrayList<String> colNames = new ArrayList<String>();
colNames.add(SpeciesFileColumn.NO.getColumnName());
colNames.add(SpeciesFileColumn.CODE.getColumnName());
colNames.add(SpeciesFileColumn.FAMILY.getColumnName());
colNames.add(SpeciesFileColumn.SCIENTIFIC_NAME.getColumnName());
colNames.add(SpeciesFileColumn.SYNONYMS.getColumnName());
colNames.addAll(vernacularNamesLangCodes);
colNames.addAll(infoAttributeNames);
writer.writeHeaders(colNames);
for (TaxonSummary item : summaries.getItems()) {
writeTaxonSummary(writer, vernacularNamesLangCodes, infoAttributeNames, item);
}
writer.flush();
}
Aggregations