use of org.openforis.idm.metamodel.ReferenceDataSchema.ReferenceDataDefinition.Attribute in project collect by openforis.
the class SpeciesExportTask method extractInfoAttributeNames.
private List<String> extractInfoAttributeNames() {
List<String> colNames = new ArrayList<String>();
TaxonomyDefinition taxonReferenceDataSchema = survey.getReferenceDataSchema().getTaxonomyDefinition(taxonomyName);
List<Attribute> infoAttributes = taxonReferenceDataSchema.getAttributes();
for (Attribute infoAttribute : infoAttributes) {
colNames.add(infoAttribute.getName());
}
return colNames;
}
use of org.openforis.idm.metamodel.ReferenceDataSchema.ReferenceDataDefinition.Attribute in project collect by openforis.
the class SpeciesImportProcess method createTaxon.
protected Taxon createTaxon(SpeciesLine line, TaxonRank rank, Taxon parent, String normalizedScientificName) throws ParsingException {
boolean mostSpecificRank = line.getRank() == rank;
Taxon taxon = taxonTree.findTaxonByScientificName(normalizedScientificName);
boolean newTaxon = taxon == null;
if (newTaxon) {
taxon = new Taxon();
taxon.setTaxonRank(rank);
taxon.setScientificName(normalizedScientificName);
Node node = taxonTree.addNode(parent, taxon);
node.addMetadata(LINE_NUMBER_TREE_NODE_METADATA, line.getLineNumber());
node.addMetadata(RAW_SCIENTIFIC_NAME_TREE_NODE_METADATA, line.getRawScientificName());
} else if (mostSpecificRank) {
checkDuplicateScientificName(line, parent, normalizedScientificName);
}
if (mostSpecificRank) {
String code = line.getCode();
Integer taxonId = line.getTaxonId();
checkDuplicates(line, code, taxonId);
taxon.setCode(code);
taxon.setTaxonId(taxonId);
TaxonomyDefinition taxonDefinition = survey.getReferenceDataSchema().getTaxonomyDefinition(taxonomyName);
List<Attribute> taxonAttributes = taxonDefinition.getAttributes();
for (Attribute attribute : taxonAttributes) {
String value = line.getInfoAttribute(attribute.getName());
taxon.addInfoAttribute(value);
}
taxonTree.updateNodeInfo(taxon);
processVernacularNames(line, taxon);
}
return taxon;
}
use of org.openforis.idm.metamodel.ReferenceDataSchema.ReferenceDataDefinition.Attribute in project collect by openforis.
the class SpeciesBackupImportTask method processLine.
protected void processLine(SpeciesBackupLine line) throws ParsingException {
Taxon taxon = new Taxon();
taxon.setSystemId(line.getId());
taxon.setParentId(line.getParentId());
taxon.setTaxonRank(line.getRank());
taxon.setTaxonId(line.getNo());
taxon.setCode(line.getCode());
taxon.setScientificName(line.getScientificName());
List<Attribute> taxonAttributes = survey.getReferenceDataSchema().getTaxonomyDefinition(taxonomyName).getAttributes();
for (Attribute taxonAttribute : taxonAttributes) {
taxon.addInfoAttribute(line.getInfoAttribute(taxonAttribute.getName()));
}
Taxon parent = findParentTaxon(line);
taxonTree.addNode(parent, taxon);
processVernacularNames(line, taxon);
}
Aggregations