|
Jive Forums API (5.5.20.2-oracle) 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 Forum
public java.lang.String getName()
Forum
getName
in interface Forum
public void setName(java.lang.String name)
Forum
setName
in interface Forum
name
- the name of the forum.public java.lang.String getNNTPName()
Forum
NNTP names must follow certain rules. In particular:
getNNTPName
in interface Forum
public void setNNTPName(java.lang.String nntpName) throws NameAlreadyExistsException
Forum
NNTP names must follow certain rules. Therefore, any name passed into this method will automatically converted based on the following rules:
setNNTPName
in interface Forum
nntpName
- the NNTP name of the forum.
NameAlreadyExistsException
- if attempting to use an existing NNTP name.public java.lang.String getDescription()
Forum
getDescription
in interface Forum
public void setDescription(java.lang.String description)
Forum
setDescription
in interface Forum
description
- the description of the forum.public java.util.Date getCreationDate()
Forum
getCreationDate
in interface Forum
public void setCreationDate(java.util.Date creationDate)
Forum
setCreationDate
in interface Forum
creationDate
- the date the forum was created.public java.util.Date getModificationDate()
Forum
getModificationDate
in interface Forum
public void setModificationDate(java.util.Date modificationDate)
Forum
setModificationDate
in interface Forum
modificationDate
- the date the forum was modified.public int getModerationDefaultThreadValue()
Forum
getModerationDefaultThreadValue
in interface Forum
public void setModerationDefaultThreadValue(int value)
Forum
setModerationDefaultThreadValue
in interface Forum
value
- default number of moderation points for threads.public int getModerationDefaultMessageValue()
Forum
getModerationDefaultMessageValue
in interface Forum
public void setModerationDefaultMessageValue(int value)
Forum
setModerationDefaultMessageValue
in interface Forum
value
- default number of moderation points for messages.public int getMinForumIndex()
Forum
getMinForumIndex
in interface Forum
public int getMaxForumIndex()
Forum
getMaxForumIndex
in interface Forum
public java.util.Locale getLocale()
Forum
getLocale
in interface Forum
public void setLocale(java.util.Locale locale) throws UnauthorizedException
Forum
setLocale
in interface Forum
locale
- the locale of this forum.
UnauthorizedException
- if does not have admin permissions.public java.util.Locale getFinalLocale()
Forum
getFinalLocale
in interface Forum
public java.lang.String getProperty(java.lang.String name)
Forum
getProperty
in interface Forum
name
- the name of the property to get.
public java.util.Collection getProperties(java.lang.String parentName)
Forum
getProperties
in interface Forum
parentName
- 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 Forum
name
- 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)
Forum
name
does not exist, this method will do nothing.
deleteProperty
in interface Forum
name
- the name of the property to delete.public java.util.Iterator getPropertyNames()
Forum
getPropertyNames
in interface Forum
public ForumCategory getForumCategory()
Forum
getForumCategory
in interface Forum
public ForumThread createThread(ForumMessage rootMessage)
Forum
Create
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 Forum
rootMessage
- the root message of the thread.
public ForumMessage createMessage()
Forum
Note: 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 Forum
public ForumMessage createMessage(User user)
Forum
Note: 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 Forum
user
- 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 Forum
thread
- 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 Forum
threadID
- 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 Forum
thread
- the thread to delete.public void moveThread(ForumThread thread, Forum otherForum)
Forum
newForum
.The main purpose of this method is to allow admins to move non-topical threads into a more appropriate forum.
moveThread
in interface Forum
thread
- the thread to move to another forum.otherForum
- the forum to move the thread to.public ForumThreadIterator getThreads()
Forum
getThreads
in interface Forum
public ForumThreadIterator getThreads(ResultFilter resultFilter)
Forum
getThreads
in interface Forum
resultFilter
- a ResultFilter object to perform filtering and
sorting with.
public java.util.Iterator getPopularThreads()
Forum
A 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 Forum
public ForumMessageIterator getMessages()
Forum
getMessages
in interface Forum
public ForumMessageIterator getMessages(ResultFilter resultFilter)
Forum
getMessages
in interface Forum
resultFilter
- a ResultFilter object to perform filtering and
sorting with.
public int getThreadCount()
Forum
getThreadCount
in interface Forum
public int getThreadCount(ResultFilter resultFilter)
Forum
getThreadCount
in interface Forum
resultFilter
- a resultFilter to limit the query on.
public int getMessageCount()
Forum
getMessageCount
in interface Forum
public int getMessageCount(ResultFilter resultFilter)
Forum
getMessageCount
in interface Forum
resultFilter
- a resultFilter to limit the query on.
public ForumMessage getLatestMessage()
Forum
ResultFilter
, but this
method offers a simpler, more optimized way to access the data.
getLatestMessage
in interface Forum
public Query createQuery()
Forum
createQuery
in interface Forum
public InterceptorManager getInterceptorManager()
Forum
getInterceptorManager
in interface Forum
public PermissionsManager getPermissionsManager()
Forum
getPermissionsManager
in interface Forum
public ForumRenderManager getRenderManager()
Forum
RenderManager.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 Forum
RenderManager
public Permissions getPermissions(AuthToken authToken)
Forum
getPermissions
in interface Forum
authToken
- the auth token to lookup permissions for.
public boolean isAuthorized(long type)
Forum
A 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 Forum
type
- a permission type.
ForumPermissions
public java.util.Map getTags()
Forum
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.
getTags
in interface Forum
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.public java.util.Map getTags(TagResultFilter resultFilter)
Forum
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.
getTags
in interface Forum
resultFilter
- 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.ExternalizableLite
java.io.IOException
public void writeExternal(java.io.DataOutput out) throws java.io.IOException
writeExternal
in interface com.tangosol.io.ExternalizableLite
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public 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.SQLException
protected 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 |