|
Jive Forums API (5.5.8) Developer Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jivesoftware.forum.database.DbForum
public class DbForum
Database implementation of the Forum interface. It loads and stores forum information from a a database.
| Field Summary | |
|---|---|
static boolean |
ENABLE_DATE_UPDATES
|
| Constructor Summary | |
|---|---|
|
DbForum()
Constructor for internal use only. |
protected |
DbForum(long id)
Loads a forum with the specified id. |
protected |
DbForum(java.lang.String nntpName)
Loads a forum with the specified id. |
protected |
DbForum(java.lang.String name,
java.lang.String description,
ForumCategory category)
Creates a new forum with the specified name and description. |
| Method Summary | |
|---|---|
void |
addThread(ForumThread thread)
Adds a new thread to the forum. |
protected void |
clearCache()
Clears caches related to the object. |
static java.lang.String |
convertToNNTP(java.lang.String forumName,
ForumCategory category)
Returns the NNTP name of a forum. |
ForumMessage |
createMessage()
Factory method to create a message with an anonymous author. |
ForumMessage |
createMessage(User user)
Factory method to create a message as the specified user. |
Query |
createQuery()
Creates a query object to search the forum. |
ForumThread |
createThread(ForumMessage rootMessage)
Factory method to create a new thread. |
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
void |
deleteThread(ForumThread thread)
Deletes a thread and all of its messages. |
boolean |
equals(java.lang.Object object)
|
protected void |
fireModificationEvent()
|
protected long[] |
getAllThreads()
Returns an array of all the thread id's in the forum. |
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
java.util.Date |
getCreationDate()
Returns the Date that the forum was created. |
java.lang.String |
getDescription()
Returns the description of the forum. |
java.util.Locale |
getFinalLocale()
Returns the locale for this forum. |
ForumCategory |
getForumCategory()
Returns the forum category that this forum belongs to. |
long |
getID()
Returns the unique id of the forum. |
InterceptorManager |
getInterceptorManager()
Returns an interceptor manager that can be used to manage the interceptors for this forum. |
ForumMessage |
getLatestMessage()
Returns the most recently created or edited message in this forum. |
java.util.Locale |
getLocale()
Returns the locale for this forum. |
int |
getMaxForumIndex()
Returns the largest forum index value for a message in the forum. |
int |
getMessageCount()
Returns the number of messages in the forum. |
int |
getMessageCount(ResultFilter resultFilter)
Returns the number of messages in the forum based on the specified ResultFilter. |
protected CachedPreparedStatement |
getMessageListSQL(ResultFilter resultFilter,
boolean countQuery)
Returns the SQL statement corresponding to a ResultFilter for messages. |
ForumMessageIterator |
getMessages()
Returns an Iterator for all the messages in the forum. |
ForumMessageIterator |
getMessages(ResultFilter resultFilter)
Returns a Iterator for all the messages in the forum that match the criteria specified by the ResultFilter. |
int |
getMinForumIndex()
Returns the smallest forum index value for a message in the forum. |
int |
getModerationDefaultMessageValue()
Returns the default number of moderation points for messages created in the forum. |
int |
getModerationDefaultThreadValue()
Returns the default number of moderation points for threads created in the forum. |
java.util.Date |
getModificationDate()
Returns the Date that the forum was last modified. |
java.lang.String |
getName()
Returns the name of the forum. |
java.lang.String |
getNNTPName()
Returns the NNTP name for the forum, which is the name of the forum used in the NNTP protocol (newsgroups). |
static int |
getObjectType()
|
Permissions |
getPermissions(AuthToken authToken)
Returns the permissions for the forum that correspond to the passed-in AuthToken. |
PermissionsManager |
getPermissionsManager()
Returns a permissions manager that can be used to set permissions for this forum. |
java.util.Iterator |
getPopularThreads()
Returns an Iterator for the most popular threads in the forum. |
java.util.Collection |
getProperties(java.lang.String parentName)
Return all immediate children property values of a parent property as an unmodifiable Collection of String values. |
java.lang.String |
getProperty(java.lang.String name)
Returns an extended property of the forum. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator for the names of the forum properties. |
ForumRenderManager |
getRenderManager()
Returns a render manager that can be used to manage render filters and macros for this forum. |
java.util.Map |
getTags()
Returns all tags for a given forum in a Map where the key is the
name of tag and the value is the number of times the tag has been used in this forum. |
java.util.Map |
getTags(TagResultFilter resultFilter)
Returns all tags for a given forum in a Map where the key is the
name of tag and the value is the number of times the tag has been used in this forum
filtered by the TagResultFilter. |
ForumThread |
getThread(long threadID)
Returns the thread specified by id. |
int |
getThreadCount()
Returns the number of threads in the forum. |
int |
getThreadCount(ResultFilter resultFilter)
Returns the number of threads in the forum based on the specified ResultFilter. |
protected CachedPreparedStatement |
getThreadListSQL(ResultFilter resultFilter,
boolean countQuery)
Returns the SQL statement corresponding to a ResultFilter for threads. |
ForumThreadIterator |
getThreads()
Returns a Iterator for all the threads in the forum. |
ForumThreadIterator |
getThreads(ResultFilter resultFilter)
Returns a Iterator for all the threads in the forum that match the criteria specified by the ResultFilter. |
int |
hashCode()
|
boolean |
isAuthorized(long type)
Returns true if the handle on the object has the permission specified. |
void |
moveThread(ForumThread thread,
Forum otherForum)
Moves a thread from one forum to another. |
void |
readExternal(java.io.DataInput in)
|
void |
setCreationDate(java.util.Date creationDate)
Sets the creation date of the forum. |
void |
setDescription(java.lang.String description)
Sets the description of the forum. |
void |
setLocale(java.util.Locale locale)
Sets the locale for this forum. |
void |
setModerationDefaultMessageValue(int value)
Sets the default number of moderation points for threads created in the forum. |
void |
setModerationDefaultThreadValue(int value)
Sets the default number of moderation points for threads created in the forum. |
void |
setModificationDate(java.util.Date modificationDate)
Sets the date the forum was last modified. |
void |
setName(java.lang.String name)
Sets the name of a the forum. |
void |
setNNTPName(java.lang.String nntpName)
Sets the NNTP name for the forum, which is the name of the forum used in the NNTP protocol (newsgroups). |
void |
setProperties(java.util.Map propertyMap)
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of the forum. |
java.lang.String |
toString()
Returns a String representation of the Forum object using the forum name. |
protected void |
updateModifiedDate(long date,
java.sql.Connection con)
Updates the modified date. |
void |
writeExternal(java.io.DataOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean ENABLE_DATE_UPDATES
| Constructor Detail |
|---|
protected DbForum(java.lang.String name,
java.lang.String description,
ForumCategory category)
name - the name of the forum.description - the description of the forum.category - the ForumCategory the forum is a part of.
protected DbForum(long id)
throws ForumNotFoundException
id - the forum ID.
ForumNotFoundException - if the forum could not be loaded.
protected DbForum(java.lang.String nntpName)
throws ForumNotFoundException
nntpName - the NNTP name of the forum.
ForumNotFoundException - if the forum could not be loaded.public DbForum()
| Method Detail |
|---|
public long getID()
Forum
getID in interface Forumpublic java.lang.String getName()
Forum
getName in interface Forumpublic void setName(java.lang.String name)
Forum
setName in interface Forumname - the name of the forum.public java.lang.String getNNTPName()
ForumNNTP names must follow certain rules. In particular:
getNNTPName in interface Forum
public void setNNTPName(java.lang.String nntpName)
throws NameAlreadyExistsException
ForumNNTP names must follow certain rules. Therefore, any name passed into this method will automatically converted based on the following rules:
setNNTPName in interface ForumnntpName - the NNTP name of the forum.
NameAlreadyExistsException - if attempting to use an existing NNTP name.public java.lang.String getDescription()
Forum
getDescription in interface Forumpublic void setDescription(java.lang.String description)
Forum
setDescription in interface Forumdescription - the description of the forum.public java.util.Date getCreationDate()
Forum
getCreationDate in interface Forumpublic void setCreationDate(java.util.Date creationDate)
Forum
setCreationDate in interface ForumcreationDate - the date the forum was created.public java.util.Date getModificationDate()
Forum
getModificationDate in interface Forumpublic void setModificationDate(java.util.Date modificationDate)
Forum
setModificationDate in interface ForummodificationDate - the date the forum was modified.public int getModerationDefaultThreadValue()
Forum
getModerationDefaultThreadValue in interface Forumpublic void setModerationDefaultThreadValue(int value)
Forum
setModerationDefaultThreadValue in interface Forumvalue - default number of moderation points for threads.public int getModerationDefaultMessageValue()
Forum
getModerationDefaultMessageValue in interface Forumpublic void setModerationDefaultMessageValue(int value)
Forum
setModerationDefaultMessageValue in interface Forumvalue - default number of moderation points for messages.public int getMinForumIndex()
Forum
getMinForumIndex in interface Forumpublic int getMaxForumIndex()
Forum
getMaxForumIndex in interface Forumpublic java.util.Locale getLocale()
Forum
getLocale in interface Forum
public void setLocale(java.util.Locale locale)
throws UnauthorizedException
Forum
setLocale in interface Forumlocale - the locale of this forum.
UnauthorizedException - if does not have admin permissions.public java.util.Locale getFinalLocale()
Forum
getFinalLocale in interface Forumpublic java.lang.String getProperty(java.lang.String name)
Forum
getProperty in interface Forumname - the name of the property to get.
public java.util.Collection getProperties(java.lang.String parentName)
Forum
getProperties in interface ForumparentName - the name of the parent property to return the children for.
public void setProperty(java.lang.String name,
java.lang.String value)
Forum
If the property referenced by name already exists, its
value will be updated.
setProperty in interface Forumname - the name of the property to set.value - the new value for the property.public void setProperties(java.util.Map propertyMap)
public void deleteProperty(java.lang.String name)
Forumname does not exist, this method will do nothing.
deleteProperty in interface Forumname - the name of the property to delete.public java.util.Iterator getPropertyNames()
Forum
getPropertyNames in interface Forumpublic ForumCategory getForumCategory()
Forum
getForumCategory in interface Forumpublic ForumThread createThread(ForumMessage rootMessage)
ForumCreate a new message, and set each of its
fields such as the subject and body.
addThread method.Note: creating the ForumThread object is only one step of the process. You must also add the thread to the forum with the addThread(ForumThread) method before it is saved to the database. It is illegal to create a thread in one forum and then add it to another forum.
createThread in interface ForumrootMessage - the root message of the thread.
public ForumMessage createMessage()
ForumNote: creating the ForumMessage object is only one step of the process. You must also add the message to a thread before it is saved to the database. It is illegal to create a message in one forum and then add it to a thread in another forum.
createMessage in interface Forumpublic ForumMessage createMessage(User user)
ForumNote: creating the ForumMessage object is only one step of the process. You must also add the message to a thread before it is saved to the database. It is illegal to create a message in one forum and then add it to a thread in another forum.
createMessage in interface Forumuser - the author of the message.
public void addThread(ForumThread thread)
throws MessageRejectedException
Forum
Adding an existing thread to a forum is illegal. Instead, the
moveForum method should be used.
addThread in interface Forumthread - the thread to add to the forum.
MessageRejectedException - if one of the installed interceptors prevents the
root message from being posted.
public ForumThread getThread(long threadID)
throws ForumThreadNotFoundException
Forum
getThread in interface ForumthreadID - the id of the thread to get.
threadID
ForumThreadNotFoundException - if the specified thread cannot be
loaded.public void deleteThread(ForumThread thread)
Forum
deleteThread in interface Forumthread - the thread to delete.
public void moveThread(ForumThread thread,
Forum otherForum)
ForumnewForum.The main purpose of this method is to allow admins to move non-topical threads into a more appropriate forum.
moveThread in interface Forumthread - the thread to move to another forum.otherForum - the forum to move the thread to.public ForumThreadIterator getThreads()
Forum
getThreads in interface Forumpublic ForumThreadIterator getThreads(ResultFilter resultFilter)
Forum
getThreads in interface ForumresultFilter - a ResultFilter object to perform filtering and
sorting with.
public java.util.Iterator getPopularThreads()
ForumA number of configurable Jive properties control how the popular threads feature works:
popularThreads.numThreads -- The number of
messages that will be returned in the list of popular threads.
Default is 4 threads.
popularThreads.timeWindow -- The number of hours
to consider new messages in a thread from. Default is 24 hours,
which is suitable for sites with moderate to high amounts of
traffic. Sites with less traffic may wish to set the window
to a number of days.
getPopularThreads in interface Forumpublic ForumMessageIterator getMessages()
Forum
getMessages in interface Forumpublic ForumMessageIterator getMessages(ResultFilter resultFilter)
Forum
getMessages in interface ForumresultFilter - a ResultFilter object to perform filtering and
sorting with.
public int getThreadCount()
Forum
getThreadCount in interface Forumpublic int getThreadCount(ResultFilter resultFilter)
Forum
getThreadCount in interface ForumresultFilter - a resultFilter to limit the query on.
public int getMessageCount()
Forum
getMessageCount in interface Forumpublic int getMessageCount(ResultFilter resultFilter)
Forum
getMessageCount in interface ForumresultFilter - a resultFilter to limit the query on.
public ForumMessage getLatestMessage()
ForumResultFilter, but this
method offers a simpler, more optimized way to access the data.
getLatestMessage in interface Forumpublic Query createQuery()
Forum
createQuery in interface Forumpublic InterceptorManager getInterceptorManager()
Forum
getInterceptorManager in interface Forumpublic PermissionsManager getPermissionsManager()
Forum
getPermissionsManager in interface Forumpublic ForumRenderManager getRenderManager()
ForumRenderManager.render(Object, com.jivesoftware.forum.renderer.RenderType, String) and
RenderManager.render(Object, com.jivesoftware.forum.renderer.RenderType, com.jivesoftware.forum.renderer.RenderStrategy, String)
methods, which may be useful to skin writers.
getRenderManager in interface ForumRenderManagerpublic Permissions getPermissions(AuthToken authToken)
Forum
getPermissions in interface ForumauthToken - the auth token to lookup permissions for.
public boolean isAuthorized(long type)
ForumA list of possible permissions can be found in the ForumPermissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
isAuthorized in interface Forumtype - a permission type.
ForumPermissionspublic java.util.Map getTags()
ForumMap where the key is the
name of tag and the value is the number of times the tag has been used in this forum.
getTags in interface ForumMap where the key is the
name of tag and the value is the number of times the tag has been used in this forum.public java.util.Map getTags(TagResultFilter resultFilter)
ForumMap where the key is the
name of tag and the value is the number of times the tag has been used in this forum
filtered by the TagResultFilter.
getTags in interface ForumresultFilter - the filter to use to restrict tag results
Map where the key is the
name of tag and the value is the number of times the tag has been used in this forum
filtered by the TagResultFilter.public static int getObjectType()
public int getCachedSize()
Cacheable
getCachedSize in interface Cacheable
public void readExternal(java.io.DataInput in)
throws java.io.IOException
readExternal in interface com.tangosol.io.ExternalizableLitejava.io.IOException
public void writeExternal(java.io.DataOutput out)
throws java.io.IOException
writeExternal in interface com.tangosol.io.ExternalizableLitejava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object object)
equals in class java.lang.Object
public static java.lang.String convertToNNTP(java.lang.String forumName,
ForumCategory category)
forumName - the normal name of the forum.category - the category the forum belongs to.
protected void updateModifiedDate(long date,
java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLExceptionprotected long[] getAllThreads()
protected void clearCache()
protected CachedPreparedStatement getThreadListSQL(ResultFilter resultFilter,
boolean countQuery)
protected CachedPreparedStatement getMessageListSQL(ResultFilter resultFilter,
boolean countQuery)
protected void fireModificationEvent()
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||