org.kuali.kfs.sys
Class MessageBuilder

java.lang.Object
  extended by org.kuali.kfs.sys.MessageBuilder

public class MessageBuilder
extends Object

This class provides a set of utilities that can be used to build error message


Constructor Summary
MessageBuilder()
           
 
Method Summary
static void addMessageIntoList(List<Message> messageList, Message message)
          add the given message into the given message list
static String buildErrorMessageWithDataDictionary(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass, String attributeName, String currentValue)
          build the error message with the given label and current value
static Message buildMessage(String errorMessageKey, int errorType)
          Build the error message with the message body and error type
static Message buildMessage(String errorMessageKey, String invalidValue)
          Build the message for a fatal error with the message body and invalid value
static Message buildMessage(String errorMessageKey, String invalidValue, int errorType)
          Build the error message with the message body, invalid value and error type
static Message buildMessageWithPlaceHolder(String errorMessageKey, int errorType, Object... invalidValues)
          Build the error message with the message body, invalid value and error type.
static Message buildMessageWithPlaceHolder(String errorMessageKey, Object... invalidValues)
          Build the message for a fatal error with the message body and invalid value.
static String formatMessageBody(String errorMessageBody, String invalidValue)
          Format the error message body based on the given error message and invalid value
static String getPropertyString(String messageKey)
          get the message from application resource properties with the given key
static String getShortLabel(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass, String attributeName)
          get the label of the specified attribute of the given business object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBuilder

public MessageBuilder()
Method Detail

addMessageIntoList

public static void addMessageIntoList(List<Message> messageList,
                                      Message message)
add the given message into the given message list

Parameters:
messageList - the given message list
message - the given message

buildMessage

public static Message buildMessage(String errorMessageKey,
                                   int errorType)
Build the error message with the message body and error type


buildMessage

public static Message buildMessage(String errorMessageKey,
                                   String invalidValue)
Build the message for a fatal error with the message body and invalid value


buildMessage

public static Message buildMessage(String errorMessageKey,
                                   String invalidValue,
                                   int errorType)
Build the error message with the message body, invalid value and error type


formatMessageBody

public static String formatMessageBody(String errorMessageBody,
                                       String invalidValue)
Format the error message body based on the given error message and invalid value


buildMessageWithPlaceHolder

public static Message buildMessageWithPlaceHolder(String errorMessageKey,
                                                  int errorType,
                                                  Object... invalidValues)
Build the error message with the message body, invalid value and error type. The message body contains place holders.


buildMessageWithPlaceHolder

public static Message buildMessageWithPlaceHolder(String errorMessageKey,
                                                  Object... invalidValues)
Build the message for a fatal error with the message body and invalid value. The message body contains place holders.


getPropertyString

public static String getPropertyString(String messageKey)
get the message from application resource properties with the given key

Parameters:
messageKey - the given message key
Returns:
the message from application resource properties with the given key

buildErrorMessageWithDataDictionary

public static String buildErrorMessageWithDataDictionary(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass,
                                                         String attributeName,
                                                         String currentValue)
build the error message with the given label and current value

Parameters:
label - the given label
currentValue - the given current value
Returns:
the error message built from the given label and current value

getShortLabel

public static String getShortLabel(Class<? extends org.kuali.rice.kns.bo.BusinessObject> businessObjectClass,
                                   String attributeName)
get the label of the specified attribute of the given business object

Parameters:
businessObjectClass - the given business object
attributeName - the specified attribute name
Returns:
the label of the specified attribute of the given business object


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