use of ddf.catalog.validation.impl.ValidationExceptionImpl in project ddf by codice.
the class SampleMetacardValidator method validate.
@Override
public void validate(Metacard metacard) throws ValidationException {
if (checkMetacardForWarningWords(metacard.getTitle())) {
ValidationExceptionImpl validationException = new ValidationExceptionImpl("Metacard title contains one of the warning words: " + warningWords);
validationException.setWarnings(Collections.singletonList("sampleWarnings"));
throw validationException;
}
if (checkMetacardForErrorWords(metacard.getTitle())) {
ValidationExceptionImpl validationException = new ValidationExceptionImpl("Metacard title contains one of the error words: " + errorWords);
validationException.setErrors(Collections.singletonList("sampleError"));
throw validationException;
}
if (!checkMetacardForValidWords(metacard.getTitle())) {
ValidationExceptionImpl validationException = new ValidationExceptionImpl("Metacard title does not contain any of: " + validWords);
validationException.setErrors(Collections.singletonList("sampleError"));
validationException.setWarnings(Collections.singletonList("sampleWarnings"));
throw validationException;
}
}
Aggregations