public class CSForumThreads extends CSItemMultiple
The CSForumThreads
class provides a method, get()
, that retrieves several threads from
the database. This method requires that certain database and key information (Forum IDs, for example) be specified
via the set
methods provided, prior to its invocation.
CSForumThread
,
CSForumThreadContent
,
Serialized FormLEVEL_ALL, LEVEL_ALL_PLUS_RELATED, LEVEL_DETAIL, LEVEL_ID, LEVEL_SUMMARY
Constructor and Description |
---|
CSForumThreads()
Creates an empty
CSForumThreads object. |
CSForumThreads(java.lang.String strPropertyFile)
Creates an empty
CSForumThreads object. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Not currently implemented for a threads.
|
boolean |
exist()
Not currently implemented for
CSForumThreads . |
void |
get()
Retrieves the details of several threads from the database.
|
int |
getAge()
Get the maximum message age.
|
java.lang.String |
getFilter()
Get the thread name filter.
|
int |
getForumID()
Get the ID of the forum from which threads will be retrieved.
|
java.lang.String |
getThreadList()
Get the list of threads to retrieve.
|
boolean |
getTolerateNotFound()
Gets the flag that indicates whether a 'not found' exception is suppressed when a requested thread cannot be
found.
|
void |
setAge(int nAge)
Set the maximum message age.
|
void |
setDetailLevel(int nDetailLevel)
Sets the level of detail to be handled by the
get method. |
void |
setFilter(java.lang.String strFilter)
Specifies the thread name filter to be used.
|
void |
setForumID(int nForumID)
Set the ID of the forum from which threads will be retrieved.
|
void |
setSortOrder(java.lang.String strSortOrderList)
Set the order in which threads will be retrieved.
|
void |
setThreadList(java.lang.String strList)
Set the list of threads to retrieve.
|
void |
setTolerateNotFound(boolean bTolerateNotFound)
Sets a flag to prevent a 'not found' exception from being generated when a requested thread cannot be found.
|
java.lang.String |
toString()
Output the contents of this
CSForumThreads object to a String object in a
user-friendly format. |
void |
update()
Not currently implemented for a threads.
|
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 CSForumThreads(java.lang.String strPropertyFile)
CSForumThreads
object. Database details are specified in a database properties
file.
Use the various set
methods to initialise the CSForumThreads
object prior to
invoking the get
method.
strPropertyFile
- the name of the property file from which the database connection details are to be read.public CSForumThreads()
CSForumThreads
object.
Use the various set
methods to initialise the CSForumThreads
object prior to
invoking the get
method.
public void setForumID(int nForumID)
nForumID
- unique numeric ID of the Forum.public int getForumID()
public void setThreadList(java.lang.String strList)
strList
- a String
containing a comma seperated list of Thread IDs.public java.lang.String getThreadList()
String
containing a comma seperated list of Thread IDs.public void setFilter(java.lang.String strFilter)
If a filter is specified and no % is included in the filter, % is placed at the beginning and end so that any thread whose name is found to CONTAIN the specified text will be retrieved.
setFilter
followed by get
will result in this CSForumMessages
object
being populated with the details of all threads whose name matches the filter specified. Each thread will be
stored as a CSForumThread
object within the item ArrayList
member - use
getItems
or iterator
to access/navigate through the polls.
strFilter
- the thread name filter.public java.lang.String getFilter()
public void setAge(int nAge)
Age
is 365 days. Set the Age
to zero to retrieve
Threads with no messages.
NOTE: If Age
is used in conjunction with setThreadList
, an
exception will be thrown if one or more of the requested threads has no messages dated within the specified
interval.
nAge
- the maximum acceptable age in days, of the most recent message.public int getAge()
public void setTolerateNotFound(boolean bTolerateNotFound)
If this flag is set, any threads not found will be included in the list of returned items but with 'nulled' content.
bTolerateNotFound
- The flag indicating if missing threads should be included in the returned set.public boolean getTolerateNotFound()
If this flag is set, any threads not found will be included in the set of returned items but with 'nulled' content.
public void setSortOrder(java.lang.String strSortOrderList) throws CSParameterException
This method should not be used if the setThreadList
information is being supplied.
In this case the messages are retrieved in the same order as the supplied IDs.
Otherwise, for a detail level of LEVEL_ALL
, 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. The
default sort order is LASTMSGDATE DESC
. For any other detail level, a sort order of
NAME ASC
will be used and any sort order specified via this method will be ignored.
Available sort orders are :
FORUMID
- forum ID
THREADID
- thread ID
NAME
- thread name
LASTMSGDATE
- date of most recent message
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 thread are :
LEVEL_ID
- returns the thread ID
LEVEL_SUMMARY
- returns the thread ID, thread name and forum ID
LEVEL_ALL
- returns the thread ID, thread name, forum ID, message count and date of last
message
The default detail level is LEVEL_SUMMARY
.
setDetailLevel
in class CSDatabaseItem
nDetailLevel
- the detail level to be used.CSParameterException
- if an invalid detail level is specified.public boolean exist() throws CSException
CSForumThreads
.
exist
in class CSItemMultiple
true
if all threads 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 setForumID
followed by get
to populate this
CSForumThreads
object with the details of all threads within the specified forum.
Use setSortOrder
to control the ordering of the retrieved threads.
Use setThreadList
followed by get
to populate this
CSForumThreads
object with details of the listed threads.
Use setAge
followed by get
to retrieve threads containing messages younger
than a specified age.
Use setFilter
followed by get
to populate this
CSForumThreads
object with the details of all threads whose name matches the supplied filter.
Each retrieved thread will be stored as a CSForumThread
object within the item ArrayList
member of CSForumThreads
- use getItems
or iterator
to
access/navigate through them. By default, the threads will be stored in the ArrayList
in
descending last message date order with a DetailLevel
setting of LEVEL_ALL
or in
ascending thread name order for all other DetailLevel
settings.
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 thread 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 thread 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 thread cannot be found on the databaseCSException
- the base class for exceptions thrown by this method.public java.lang.String toString()
CSForumThreads
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.