|
IMC Epclient 5.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.spardat.enterprise.exc.Notification
This is a default implementation of INotification, see INotification.
The constructors expect a message in the form of a java.text.MessageFormat compliant string with optional parameters. Besides providing a message text, a code may be set using setCode(). The code may be used to discriminate different notifications. See below for a recommendation on how to structure the code.
The message must be set in the constructor, additional attributes are set using the set- methods that may be chained, see examples below. If the set methods are not called, the constructed Notification defaults to type T_ERROR with reaction R_OK. The default code is zero, the default short message is the empty string.
An instance of this class cannot be thrown since it is not an exception. If you want to use this class for exceptional purposes, use a subclass of BaseException, either AppException or SysException instead. These classes work much the same and effectively are wrapper around this class.
The following example creates a error notification with code 4711 and one supplied parameter:
new Notification("Limit of {0} exceeded", "123").setCode(4711)
Here is a question where the recipient should be forced to answer with
YES or NO:
new Notification("Limit of {0} exceeded. \nDo u want to proceed?", "123")
.setType (Notification.T_QUESTION)
.setReaction (Notification.R_YES_NO)
| Field Summary |
| Fields inherited from interface at.spardat.enterprise.exc.INotification |
R_ABORT, R_ABORT_RETRY_IGNORE, R_CANCEL, R_IGNORE, R_NO, R_OK, R_OK_CANCEL, R_RETRY, R_RETRY_CANCEL, R_YES, R_YES_NO, R_YES_NO_CANCEL, T_ERROR, T_INFORMATION, T_QUESTION, T_WARNING |
| Constructor Summary | |
Notification(java.lang.String message)
Constructs and sets the message to the provided value. |
|
Notification(java.lang.String message,
java.util.Locale l,
java.lang.Object[] params)
Constructs and sets the message from a format string as defined in java.text.MessageFormat. |
|
Notification(java.lang.String messageFmt,
java.lang.Object param1)
Constructs and sets the message of this from a one parameter java.text.MessageFormat compatible string. |
|
Notification(java.lang.String messageFmt,
java.lang.Object param1,
java.lang.Object param2)
Constructs and sets the message of this from a two parameter java.text.MessageFormat compatible string. |
|
| Method Summary | |
int |
getCode()
Returns the code set. |
java.lang.String |
getMessage()
Returns a fully descriptive text of this notification. |
int |
getReaction()
Returns the permissible user reaction to the notification which is one of the constants starting with R_. |
java.lang.String |
getShortMessage()
Returns a short text explaining this notification. |
int |
getType()
Returns the type of this notification, that is one of the constants with praefix T_. |
Notification |
setCode(int code)
Sets the code. |
Notification |
setMessage(java.lang.String message)
Constructs and sets the message to the provided value. |
Notification |
setMessage(java.lang.String message,
java.util.Locale l,
java.lang.Object[] params)
Sets the message from a format string as defined in java.text.MessageFormat. |
Notification |
setMessage(java.lang.String messageFmt,
java.lang.Object param1)
Sets the message of this from a one parameter java.text.MessageFormat compatible string. |
Notification |
setMessage(java.lang.String messageFmt,
java.lang.Object param1,
java.lang.Object param2)
Sets the message of this from a one parameter java.text.MessageFormat compatible string. |
Notification |
setReaction(int reaction)
Sets one or a bit-or combination of the reaction constants of INotification. |
Notification |
setShortMessage(java.lang.String shortMessage)
Sets the short message. |
Notification |
setType(int type)
Sets the type which may be one of the T_-constants. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Notification(java.lang.String messageFmt,
java.lang.Object param1,
java.lang.Object param2)
messageFmt - format string as defined in java.text.MessageFormat.param1 - first message parameterparam2 - second message parameter
public Notification(java.lang.String messageFmt,
java.lang.Object param1)
messageFmt - format string as defined in java.text.MessageFormat.param1 - message parameterpublic Notification(java.lang.String message)
message - message text.
public Notification(java.lang.String message,
java.util.Locale l,
java.lang.Object[] params)
message - format string as defined in java.text.MessageFormat
or plain text that is not a MessageFormat, depending on paramsl - a java.util.Locale to format locale
dependent data types or null if the
params do not contain local specifics.params - the parameters of the message. If params is null,
message is not subject to MessageFormat-processing. If params
is not null, message must be compliant to
java.text.MessageFormat.| Method Detail |
public Notification setMessage(java.lang.String message,
java.util.Locale l,
java.lang.Object[] params)
message - format string as defined in java.text.MessageFormat
or plain text that is not a MessageFormat, depending on paramsl - a java.util.Locale to format locale
dependent data types or null if the
params do not contain local specifics.params - the parameters of the message. If params is null,
message is not subject to MessageFormat-processing. If params
is not null, message must be compliant to
java.text.MessageFormat.
public Notification setMessage(java.lang.String messageFmt,
java.lang.Object param1,
java.lang.Object param2)
messageFmt - format string as defined in java.text.MessageFormat.param1 - message parameterparam2 - message parameter
public Notification setMessage(java.lang.String messageFmt,
java.lang.Object param1)
messageFmt - format string as defined in java.text.MessageFormat.param1 - message parameter
public Notification setMessage(java.lang.String message)
message - text to set
public Notification setCode(int code)
getCode()public int getCode()
getCode in interface INotificationpublic Notification setReaction(int reaction)
INotification.getReaction()public Notification setShortMessage(java.lang.String shortMessage)
INotification.getShortMessage()public Notification setType(int type)
INotification.getType()public int getType()
INotification
getType in interface INotificationINotification.getType()public int getReaction()
INotification
getReaction in interface INotificationINotification.getReaction()public java.lang.String getShortMessage()
INotification
getShortMessage in interface INotificationINotification.getShortMessage()public java.lang.String getMessage()
INotification
getMessage in interface INotificationINotification.getMessage()
|
IMC Epclient 5.0.3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||