public class CSForumMessage extends CSFormatItem
A Forum contains threads, which in turn contain messages.
This class is used to read details of a message from the database, write details of a new message to the database, or modify details of an existing message.
The setXXX(...)
methods are used to set message details before a database get()
or
update()
is performed. getXXX()
methods are then used to access details of the message.
CSForum
,
CSForumThread
,
Serialized FormACCESS_GRANTED, DOES_NOT_EXIST, EMPTY, EXISTS, SECURE_ACCESS_DENIED, SECURE_ACCESS_GRANTED, UPDATE_ACTION_INSERTED, UPDATE_ACTION_UPDATED
LEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSForumMessage()
Create a new
CSForumMessage . |
CSForumMessage(java.lang.String strPropertyFile)
Create a new
CSForumMessage . |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes a message, and any child messages, from the database.
|
void |
get()
Retrieve the details of a Message from the database.
|
java.lang.String |
getBody()
Get the body text of this message.
|
int |
getLevel()
Get the level at which this message is nested.
|
int |
getMessageID()
Get the ID of this message.
|
int |
getParentID()
Get the ID of this message's parent.
|
java.util.Date |
getPosted()
Get the date that this message was posted.
|
java.lang.String |
getSubject()
Get the subject of this message.
|
int |
getThreadID()
Get the thread which this message is in.
|
java.lang.String |
getUsername()
Get the name of the user who submitted this message.
|
void |
setBody(java.lang.String strBody)
Set the body text of this message.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setLevel(int nLevel)
Set the level at which this message is nested.
|
void |
setMessageID(int nMessageID)
Set the ID of this message.
|
void |
setParentID(int nParentID)
Set the parent ID of this message.
|
void |
setPosted(java.util.Date Posted)
Set the date that this message was posted.
|
void |
setSubject(java.lang.String strSubject)
Set the subject of this message.
|
void |
setThreadID(int nThreadID)
Set the thread which this message is in.
|
void |
setUsername(java.lang.String strUsername)
Set the name of the user who submitted this message.
|
void |
update()
Updates a message on the database.
|
getCensorString, getEmoticonDirectory, getEmoticonHeight, getEmoticonWidth, getFilterSwearWords, getReplaceEmoticons, getStripTags, setCensorString, setEmoticonDirectory, setEmoticonHeight, setEmoticonWidth, setFilterSwearWords, setReplaceEmoticons, setStripTags, toString
equals, exist, getID, getStatus, hashCode, jsonString, serialiseWithTypes, setID, setStatus, unset
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSForumMessage()
CSForumMessage
. Datasource is not specified.public CSForumMessage(java.lang.String strPropertyFile)
CSForumMessage
. Database properties are specified in a file.
strPropertyFile
- the name of the property file from which the database connection details are to be read.public void setMessageID(int nMessageID)
update
then a new
message is added to the database, otherwise the specified message is updated.
nMessageID
- the unique numeric ID of this message.public int getMessageID()
public void setParentID(int nParentID)
0
otherwise their
parent ID is set as the unique ID of their parent message.
nParentID
- Message ID of the parent message, 0
for messages at root level.public int getParentID()
public void setThreadID(int nThreadID)
nThreadID
- the unique numeric ID of the thread which contains this message.public int getThreadID()
public void setUsername(java.lang.String strUsername)
strUsername
- name of the user.public java.lang.String getUsername()
String
containing the name of the user.public void setSubject(java.lang.String strSubject)
strSubject
- the subject line of this message.public java.lang.String getSubject()
public void setPosted(java.util.Date Posted)
Posted
- a Date
object representing the time and date on which this message was posted.public java.util.Date getPosted()
Date
object representing the time and date on which this message was posted.public void setBody(java.lang.String strBody)
strBody
- the text of the message.public java.lang.String getBody()
public void setLevel(int nLevel)
nLevel
- the number of ancestors that this message has.public int getLevel()
CSForumMessage
was created by CSForumMessages
, otherwise the level is undefined.
public void setDetailLevel(int nDetailLevel) throws CSParameterException
get
method.
Valid detail levels for a messages are :
LEVEL_ID - message ID
LEVEL_DETAIL - parent message ID, thread ID, user name, subject, date posted
LEVEL_ALL - message body text
Each detail level processes the information specified alongside it in addition to the information specified for all detail levels listed above it. The default detail level is LEVEL_ALL.
setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public void get() throws CSException
Use setMessageID
to set the ID of the Message you wish to load, then get
to load the details from the database. This CSForumMessage
object is then populated with the
details of the message, which can be accessed using the getXXX()
methods.
get
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified message cannot be found on the database.CSSecurityException
- if security has been breached.CSException
- the base class for exceptions thrown by this method.public void update() throws CSException
Use update
to store the current contents of this CSForumMessage
object to the
database. If the MessageID has already been set, then that message is modified on the database, otherwise a new
message is added, and its ID becomes available through the getMessageID
method.
It is mandatory to specify
update
is called and, if emoticon replacement has been turned on, then the emoticon
directory must also be specified.
update
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified thread cannot be found on the database.CSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
Use setMessageID
followed by delete
to remove the specified message from the
database.
delete
in class CSItem
CSParameterException
- if an invalid combination of key information has been supplied.CSDatabaseException
- if there are problems accessing the database.CSNotFoundException
- if the specified message cannot be found on the database.CSException
- the base class for exceptions thrown by this method.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.