org.kuali.student.common.messagebuilder.impl
Class AbstractMessageBuilder

java.lang.Object
  extended by org.kuali.student.common.messagebuilder.impl.AbstractMessageBuilder
Direct Known Subclasses:
MessageBuilderImpl

public abstract class AbstractMessageBuilder
extends Object

This AbstractMessageBuilder class builds a summary message from plain strings or Velocity template messages. Summary message is built from analysing the outcome of a boolean expression. If no language is specified then the default language locale is used.


Constructor Summary
AbstractMessageBuilder(String language, MessageTreeBuilder treeNodeMessageBuilder)
          Constructor.
 
Method Summary
 BooleanFunctionResult build()
           
 BooleanFunctionResult build(String booleanExpression, Map<String,? extends BooleanMessage> messageMap)
          Builds and evaluates a boolean expression and returns the message and result of the expression.
 BooleanFunctionResult build(String booleanExpression, Map<String,? extends BooleanMessage> messageMap, Map<String,Object> messageContextMap)
          Builds and evaluates a boolean expression and returns the message and result of the expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMessageBuilder

public AbstractMessageBuilder(String language,
                              MessageTreeBuilder treeNodeMessageBuilder)
Constructor.

Parameters:
language - Language
treeNodeMessageBuilder - AST tree node Message builder
Method Detail

build

public BooleanFunctionResult build(String booleanExpression,
                                   Map<String,? extends BooleanMessage> messageMap)

Builds and evaluates a boolean expression and returns the message and result of the expression. Messages in the messageMap can also contain VTL (Velocity Template Language) but without any VTL keys

Note: Order of boolean operation: ANDs before ORs and operations inside parentheses before anything else.

Example 1: 'A AND B OR C AND D' internally evaluates to '(A AND B) OR (C AND D)'
booleanExpression = "A*B+C*D"
Example 2: '(M1 AND M2) OR M3'
booleanExpression = "(M1*M2)+M3"

Parameters:
booleanExpression - Boolean expression
messageMap - Contains a map of messages (or VTL)
Returns:
Boolean function result

build

public BooleanFunctionResult build(String booleanExpression,
                                   Map<String,? extends BooleanMessage> messageMap,
                                   Map<String,Object> messageContextMap)

Builds and evaluates a boolean expression and returns the message and result of the expression. Messages in the messageMap can also contain VTL (Velocity Template Language). messageContextMap contains Velocity key/value entries referenced in the messageMap.

Note: Order of boolean operation: ANDs before ORs and operations inside parentheses before anything else.

Example 1: 'A AND B OR C AND D' internally evaluates to '(A AND B) OR (C AND D)'
booleanExpression = "A*B+C*D"
Example 2: '(M1 AND M2) OR M3'
booleanExpression = "(M1*M2)+M3"

Parameters:
booleanExpression - Boolean expression
messageMap - Contains a map of messages (or VTL)
messageContextMap - Message contact map for Velocity Template Engine
Returns:
Boolean function result
Throws:
MessageBuilderException - Errors building message

build

public BooleanFunctionResult build()


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.