|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.silverpeas.notification.message.MessageManager
public class MessageManager
This manager provides tools to register and restitute volatile messages (info, success or error) to the user (on screen).
It works for now with Thread Cache Service, and several steps have to be performed : - use the initialize function in order to render accessible message tools provided - user message tools in treatment when necessary - use the destroy function in order to clear all message data attached to the thread A typical initialization/destruction in a the service method of a HttpServlet : protected void service(HttpHttpServletResponse response) {
MessageManager.initialize();
try {
...
} finally {
MessageManager.destroy();
...
}
}
A typical use anywhere in treatments :
if ([test of functionnal information is not ok]) {
MessageMessager.addError(bundle.getMessage("err.label", params));
}
User: Yohann Chastagnier
Date: 07/11/13
Constructor Summary | |
---|---|
MessageManager()
|
Method Summary | |
---|---|
static Message |
addError(String message)
Add an error message. |
protected static Message |
addError(String registredKey,
String message)
Add an error message. |
static Message |
addInfo(String message)
Add an info message. |
protected static Message |
addInfo(String registredKey,
String message)
Add an info message. |
static void |
addListener(MessageListener listener)
Adding a message listener |
protected static void |
addListener(String registredKey,
MessageListener listener)
Adding a message listener |
static Message |
addSevere(String message)
Add an severe message. |
protected static Message |
addSevere(String registredKey,
String message)
Add an severe message. |
static Message |
addSuccess(String message)
Add a success message. |
protected static Message |
addSuccess(String registredKey,
String message)
Add a success message. |
static Message |
addWarning(String message)
Add an warning message. |
protected static Message |
addWarning(String registredKey,
String message)
Add an warning message. |
static void |
clear(String registredKey)
Remove out of the cache the message container referenced by the given key |
static void |
destroy()
Clear out the thread cache the registred key referenced. |
static String |
getLanguage()
Getting language |
protected static String |
getLanguage(String registredKey)
Getting language |
static MessageContainer |
getMessageContainer(String registredKey)
Gets the message container. |
static String |
getRegistredKey()
Get the key that permits to get the MessageContainer registred for the thread. |
static ResourceLocator |
getResourceLocator(String propertyFileBaseName)
Gets the resource locator from the given property file and by taking into account of the current known language. |
protected static ResourceLocator |
getResourceLocator(String registredKey,
String propertyFileBaseName,
String language)
Gets the resource locator from the given property file and given language. |
static String |
initialize()
Initialize the manager in order to be used everywhere in treatments. |
static void |
setLanguage(String language)
Setting a language |
protected static void |
setLanguage(String registredKey,
String language)
Setting a language |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageManager()
Method Detail |
---|
public static String initialize()
public static void destroy()
public static void addListener(MessageListener listener)
listener
- protected static void addListener(String registredKey, MessageListener listener)
listener
- public static void setLanguage(String language)
language
- public static String getLanguage()
protected static void setLanguage(String registredKey, String language)
language
- protected static String getLanguage(String registredKey)
public static void clear(String registredKey)
public static String getRegistredKey()
public static ResourceLocator getResourceLocator(String propertyFileBaseName)
propertyFileBaseName
-
protected static ResourceLocator getResourceLocator(String registredKey, String propertyFileBaseName, String language)
propertyFileBaseName
- language
-
public static MessageContainer getMessageContainer(String registredKey)
public static Message addError(String message)
message
-
protected static Message addError(String registredKey, String message)
message
-
public static Message addSevere(String message)
message
-
protected static Message addSevere(String registredKey, String message)
message
-
public static Message addWarning(String message)
message
-
protected static Message addWarning(String registredKey, String message)
message
-
public static Message addSuccess(String message)
message
-
protected static Message addSuccess(String registredKey, String message)
message
-
public static Message addInfo(String message)
message
-
protected static Message addInfo(String registredKey, String message)
message
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |