Search in sources :

Example 1 with MessageResolver

use of org.springframework.binding.message.MessageResolver in project head by mifos.

the class QuestionnaireController method constructErrorMessage.

protected void constructErrorMessage(String code, String message, MessageContext context, Object... args) {
    MessageResolver messageResolver = new MessageBuilder().error().code(code).defaultText(message).args(args).build();
    context.addMessage(messageResolver);
}
Also used : MessageResolver(org.springframework.binding.message.MessageResolver) MessageBuilder(org.springframework.binding.message.MessageBuilder)

Example 2 with MessageResolver

use of org.springframework.binding.message.MessageResolver in project head by mifos.

the class CashFlowValidator method constructErrorMessage.

void constructErrorMessage(String code, String message, MessageContext context, Object... args) {
    MessageResolver messageResolver = new MessageBuilder().error().code(code).defaultText(message).args(args).build();
    context.addMessage(messageResolver);
}
Also used : MessageResolver(org.springframework.binding.message.MessageResolver) MessageBuilder(org.springframework.binding.message.MessageBuilder)

Example 3 with MessageResolver

use of org.springframework.binding.message.MessageResolver in project uPortal by Jasig.

the class PersonQueryValidator method validatePersonLookup.

/** Ensures all passed attributes are part of the valid query attribute set. */
public void validatePersonLookup(PersonQuery personQuery, MessageContext context) {
    final RequestContext requestContext = RequestContextHolder.getRequestContext();
    final ExternalContext externalContext = requestContext.getExternalContext();
    final Set<String> queryAttributes = personLookupHelper.getQueryAttributes(externalContext);
    final Map<String, Attribute> attributes = personQuery.getAttributes();
    for (final String attribute : attributes.keySet()) {
        if (!queryAttributes.contains(attribute)) {
            final MessageBuilder messageBuilder = new MessageBuilder();
            messageBuilder.error();
            messageBuilder.source("attributes[" + attribute + "].value");
            messageBuilder.code("personLookup.invalidQueryAttribute");
            messageBuilder.arg(attribute);
            final MessageResolver errorMessage = messageBuilder.build();
            context.addMessage(errorMessage);
        }
    }
}
Also used : MessageResolver(org.springframework.binding.message.MessageResolver) MessageBuilder(org.springframework.binding.message.MessageBuilder) Attribute(org.apereo.portal.portlets.Attribute) ExternalContext(org.springframework.webflow.context.ExternalContext) RequestContext(org.springframework.webflow.execution.RequestContext)

Example 4 with MessageResolver

use of org.springframework.binding.message.MessageResolver in project head by mifos.

the class ValidationExceptionMessageExtractor method constructErrorMessage.

private void constructErrorMessage(String code, String defaultMessage, MessageContext context, Object... args) {
    MessageResolver messageResolver = new MessageBuilder().error().code(code).defaultText(defaultMessage).args(args).build();
    context.addMessage(messageResolver);
}
Also used : MessageResolver(org.springframework.binding.message.MessageResolver) MessageBuilder(org.springframework.binding.message.MessageBuilder)

Example 5 with MessageResolver

use of org.springframework.binding.message.MessageResolver in project head by mifos.

the class QuestionnaireController method constructErrorMessage.

protected void constructErrorMessage(MessageContext context, String code, String source, String message) {
    MessageResolver messageResolver = new MessageBuilder().error().code(code).source(source).defaultText(message).build();
    context.addMessage(messageResolver);
}
Also used : MessageResolver(org.springframework.binding.message.MessageResolver) MessageBuilder(org.springframework.binding.message.MessageBuilder)

Aggregations

MessageBuilder (org.springframework.binding.message.MessageBuilder)6 MessageResolver (org.springframework.binding.message.MessageResolver)6 Attribute (org.apereo.portal.portlets.Attribute)1 ExternalContext (org.springframework.webflow.context.ExternalContext)1 RequestContext (org.springframework.webflow.execution.RequestContext)1