I have the following validation:
-The start date must be less than or equal to the current system date
-The Start date must be equal to or greater than the Request date
In case a validation or both are not fulfilled, they send a message, and if both are fulfilled, nothing happens. Is the way it is stated correct? in my return it sends an Output, that is an internal class that I use in this same code, which contains the attributes of messages and response with its get and set and its constructor.
Is there any other way of doing it in a single validation and that it sends me the different messages depending on where it fails?
public Output apply(Input input){
Date dateToday = new Date();
boolean respuesta = false;
String mensaje29 = "";
String mensaje94 = "";
if (input.getSolicitudP().getCertifi().getFechaInicio().before(dateToday)
|| input.getSolicitudP).getCertifi().getFechaInicio().equals(dateToday)) {
respuesta = true;
} else {
respuesta = false;
mensaje29 = "Verifica fecha";
}
if (input.getSolicitudP().getCertifi().getFechaInicio().equals(input.getSolicitudP().getPen().getFechaSoli())
|| input.getSolicitudP().getCertifi().getFechaInicio().after(input.getSolicitudP().getPen().getFechaSoli()))
{
respuesta = true;
} else {
mensaje94 = "ALGO";
}
return new Output(respuesta, mensaje29, mensaje94);
}