if (orderForm.getDeliveryDate() == null) {
MessageBuilder errorMessageBuilder = new MessageBuilder().error();
errorMessageBuilder.source("deliveryDate");
errorMessageBuilder.code("error.page.selectdeliveryoptions.deliverydate.required");
messageContext.addMessage(errorMessageBuilder.build());
return new EventFactorySupport().error(this);
}
if (!orderForm.getDeliveryDate().after(DateUtils.truncate(orderForm.getOrderDate(), Calendar.DAY_OF_MONTH))) {
MessageBuilder errorMessageBuilder = new MessageBuilder().error();
errorMessageBuilder.source("deliveryDate");
errorMessageBuilder.code("error.page.selectdeliveryoptions.deliverydate.in.past");
messageContext.addMessage(errorMessageBuilder.build());
return new EventFactorySupport().error(this);
}
return new EventFactorySupport().success(this);
}