All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.symcpe.wraith.rules.validator.AlertValidator Maven / Gradle / Ivy

There is a newer version: 0.0.34
Show newest version
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;
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy