return SystemNotificationForm.class.isAssignableFrom(aClass);
}
@Override
public void validate(Object o, Errors errors) {
SystemNotificationForm systemNotificationForm = (SystemNotificationForm) o;
if (!doesBindingErrorExist(errors, START_DATE) && systemNotificationForm.getStartDate() == null) {
errors.rejectValue(START_DATE, "systemNotificationValidator.startDate");
}
if (!doesBindingErrorExist(errors, END_DATE) && systemNotificationForm.getStartDate() != null && systemNotificationForm.getEndDate() != null && !systemNotificationForm.getEndDate().after(systemNotificationForm.getStartDate())) {
errors.rejectValue(END_DATE, "systemNotificationValidator.endDate");
}
if (!doesBindingErrorExist(errors, MESSAGE) && !StringUtils.hasText(systemNotificationForm.getMessage())) {
errors.rejectValue(MESSAGE, "systemNotificationValidator.message");
}
if (!doesBindingErrorExist(errors, NOTIFICATION_TYPE) && systemNotificationForm.getNotificationType() == null) {
errors.rejectValue(NOTIFICATION_TYPE, "systemNotificationValidator.notificationType");
}
if (!doesBindingErrorExist(errors, NOTIFICATION_SEVERITY) && systemNotificationForm.getNotificationSeverity() == null) {
errors.rejectValue(NOTIFICATION_SEVERITY, "systemNotificationValidator.notificationSeverity");
}
}