|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.buildforge.services.common.dbo.DBObject
com.buildforge.services.common.dbo.MessageDBO
public class MessageDBO
Database information describing an internationalized message.
Internationalized messages rely on a Localizer
to perform
the actual rendering of the message. To set which Localizer
should be used, call setLocalizer(Localizer)
.
Nested Class Summary | |
---|---|
static class |
MessageDBO.Severity
Identifies the severity of a message. |
Field Summary | |
---|---|
static java.lang.Class<MessageDBO> |
CLASS
Reference to this class so we can avoid the expensive ".class" construct. |
static java.lang.String[] |
EMPTY
Empty array to substitute when a null argument is provided. |
static java.lang.String |
TYPE_KEY
|
Constructor Summary | |
---|---|
MessageDBO()
|
|
MessageDBO(MessageDBO.Severity severity,
java.lang.String messageKey,
java.lang.String... args)
|
Method Summary | |
---|---|
MessageDBO |
fromArray(java.lang.Object[] data)
Deserialize the database object's settings from a request array. |
java.lang.String[] |
getArgs()
|
java.lang.String |
getDataKey()
|
int |
getIndirectionMask()
|
static Localizer |
getLocalizer()
Gets the implementation that should be used for localizing messages. |
java.lang.String |
getMessageKey()
|
int |
getProcessId()
|
MessageDBO.Severity |
getSeverity()
|
int |
getTimestamp()
|
java.lang.String |
getType()
|
java.lang.String |
getTypeKey()
Retrieve the key that should be used to look up the display name for a data type. |
int |
getUserId()
|
static MessageDBO |
inUse(java.lang.String objectType,
java.lang.String objectName,
java.lang.String referencingType,
java.lang.String referencingName)
|
static MessageDBO |
inUse(java.lang.String objectType,
java.lang.String objectName,
java.lang.String referencingType,
java.lang.String referencingName,
java.lang.String parentType,
java.lang.String parentName)
|
boolean |
isLive()
Checks whether or not the object is live. |
static MessageDBO |
message(int indirectionMask,
java.lang.String key,
java.lang.String... args)
|
static void |
sanityCheckProcessId(int processId)
|
static void |
sanityCheckUserId(int userId)
|
void |
setArgs(java.util.List<java.lang.String> args)
|
void |
setArgs(java.lang.String[] args)
|
void |
setDataKey(java.lang.String dataKey)
|
void |
setIndirect(int bit)
|
void |
setIndirectionMask(int mask)
|
static void |
setLocalizer(Localizer localizer)
Sets the implementation that should be used for localizing messages. |
void |
setMessageKey(java.lang.String messageKey)
|
void |
setProcessId(int processId)
|
void |
setSeverity(MessageDBO.Severity severity)
|
void |
setTimestamp()
|
void |
setTimestamp(int timestamp)
|
void |
setType(java.lang.String type)
|
void |
setUserId(int userId)
|
java.lang.Object[] |
toArray()
Serializes this database object as an array of objects. |
java.lang.String |
toString()
Renders the information contained by this internationalized message. |
java.lang.String |
translate()
Requests a translated rendering of this message, using the current localizer. |
Methods inherited from class com.buildforge.services.common.dbo.DBObject |
---|
badId, badName, checkDead, checkLive, collision, collision |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TYPE_KEY
public static final java.lang.Class<MessageDBO> CLASS
public static final java.lang.String[] EMPTY
Constructor Detail |
---|
public MessageDBO()
public MessageDBO(MessageDBO.Severity severity, java.lang.String messageKey, java.lang.String... args)
Method Detail |
---|
public java.lang.String getTypeKey()
DBObject
getTypeKey
in class DBObject
public boolean isLive()
DBObject
isLive
in class DBObject
public static Localizer getLocalizer()
public static void setLocalizer(Localizer localizer)
localizer
- the Localizer to use for rendering translated
messages, or null to use Localizer.Generic
.public java.lang.String[] getArgs()
public java.lang.String getDataKey()
public int getIndirectionMask()
public java.lang.String getMessageKey()
public int getProcessId()
public MessageDBO.Severity getSeverity()
public int getTimestamp()
public java.lang.String getType()
public int getUserId()
public java.lang.String translate()
public void setArgs(java.lang.String[] args)
public void setArgs(java.util.List<java.lang.String> args)
public void setDataKey(java.lang.String dataKey)
public void setIndirect(int bit)
public void setIndirectionMask(int mask)
public void setMessageKey(java.lang.String messageKey)
public void setProcessId(int processId)
public void setSeverity(MessageDBO.Severity severity)
public void setTimestamp(int timestamp)
public void setTimestamp()
public void setType(java.lang.String type)
public void setUserId(int userId)
public static void sanityCheckUserId(int userId) throws APIException
APIException
public static void sanityCheckProcessId(int processId) throws APIException
APIException
public java.lang.String toString()
For example, an error report that an invalid project ID was specified
might render as:
Message[timestamp=1177384261, userId=42, processId=0, severity=ERROR,
type=, messageKey=GenericInvalid, args={Project|ID},
indirectionMask=3, dataKey=null]
Clearly, this is not the ideal way to render the message for an end user. The TextFormatter class in the server and the APIClientConnection class in the client both implement the localizer interface, which may be used to render the message for a given locale.
toString
in class java.lang.Object
public MessageDBO fromArray(java.lang.Object[] data) throws APIException
DBObject
DBObject.toArray()
.
fromArray
in class DBObject
data
- the object list that renders this object
APIException
- if there is something wrong with the
serialized data that interferes with the reconstruction of
the object. The most obvious reason for this would be if
the serialized array contains the wrong number of fields
or otherwise does not match the serialized form for this
type of database object.public java.lang.Object[] toArray()
DBObject
Protocol
, all supported
protocols transfer database objects in this form.
toArray
in class DBObject
public static MessageDBO inUse(java.lang.String objectType, java.lang.String objectName, java.lang.String referencingType, java.lang.String referencingName, java.lang.String parentType, java.lang.String parentName)
public static MessageDBO inUse(java.lang.String objectType, java.lang.String objectName, java.lang.String referencingType, java.lang.String referencingName)
public static MessageDBO message(int indirectionMask, java.lang.String key, java.lang.String... args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |