Search in sources :

Example 6 with ValidationResult

use of org.openforis.idm.metamodel.validation.ValidationResult in project collect by openforis.

the class CollectValidator method adjustErrorsForEntryPhase.

private ValidationResults adjustErrorsForEntryPhase(ValidationResults results, Attribute<?, ?> attribute) {
    boolean confirmed = isErrorConfirmed(attribute);
    ValidationResults phaseEntryResults = new ValidationResults();
    List<ValidationResult> errors = results.getErrors();
    for (ValidationResult error : errors) {
        ValidationResultFlag newFlag = confirmed ? ValidationResultFlag.WARNING : ValidationResultFlag.ERROR;
        phaseEntryResults.addResult(error.getValidator(), newFlag);
    }
    phaseEntryResults.addResults(results.getWarnings());
    return phaseEntryResults;
}
Also used : ValidationResultFlag(org.openforis.idm.metamodel.validation.ValidationResultFlag) ValidationResults(org.openforis.idm.metamodel.validation.ValidationResults) ValidationResult(org.openforis.idm.metamodel.validation.ValidationResult)

Aggregations

ValidationResult (org.openforis.idm.metamodel.validation.ValidationResult)6 ValidationResults (org.openforis.idm.metamodel.validation.ValidationResults)4 ArrayList (java.util.ArrayList)3 ValidationResultFlag (org.openforis.idm.metamodel.validation.ValidationResultFlag)2 ValidationMessageBuilder (org.openforis.collect.model.validation.ValidationMessageBuilder)1 Attribute (org.openforis.idm.model.Attribute)1