use of org.openforis.collect.io.metadata.parsing.ParsingError in project collect by openforis.
the class SamplingDesignImportTask method validateLine.
protected boolean validateLine(SamplingDesignLine line) throws ParsingException {
SamplingDesignLineValidator validator = SamplingDesignLineValidator.createInstance(survey);
validator.validate(line);
List<ParsingError> errors = validator.getErrors();
for (ParsingError error : errors) {
addParsingError(error);
}
checkDuplicateLine(line);
return true;
}
use of org.openforis.collect.io.metadata.parsing.ParsingError in project collect by openforis.
the class SamplingDesignLineValidator method validateSrsId.
protected void validateSrsId(SamplingDesignLine line) {
String srsId = line.getSrsId();
SpatialReferenceSystem srs = survey.getSpatialReferenceSystem(srsId);
if (srs == null) {
ParsingError error = new ParsingError(ErrorType.INVALID_VALUE, line.getLineNumber(), SamplingDesignFileColumn.SRS_ID.getColumnName(), INVALID_SRS_ID_MESSAGE_KEY);
error.setMessageArgs(new String[] { srsId });
errors.add(error);
}
}
use of org.openforis.collect.io.metadata.parsing.ParsingError in project collect by openforis.
the class ParsingErrorProxy method fromList.
public static List<ParsingErrorProxy> fromList(List<ParsingError> items) {
List<ParsingErrorProxy> result = new ArrayList<ParsingErrorProxy>();
if (items != null) {
for (ParsingError item : items) {
ParsingErrorProxy proxy = new ParsingErrorProxy(item);
result.add(proxy);
}
}
return result;
}
use of org.openforis.collect.io.metadata.parsing.ParsingError in project collect by openforis.
the class SpeciesImportProcess method throwDuplicateRowParsingException.
protected void throwDuplicateRowParsingException(SpeciesLine line, SpeciesFileColumn column, Node foundNode) throws ParsingException {
ParsingError error = new ParsingError(ErrorType.DUPLICATE_VALUE, line.getLineNumber(), column.getColumnName());
error.setMessageArgs(new String[] { foundNode.getMetadata(LINE_NUMBER_TREE_NODE_METADATA).toString() });
throw new ParsingException(error);
}
use of org.openforis.collect.io.metadata.parsing.ParsingError in project collect by openforis.
the class SpeciesImportProcess method createTaxonGenus.
protected Taxon createTaxonGenus(SpeciesLine line) throws ParsingException {
String genus = line.getGenus();
if (genus == null) {
ParsingError error = new ParsingError(ErrorType.INVALID_VALUE, line.getLineNumber(), SpeciesFileColumn.SCIENTIFIC_NAME.getColumnName(), INVALID_GENUS_NAME_ERROR_MESSAGE_KEY);
throw new ParsingException(error);
}
Taxon taxonFamily = createTaxonFamily(line);
String normalizedScientificName = StringUtils.join(genus, " ", GENUS_SUFFIX);
return createTaxon(line, GENUS, taxonFamily, normalizedScientificName);
}
Aggregations