use of org.springframework.binding.message.MessageContext in project head by mifos.
the class CustomizedTextFormBean method doValidation.
private void doValidation(ValidationContext context) {
MessageContext messages = context.getMessageContext();
validator.validate(this, messages);
}
use of org.springframework.binding.message.MessageContext in project head by mifos.
the class FundTransferFormBean method validateEnterDetailsStep.
public void validateEnterDetailsStep(ValidationContext context) {
amountBindingError = false;
MessageContext messageContext = context.getMessageContext();
handleBindingErrors(messageContext);
validateTrxnDate(messageContext);
validateReceiptDate(messageContext);
validateAmount(messageContext);
}
use of org.springframework.binding.message.MessageContext in project opennms by OpenNMS.
the class DeliveryOptionsValidator method validateDeliveryOptions.
/**
* <p>validateDeliveryOptions</p>
*
* @param deliveryOptions a {@link org.opennms.reporting.core.DeliveryOptions} object.
* @param context a {@link org.springframework.binding.validation.ValidationContext} object.
*/
public void validateDeliveryOptions(DeliveryOptions deliveryOptions, ValidationContext context) {
MessageContext messages = context.getMessageContext();
if (!((deliveryOptions.getSendMail() || deliveryOptions.getPersist()))) {
messages.addMessage(new MessageBuilder().error().source("sendMail").defaultText("one of send mail or persist should be selected").build());
messages.addMessage(new MessageBuilder().error().source("persist").defaultText("one of send mail or persist should be selected").build());
} else {
if (deliveryOptions.getSendMail() && (deliveryOptions.getMailTo() == "")) {
messages.addMessage(new MessageBuilder().error().source("mailTo").defaultText("cannot have empty mail recipient").build());
}
}
if (deliveryOptions.getInstanceId().length() == 0) {
messages.addMessage(new MessageBuilder().error().source("instanceId").defaultText("cannot have an empty Id for the report instance").build());
} else if (m_reportSchedulerService.exists(deliveryOptions.getInstanceId())) {
messages.addMessage(new MessageBuilder().error().source("instanceId").defaultText("report instanceId is already in use").build());
}
}
Aggregations