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 TypeMethodDescriptionint
Implements default sort ordering by comparing the creation dates.int
Returns the author of this message.getBody()
Returns the message body.boolean
Returns 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.int
Get the message thread ID.void
setAuthorID
(int id) Updates the author of this Message.void
Updates this message's content.void
setContentWarning
(boolean isWarn) Toggles the content warning flag for this message.void
setCreatedOn
(Instant dt) Updates the date/time the message was written.void
setRemoteAddr
(String addr) Updates the IP address from where this message was posted.void
setRemoteHost
(String hostName) Updates the host name from where this message was posted.void
setThreadID
(int id) Updates the thread ID of this message.Methods inherited from class org.deltava.beans.DatabaseBean
cacheKey, equals, getHexID, getID, hashCode, setID, validateID, validateID
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.deltava.beans.RemoteAddressBean
getIsResolved
-
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:
getAuthorID
in interfaceAuthoredBean
- Returns:
- the database ID of the Pilot object for this message's author.
- See Also:
-
getBody
-
getRemoteAddr
Description copied from interface:RemoteAddressBean
Returns the remote IP address.- Specified by:
getRemoteAddr
in interfaceRemoteAddressBean
- Returns:
- an IPv4 or IPv6 address
-
getRemoteHost
Description copied from interface:RemoteAddressBean
Returns the remote host name.- Specified by:
getRemoteHost
in 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:
setAuthorID
in 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:
compareTo
in interfaceComparable<Object>
- Overrides:
compareTo
in classDatabaseBean
- Throws:
ClassCastException
- if o2 isn't a Message- See Also:
-