Search in sources :

Example 46 with MessageContext

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);
}
Also used : MessageContext(org.springframework.binding.message.MessageContext)

Example 47 with MessageContext

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);
}
Also used : MessageContext(org.springframework.binding.message.MessageContext)

Example 48 with 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());
    }
}
Also used : MessageBuilder(org.springframework.binding.message.MessageBuilder) MessageContext(org.springframework.binding.message.MessageContext)

Aggregations

MessageContext (org.springframework.binding.message.MessageContext)48 Test (org.junit.Test)18 Message (org.springframework.binding.message.Message)16 MessageBuilder (org.springframework.binding.message.MessageBuilder)6 ArrayList (java.util.ArrayList)5 AuthenticationException (org.apereo.cas.authentication.AuthenticationException)4 InvalidTicketException (org.apereo.cas.ticket.InvalidTicketException)4 UnsatisfiedAuthenticationPolicyException (org.apereo.cas.ticket.UnsatisfiedAuthenticationPolicyException)4 LocalDate (org.joda.time.LocalDate)4 BigDecimal (java.math.BigDecimal)3 GeneralSecurityException (java.security.GeneralSecurityException)3 HashMap (java.util.HashMap)3 AccountLockedException (javax.security.auth.login.AccountLockedException)3 AccountNotFoundException (javax.security.auth.login.AccountNotFoundException)3 PreventedException (org.apereo.cas.authentication.PreventedException)3 DateTime (org.joda.time.DateTime)3 LoanCreationInstallmentDto (org.mifos.dto.domain.LoanCreationInstallmentDto)2 LoanScheduleDto (org.mifos.dto.screen.LoanScheduleDto)2 QuestionGroupDetail (org.mifos.platform.questionnaire.service.QuestionGroupDetail)2 ErrorEntry (org.mifos.platform.validations.ErrorEntry)2