Class Message
java.lang.Object
org.deltava.beans.DatabaseBean
org.deltava.beans.cooler.Message
- All Implemented Interfaces:
Serializable, Comparable<Object>, AuthoredBean, IDBean, RemoteAddressBean, Cacheable
- Direct Known Subclasses:
GetCoolerChannels.LastPostMessage
A class to store Water Cooler posts.
- Since:
- 1.0
- Version:
- 10.2
- Author:
- Luke
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintImplements default sort ordering by comparing the creation dates.intReturns the author of this message.getBody()Returns the message body.booleanReturns whether this message contains questionable content.Returns the date and time this post was written.Returns the remote IP address.Returns the remote host name.intGet the message thread ID.voidsetAuthorID(int id) Updates the author of this Message.voidUpdates this message's content.voidsetContentWarning(boolean isWarn) Toggles the content warning flag for this message.voidsetCreatedOn(Instant dt) Updates the date/time the message was written.voidsetRemoteAddr(String addr) Updates the IP address from where this message was posted.voidsetRemoteHost(String hostName) Updates the host name from where this message was posted.voidsetThreadID(int id) Updates the thread ID of this message.Methods inherited from class DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateIDModifier and TypeMethodDescriptioncacheKey()Returns the cache key for this object.booleangetHexID()Returns the hexadecimal database ID of this object.intgetID()Returns the database ID of this object.inthashCode()voidsetID(int id) Update the database row ID of this bean.static voidvalidateID(int oldID, int newID) Validates a database ID.static voidvalidateID(int oldID, int newID, boolean allowZero) Validates a database ID.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RemoteAddressBean
getIsResolvedModifier and TypeMethodDescriptiondefault booleanReturns if the host name has been resolved.
-
Constructor Details
-
Message
public Message(int authorID) Create a new message object from a particular author.- Parameters:
authorID- the database ID for the author- Throws:
IllegalArgumentException- if authorID is zero or negative- See Also:
-
-
Method Details
-
getThreadID
public int getThreadID()Get the message thread ID. This is typically called by a DAO- Returns:
- the entry corresponding to the primary key in the COOLER_THREADS table in the database.
- See Also:
-
getCreatedOn
Returns the date and time this post was written.- Returns:
- the date/time this post was written
- See Also:
-
getAuthorID
public int getAuthorID()Returns the author of this message.- Specified by:
getAuthorIDin interfaceAuthoredBean- Returns:
- the database ID of the Pilot object for this message's author.
- See Also:
-
getBody
-
getRemoteAddr
Description copied from interface:RemoteAddressBeanReturns the remote IP address.- Specified by:
getRemoteAddrin interfaceRemoteAddressBean- Returns:
- an IPv4 or IPv6 address
-
getRemoteHost
Description copied from interface:RemoteAddressBeanReturns the remote host name.- Specified by:
getRemoteHostin interfaceRemoteAddressBean- Returns:
- the host name, or address if unresolved
-
getContentWarning
public boolean getContentWarning()Returns whether this message contains questionable content.- Returns:
- TRUE if there is questionable content, otherwise FALSE
- See Also:
-
setCreatedOn
Updates the date/time the message was written.- Parameters:
dt- the date invalid input: '&' time this message was created- See Also:
-
setBody
Updates this message's content.- Parameters:
body- the new content of the message
-
setThreadID
public void setThreadID(int id) Updates the thread ID of this message. This is typically called by a DAO- Parameters:
id- the entry corresponding to the primary key in the COOLER_THREADS table in the database.- Throws:
IllegalArgumentException- if id is zero or negative- See Also:
-
setRemoteAddr
Updates the IP address from where this message was posted.- Parameters:
addr- the IP address- See Also:
-
setRemoteHost
Updates the host name from where this message was posted.- Parameters:
hostName- the host name- See Also:
-
setContentWarning
public void setContentWarning(boolean isWarn) Toggles the content warning flag for this message.- Parameters:
isWarn- TRUE if the message contains questionable content, otherwise FALSE- See Also:
-
setAuthorID
public void setAuthorID(int id) Updates the author of this Message.- Specified by:
setAuthorIDin interfaceAuthoredBean- Parameters:
id- the author's database ID- Throws:
IllegalArgumentException- if id is zero or negative- See Also:
-
compareTo
Implements default sort ordering by comparing the creation dates.- Specified by:
compareToin interfaceComparable<Object>- Overrides:
compareToin classDatabaseBean- Throws:
ClassCastException- if o2 isn't a Message- See Also:
-