Search in sources :

Example 11 with ParsingException

use of org.openforis.collect.io.exception.ParsingException in project collect by openforis.

the class SpeciesImportProcess method createTaxonSpecies.

protected Taxon createTaxonSpecies(SpeciesLine line) throws ParsingException {
    String speciesName;
    if (line.getRank() == SPECIES) {
        speciesName = line.getCanonicalScientificName();
    } else {
        speciesName = line.getSpeciesName();
    }
    if (speciesName == null) {
        ParsingError error = new ParsingError(ErrorType.INVALID_VALUE, line.getLineNumber(), SpeciesFileColumn.SCIENTIFIC_NAME.getColumnName(), INVALID_SPECIES_NAME_ERROR_MESSAGE_KEY);
        throw new ParsingException(error);
    }
    Taxon taxonGenus = createTaxonGenus(line);
    return createTaxon(line, SPECIES, taxonGenus, speciesName);
}
Also used : ParsingError(org.openforis.collect.io.metadata.parsing.ParsingError) ParsingException(org.openforis.collect.io.exception.ParsingException) Taxon(org.openforis.idm.model.species.Taxon)

Aggregations

ParsingException (org.openforis.collect.io.exception.ParsingException)11 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)9 IOException (java.io.IOException)4 CollectSurvey (org.openforis.collect.model.CollectSurvey)2 CodeListItem (org.openforis.idm.metamodel.CodeListItem)2 Taxon (org.openforis.idm.model.species.Taxon)2 File (java.io.File)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 ErrorType (org.openforis.collect.io.metadata.parsing.ParsingError.ErrorType)1 CodeListCSVReader (org.openforis.collect.manager.codelistimport.CodeListCSVReader)1 CodeListLine (org.openforis.collect.manager.codelistimport.CodeListLine)1 TaxonTree (org.openforis.collect.model.TaxonTree)1 RecordPersistenceException (org.openforis.collect.persistence.RecordPersistenceException)1 SurveyStoreException (org.openforis.collect.persistence.SurveyStoreException)1 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)1 TaxonomyDefinition (org.openforis.idm.metamodel.ReferenceDataSchema.TaxonomyDefinition)1