de.smartics.exceptions.i18n.message
Enum MessageType

Package class diagram package MessageType
java.lang.Object
  extended by java.lang.Enum<MessageType>
      extended by de.smartics.exceptions.i18n.message.MessageType
All Implemented Interfaces:
Serializable, Comparable< MessageType>

public enum MessageType
     
     
extends Enum< MessageType>

Defines the valid message types to be displayed.

Note that most of the time the messages provided to exceptions are intended for the system operator or software developer as long as the presentation tier is not concerned. Displaying messages in the presentation tier often requires more structured text than simple text (e.g. messages shown in a web browser). Presentation tier messages should abstract from the messages provided to the exceptions caught from lower levels.

Displaying messages intended for the operator or software developer to the user will also introduce a security risk. Please refer to Information Leakage and Improper Error Handling for details.

Author:
Robert Reiner

Enum Constant Summary
DETAILS
          The suffix for the resource key to fetch details information.
IMPLICATIONS_ON_CURRENT_TASK
          The suffix for the resource key to fetch information about what implications the abort of the current task has on the work of the user.
SUMMARY
          The suffix for the resource key to fetch summary information.
TITLE
          The suffix for the resource key to fetch title information.
URL
          The suffix for the resource key to fetch an URL that links to further information on the problem.
WHAT_TO_DO_NOW
          The suffix for the resource key to fetch information about what the user can do now.
 
Method Summary
 String createKey(String keyPrefix)
          Returns the key with the message type resource key suffix ( getMessageKeySuffix()) appended.
 String getMessageKeySuffix()
          Returns the suffix for the resource keys to fetch a specific type of message.
 List<MessageParamParser.MessageParamInfo> getMessageParamInfos(MessageParam messageParam)
          Returns the index information specified in the message parameter for the message type.
 Map<String,List<MessageParamParser.MessageParamInfo>> getParentMessageParamInfos(ParentMessageParam messageParam)
          Returns the index information for the parent attributes specified in the message parameter for the message type.
static MessageType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MessageType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

TITLE

public static final MessageType TITLE
The suffix for the resource key to fetch title information.

This information is intended to provide a simple category to be displayed in window titles. More than one message has the same title.

The value of this constant is ".title".


SUMMARY

public static final MessageType SUMMARY
The suffix for the resource key to fetch summary information.

The summary is a short explanation of what has happened.

The value of this constant is the empty string.


DETAILS

public static final MessageType DETAILS
The suffix for the resource key to fetch details information.

The details information gives more details on what has happened. Typical usage of this message type is to add parameter values that were passed to the module that throwed the exception of to give some technical details only relevant to users of the system that track the failure to its root cause.

The value of this constant is ".details".


IMPLICATIONS_ON_CURRENT_TASK

public static final MessageType IMPLICATIONS_ON_CURRENT_TASK
The suffix for the resource key to fetch information about what implications the abort of the current task has on the work of the user.

While the summary and details section of the message explained what has happend, the implications show what this means for the current task being aborted. The reader of the message can e.g. be assured that his transaction has been rolled back and no money transfer has taken place.

The value of this constant is ".implications".


WHAT_TO_DO_NOW

public static final MessageType WHAT_TO_DO_NOW
The suffix for the resource key to fetch information about what the user can do now.

If the exception has been raised e.g. because of invalid user input this information can lead the user to what input has been expected. It can also give hints what configuration has lead to this problem in case a subsystem is not available.

The value of this constant is ".todo".


URL

public static final MessageType URL
The suffix for the resource key to fetch an URL that links to further information on the problem.

The information references may provide even more details on the type of failure being reported. The referenced page may only have static content that does not quote parameters provided by the exception instance, but may provide structured information and links to related information on a help portal or FAQ.

The value of this constant is ".url".

Method Detail

values

public static MessageType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MessageType c : MessageType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MessageType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getMessageKeySuffix

public String getMessageKeySuffix()
Returns the suffix for the resource keys to fetch a specific type of message.

Returns:
the suffix for the resource keys to fetch a specific type of message.

createKey

public String createKey(String keyPrefix)
Returns the key with the message type resource key suffix ( getMessageKeySuffix()) appended.

Parameters:
keyPrefix - the prefix of the key.
Returns:
the key with the given prefix and the message type suffix appended.

getMessageParamInfos

public List<MessageParamParser.MessageParamInfo> getMessageParamInfos(MessageParam messageParam)
Returns the index information specified in the message parameter for the message type.

Parameters:
messageParam - the annotation that contains the specific or default index with optional OGNL path.
Returns:
the specific or default index information set. If no index is set, the empty list is returned.

getParentMessageParamInfos

public Map<String,List<MessageParamParser.MessageParamInfo>> getParentMessageParamInfos(ParentMessageParam messageParam)
Returns the index information for the parent attributes specified in the message parameter for the message type.

Parameters:
messageParam - the annotation that contains the specific or default index with optional OGNL path for each parent attribute.
Returns:
the specific or default index information set for each attribute. If no index is set, the empty map is returned. The key is the name of the attribute, the value is the message parameter info as per getMessageParamInfos(MessageParam).


Copyright © 2007-$2011 Kronseder & Reiner GmbH - smartics. All Rights Reserved.