Search in sources :

Example 1 with Worker

use of org.openforis.concurrency.Worker in project collect by openforis.

the class CSVDataImportJob method getParsingErrors.

public List<DataParsingError> getParsingErrors() {
    List<DataParsingError> result = new ArrayList<DataParsingError>();
    for (Worker worker : getTasks()) {
        CSVDataImportTask task = (CSVDataImportTask) worker;
        ReferenceDataImportStatus<ParsingError> dataImportStatus = task.getDataImportStatus();
        if (dataImportStatus != null) {
            List<ParsingError> errors = dataImportStatus.getErrors();
            for (ParsingError parsingError : errors) {
                DataParsingError dataParsingError = new DataParsingError(task.getInput().getFile().getName(), parsingError.getRow(), parsingError.getErrorType(), parsingError.getColumns(), parsingError.getMessage(), parsingError.getMessageArgs());
                result.add(dataParsingError);
            }
        }
    }
    return result;
}
Also used : ParsingError(org.openforis.collect.io.metadata.parsing.ParsingError) ArrayList(java.util.ArrayList) Worker(org.openforis.concurrency.Worker)

Aggregations

ArrayList (java.util.ArrayList)1 ParsingError (org.openforis.collect.io.metadata.parsing.ParsingError)1 Worker (org.openforis.concurrency.Worker)1