io.symcpe.wraith.rules.validator.AlertValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wraith-engine Show documentation
Show all versions of wraith-engine Show documentation
An efficient event correlation library
package io.symcpe.wraith.rules.validator;
import java.util.List;
import io.symcpe.wraith.actions.alerts.Alert;
public class AlertValidator implements Validator {
private static ValidationException EXCEPTION = new ValidationException("Bad alert");
@Override
public void configure(List> validators) {
}
@Override
public void validate(Alert value) throws ValidationException {
if(value.getBody()==null || value.getBody().trim().isEmpty()) {
throw EXCEPTION;
}
if(value.getMedia()==null || value.getMedia().trim().isEmpty()) {
throw EXCEPTION;
}
if(value.getSubject()==null || value.getSubject().trim().isEmpty()) {
throw EXCEPTION;
}
if(value.getTarget()==null || value.getTarget().trim().isEmpty()) {
throw EXCEPTION;
}
if(value.getTimestamp()<1) {
throw EXCEPTION;
}
}
}