public class CSForumMessages extends CSItemMultiple
The CSForumMessages
class provides a method, get()
, that retrieves several messages
from the database. This method requires that certain database and key information (Message IDs, for example) be
specified via the set
methods provided, prior to its invocation.
CSForumMessage
,
CSForumMessageContent
,
Serialized FormLEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSForumMessages()
Creates an empty
CSForumMessages object. |
CSForumMessages(java.lang.String strPropertyFile)
Creates an empty
CSForumMessages object. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Not currently implemented for messages.
|
boolean |
exist()
Not currently implemented for
CSForumMessages . |
void |
get()
Retrieves the details of several messages from the database.
|
java.lang.String |
getMessageList()
Get the list of messages to retrieve.
|
int |
getParentID()
Get the ID of the message whose children will be retrieved.
|
boolean |
getRecurseMode()
Find out if recursive mode is turned on.
|
int |
getThreadID()
Get the ID of the thread from which messages will be retrieved.
|
java.lang.String |
getThreadList()
Gets the list of thread IDs whose messages are to be retrieved.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setMessageList(java.lang.String strMessageList)
Set the list of messages to retrieve.
|
void |
setParentID(int nParentID)
Set the parent message ID.
|
void |
setRecurseMode(boolean bRecurse)
Turn on/off recursive mode.
|
void |
setSortOrder(java.lang.String strSortOrderList)
Set the order in which messages will be retrieved.
|
void |
setThreadID(int nThreadID)
Set the ID of the thread from which messages will be retrieved.
|
void |
setThreadList(java.lang.String strThreadList)
Sets the list of thread IDs whose messages are to be retrieved.
|
java.lang.String |
toString()
Output the contents of this
CSForumMessages object to a String object in a
user-friendly format. |
void |
update()
Not currently implemented for messages.
|
equals, getItems, getMaxRows, getSortOrder, getStartRow, iterator, setItems, setMaxRows, setStartRow
clearRecordedGatewayMessages, clone, count, getCache, getCachingEnabled, getDatabaseVersion, getDatabaseVersion, getDebugOutput, getDetailLevel, getPreview, getPropertyFile, getPropertyFileExtension, getPropertyFilePathname, getRecordedGatewayMessages, getRecordGatewayMessages, getSendGatewayMessages, getUseCache, setDebugOutput, setPreview, setPropertyFile, setRecordGatewayMessages, setSendGatewayMessages, setUseCache
public CSForumMessages()
CSForumMessages
object.
Use the various set
methods to initialise the CSForumMessages
object prior to
invoking get
.
public CSForumMessages(java.lang.String strPropertyFile)
CSForumMessages
object. Database details are specified in a database properties
file.
Use the various set
methods to initialise the CSForumMessages
object prior to
invoking get
.
strPropertyFile
- the name of the property file from which the database connection details are to be read.public void setThreadID(int nThreadID)
In iterative mode messages are specified by a thread ID and a parent message ID, or by a list of message IDs.
In recursive mode, just a thread ID is specified, and all messages in that thread are retrieved.
nThreadID
- the unique numeric ID of the thread.public int getThreadID()
public void setThreadList(java.lang.String strThreadList)
strThreadList
- A comma-separated list of thread IDs.public java.lang.String getThreadList()
public void setParentID(int nParentID)
get
function. In iterative mode thread ID should be specified if message parent ID is.
nParentID
- unique numeric ID of the parent message.public int getParentID()
public void setMessageList(java.lang.String strMessageList)
strMessageList
- a String
containing a comma-separated list of message IDs to be retrieved.public java.lang.String getMessageList()
String
containing a comma-separated list of messages IDs to be retrieved.public void setRecurseMode(boolean bRecurse)
get
will retrieve every message in the thread. In a recursive get
,
messages will be ordered so that child messages follow their parents, and message level will be set to the number
of ancestors that each message has.
bRecurse
- true
to turn on recursive mode, false
to turn it off.public boolean getRecurseMode()
true
if recursive mode is turned on, false
otherwise.public void setSortOrder(java.lang.String strSortOrderList) throws CSParameterException
This method should not be used if the setMessageList
information is being
supplied, or in recursive mode. In these instances the fora are retrieved in the same order as the supplied
IDs/Names, or in parent/child order. Otherwise, one or more of the available sort orders may be specified as a
comma-delimited list. Use ASC or DESC to indicate the direction of ordering for a sort order. For example,
"POSTED DESC" would order in descending posted-date order. ASC is assumed if neither ASC or DESC are specified.
Available sort orders are :
MESSAGEID
- message ID
POSTED
- message-posted date
USERNAME
- message username (author)
SUBJECT
- message subject line
setSortOrder
in class CSItemMultiple
strSortOrderList
- a comma-separated list of one or more of the available sort orders.CSParameterException
- if an invalid sort order was specifiedpublic 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 boolean exist() throws CSException
CSForumMessages
.
exist
in class CSItemMultiple
true
if all messages exist on the databaseCSParameterException
- if an invalid combination of key information has been suppliedCSDatabaseException
- if there are problems accessing the databaseCSException
- the base class for exceptions thrown by this method.public void get() throws CSException
Use setThreadID
followed by get
to populate this
CSForumMessages
object with the details of all messages within the specified thread.
Use setThreadList
followed by get
to populate this
CSForumMessages
object with the details of all messages within the specified threads.
The amount of message information retrieved is dependant on the DetailLevel
setting.
Each retrieved message will be stored as a CSForumMessage
object within the item ArrayList
member of CSForumMessages
- use getItems
or iterator
to
access/navigate through them. By default, the messages will be stored in the ArrayList
in
ascending date order but this may be overridden by choosing an appropriate
SortOrder
setting.
get
in class CSItemMultiple
CSParameterException
- if an invalid combination of key information has been suppliedCSDatabaseException
- if there are problems accessing the databaseCSNotFoundException
- if a requested value cannot be found on the databaseCSSecurityException
- if security has been breachedCSException
- the base class for exceptions thrown by this method.public void update() throws CSException
update
in class CSItemMultiple
CSParameterException
- if an invalid combination of key information has been suppliedCSDatabaseException
- if there are problems accessing the databaseCSNotFoundException
- if one of the specified messages cannot be found on the databaseCSException
- the base class for exceptions thrown by this method.public void delete() throws CSException
delete
in class CSItemMultiple
CSParameterException
- if an invalid combination of key information has been suppliedCSDatabaseException
- if there are problems accessing the databaseCSNotFoundException
- if one of the specified messages cannot be found on the databaseCSException
- the base class for exceptions thrown by this method.public java.lang.String toString()
CSForumMessages
object to a String
object in a
user-friendly format.
toString
in class CSItemMultiple
String
containing the user-friendly output.Copyright © 2022 Goss Interactive Ltd. All Rights Reserved.