Package org.springframework.binding.message

Examples of org.springframework.binding.message.MessageBuilder$ResolvableArgument


    }

    String summarySource = source + SUMMARY_MESSAGE_KEY;
    MessageResolver summaryResolver;
    if (message.getSeverity() == FacesMessage.SEVERITY_INFO) {
      summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).info()
          .build();
    } else if (message.getSeverity() == FacesMessage.SEVERITY_WARN) {
      summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).warning()
          .build();
    } else if (message.getSeverity() == FacesMessage.SEVERITY_ERROR) {
      summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).error()
          .build();
    } else {
      summaryResolver = new MessageBuilder().source(summarySource).defaultText(summaryText.toString()).fatal()
          .build();
    }
    context.getMessageContext().addMessage(summaryResolver);

    StringBuffer detailText = new StringBuffer();
    if (StringUtils.hasText(message.getDetail())) {
      detailText.append(message.getDetail());
    }
    String detailSource = source + DETAIL_MESSAGE_KEY;
    MessageResolver detailResolver;
    if (message.getSeverity() == FacesMessage.SEVERITY_INFO) {
      detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).info()
          .build();
    } else if (message.getSeverity() == FacesMessage.SEVERITY_WARN) {
      detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).warning()
          .build();
    } else if (message.getSeverity() == FacesMessage.SEVERITY_ERROR) {
      detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).error()
          .build();
    } else {
      detailResolver = new MessageBuilder().source(detailSource).defaultText(detailText.toString()).fatal()
          .build();
    }
    context.getMessageContext().addMessage(detailResolver);

  }
View Full Code Here


    assertEquals(FacesMessage.SEVERITY_FATAL, facesContext.getMaximumSeverity());
  }

  private void setupMessageContext() {
    prepopulatedMessageContext = new DefaultMessageContext();
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("null_summary").defaultText("foo").info()
        .build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("null_detail").defaultText("foo").info()
        .build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("componentId_summary").defaultText(
        "componentId_summary").warning().build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("componentId_detail").defaultText(
        "componentId_detail").warning().build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("userMessage").defaultText("userMessage")
        .info().build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("null_summary").defaultText("baz").error()
        .build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().source("null_detail").defaultText("baz").error()
        .build());
    prepopulatedMessageContext.addMessage(new MessageBuilder().defaultText("Subzero Wins - Fatality").fatal()
        .build());
  }
View Full Code Here

    }

    public void validateEnterBookingDetails(ValidationContext context) {
  MessageContext messages = context.getMessageContext();
  if (checkinDate.before(today())) {
      messages.addMessage(new MessageBuilder().error().source("checkinDate").code(
        "booking.checkinDate.beforeToday").build());
  } else if (checkoutDate.before(checkinDate)) {
      messages.addMessage(new MessageBuilder().error().source("checkoutDate").code(
        "booking.checkoutDate.beforeCheckinDate").build());
  }
    }
View Full Code Here

     * Validates 'addressForm' view state after binding to address.
     * Spring Web Flow activated validation ('validate' + ${state}).
     */
    public void validateAddressForm(MessageContext context) {
        if (!StringUtils.hasText(address)) {
            context.addMessage(new MessageBuilder().error().source("address").code("address.form.address.error").build());
        }
       
        if (!StringUtils.hasText(city)) {
            context.addMessage(new MessageBuilder().error().source("city").code("address.form.city.error").build());
        }
       
        if (!StringUtils.hasText(state)) {
            context.addMessage(new MessageBuilder().error().source("state").code("address.form.state.error").build());
        }
       
        if (!StringUtils.hasText(zipPostal)) {
            context.addMessage(new MessageBuilder().error().source("zipPostal").code("address.form.zipPostal.error").build());
        }
       
        if (!StringUtils.hasText(country)) {
            context.addMessage(new MessageBuilder().error().source("country").code("address.form.country.error").build());
        }
    }
View Full Code Here

     * Spring Web Flow activated validation (validate + ${state}).
     * Validates 'personForm' view state after binding to person.
     */
    public void validatePersonForm(Person person, MessageContext context) {
        if (!StringUtils.hasText(person.getFirstName())) {
            context.addMessage(new MessageBuilder().error().source("firstName").code("person.form.firstName.error").build());
        }

        if (!StringUtils.hasText(person.getLastName())) {
            context.addMessage(new MessageBuilder().error().source("lastName").code("person.form.lastName.error").build());
        }
    }
View Full Code Here

*/
public class StubModelValidationContext {

  public void validateMockState(ValidationContext context) {
    context.getMessageContext()
        .addMessage(new MessageBuilder().source("validationcontext").defaultText("").build());
  }
View Full Code Here

        .addMessage(new MessageBuilder().source("validationcontext").defaultText("").build());
  }

  public void validateMockState(Object model, ValidationContext context) {
    context.getMessageContext().addMessage(
        new MessageBuilder().source("validationcontext-external").defaultText("").build());
  }
View Full Code Here

    Flow flow = new Flow("flow");
    new EndState(flow, "end");
    MockFlowExecutionListener mockListener = new MockFlowExecutionListener() {
      public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap<?> input) {
        super.sessionStarting(context, session, input);
        context.getMessageContext().addMessage(new MessageBuilder().source("foo").defaultText("bar").build());
      }
    };
    FlowExecutionListener[] listeners = new FlowExecutionListener[] { mockListener };
    FlowExecutionImpl execution = new FlowExecutionImpl(flow);
    execution.setListeners(listeners);
View Full Code Here

* Support class for {@link ValidationHelperTests}
*/
public class StubModelMessageContext {

  public void validateMockState(MessageContext context) {
    context.addMessage(new MessageBuilder().source("messagecontext").defaultText("").build());
  }
View Full Code Here

  public void validateMockState(MessageContext context) {
    context.addMessage(new MessageBuilder().source("messagecontext").defaultText("").build());
  }

  public void validateMockState(Object model, MessageContext context) {
    context.addMessage(new MessageBuilder().source("messagecontext-external").defaultText("").build());
  }
View Full Code Here

TOP

Related Classes of org.springframework.binding.message.MessageBuilder$ResolvableArgument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.