|
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.DbForumCategory
public class DbForumCategory
Database implementation of the ForumCategory interface. The SQL tree structure we use is Joe Celko's. For more information, see: http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci537290,00.html.
The lft and rgt column values are responsible for defining the tree. An example tree with the lft and rgt column values (respectively) is as follows:
(1,12)
/ \
(2,3) (4,11)
/ | \
/ | \
(5,6) (7,8) (9,10)
As you can see from the tree, the lft and rgt values of a child are
always between the values of its parent. We can use this property to
load the entire tree into memory using a single select. The simple way
to determine the lft and rgt values of an arbitrary tree structure is to
label lft then rgt by traversing the tree in depth-first order.
| Field Summary | |
|---|---|
static boolean |
ENABLE_DATE_UPDATES
When true, category modification dates will be updated when new messages are posted. |
protected static java.lang.String |
FIND_FORUM_INDEX
|
protected static java.lang.String |
FORUM_IN_CATEGORY_COUNT
|
protected static java.lang.String |
SELECT_FORUMID_AND_INDEX_1
|
protected static java.lang.String |
SELECT_FORUMID_AND_INDEX_2
|
protected static java.lang.String |
SELECT_RECURSIVE_FORUMID
|
protected static java.lang.String |
SHIFT_CATEGORY_INDEX
|
| Fields inherited from interface com.jivesoftware.forum.ContentRetrieval |
|---|
ALL_TYPES, THREAD |
| Constructor Summary | |
|---|---|
|
DbForumCategory()
Constructor for internal use only. |
|
DbForumCategory(long id)
Loads an existing category. |
protected |
DbForumCategory(long id,
java.sql.Connection con)
|
|
DbForumCategory(java.lang.String name,
java.lang.String description,
DbForumCategory parentCategory)
Creates a new category. |
| Method Summary | |
|---|---|
protected void |
clearCache()
Clears caches related to the object. |
ForumCategory |
createCategory(java.lang.String name,
java.lang.String description)
Creates a new ForumCategory as a sub-category of this category using the name and description. |
void |
deleteCategory(ForumCategory forumCategory)
Deletes a sub-category. |
void |
deleteForum(Forum forum)
Deletes a forum and all of its content. |
void |
deleteForum(Forum forum,
boolean fireEvent)
|
protected void |
deleteFromDb(java.sql.Connection con)
|
void |
deleteProperty(java.lang.String name)
Deletes an extended property. |
boolean |
equals(java.lang.Object object)
|
protected void |
fireModificationEvent()
|
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
java.util.Iterator |
getCategories()
Returns an Iterator for the child categories of this category. |
java.util.Iterator |
getCategories(int startIndex,
int numResults)
Returns an Iterator for the child categories of this category using a start index and the number of results to return. |
int |
getCategoryCount()
Returns the number of sub-categories of this category. |
int |
getCategoryDepth()
Returns the depth of a this category relative to the root. |
static LongTree |
getCategoryTree()
|
java.util.Iterator |
getCombinedContent(long[] types)
Returns an Iterable for all threads, documents, and blog posts in the community, depending on which ContentTypes are supplied as an argument. |
java.util.Iterator |
getCombinedContent(ResultFilter filter,
long[] types)
Returns an Iterable for all threads, documents, and blog posts in the community, depending on which ContentTypes are supplied as an argument, and according the the supplied ResultFilter. |
int |
getCombinedContentCount(long[] contentTypes)
Returns the combined number of threads, documents, and blog posts in the community, depending on which ContentTypes are supplied as an argument. |
int |
getCombinedContentCount(ResultFilter filter,
long[] types)
Returns the combined number of threads, documents, and blog posts in the community, depending on which ContentTypes are supplied as an argument, and restricted by the ResultFilter. |
java.util.Date |
getCreationDate()
Returns the Date that the category was created. |
java.lang.String |
getDescription()
Returns the description of the forum category. |
java.util.Locale |
getFinalLocale()
Returns the locale for this category. |
int |
getForumCount()
Returns the number of forums in the category. |
int |
getForumCount(ResultFilter resultFilter)
Returns the number of forums in the category based on the specified ResultFilter. |
protected CachedPreparedStatement |
getForumListSQL(ResultFilter resultFilter,
boolean countQuery,
boolean recursiveQuery)
Returns the SQL statement corresponding to a ResultFilter for threads. |
java.util.Iterator |
getForums()
Returns an Iterator for all the forums in the category. |
java.util.Iterator |
getForums(ResultFilter resultFilter)
Returns a Iterator for all the forums in the category that match the criteria specified by the ResultFilter. |
long |
getID()
Retrieve the unique identifier for the jive object. |
InterceptorManager |
getInterceptorManager()
Returns a message interceptor manager that can be used to manage interceptors for this category. |
ForumMessage |
getLatestMessage()
Returns the most recently created or edited message in this category (including all sub-categories). |
static int[] |
getLftRgtValues(long categoryID)
Returns the lft and rgt values for a category ID. |
java.util.Locale |
getLocale()
Returns the locale for this category. |
int |
getMessageCount()
Returns the number of messages in the community. |
int |
getMessageCount(ResultFilter resultFilter)
Returns the number of messages in the community based on the specified ResultFilter. |
protected CachedPreparedStatement |
getMessageListSQL(ResultFilter resultFilter,
boolean countQuery)
Returns the SQL statement corresponding to a ResultFilter for messages. |
java.util.Iterator |
getMessages()
Returns an Iterable for all the messages in the community. |
java.util.Iterator |
getMessages(ResultFilter resultFilter)
Returns an Iterable for all the messages in the community that match the criteria specified by the ResultFilter. |
java.util.Date |
getModificationDate()
Returns the Date this category was last modified. |
java.lang.String |
getName()
Returns the name of the category. |
int |
getObjectType()
Return the object type of the jive object. |
ForumCategory |
getParentCategory()
Returns the parent category of this category. |
protected ForumCategory |
getParentCategory(java.sql.Connection con)
|
Permissions |
getPermissions(AuthToken authToken)
Returns the permissions for the category that correspond to the passed-in AuthToken. |
PermissionsManager |
getPermissionsManager()
Returns a permissions manager that can be used to set permissions for this category. |
java.util.Iterator |
getPopularThreads()
Returns an Iterator for the most popular threads in the category. |
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 category. |
java.util.Iterator |
getPropertyNames()
Returns an Iterator for the names of the forum category properties. |
java.util.Iterator |
getRecursiveCategories()
Returns an Iterator for all sub-categories of this category, including sub-categories of sub-categories, etc. |
int |
getRecursiveCategoryCount()
Returns the total count of all sub-categories of this category, including sub-categories of sub-categories, etc. |
int |
getRecursiveForumCount()
Returns the number of forums in the category and all sub-categories. |
int |
getRecursiveForumCount(ResultFilter resultFilter)
Returns the number of forums in the category and all sub-categories based on the specified ResultFilter. |
LongList |
getRecursiveForumIDs()
|
java.util.Iterator |
getRecursiveForums()
Returns an Iterator for all the forums in the category and all sub-categories. |
java.util.Iterator |
getRecursiveForums(ResultFilter resultFilter)
Returns a Iterator for all the forums in the category and sub-categories that match the criteria specified by the ResultFilter. |
ForumRenderManager |
getRenderManager()
Returns a render manager that can be used to manage render filters and macros for this category. |
java.util.Map |
getTags()
Returns all tags for a given community 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 community. |
java.util.Map |
getTags(TagResultFilter resultFilter)
Returns all tags for a given community 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 community
filtered by the TagResultFilter. |
int |
getThreadCount()
Returns the number of threads in the community. |
int |
getThreadCount(ResultFilter resultFilter)
Returns the number of threads in the community based on the specified ResultFilter. |
protected CachedPreparedStatement |
getThreadListSQL(ResultFilter resultFilter,
boolean countQuery)
Returns the SQL statement corresponding to a ResultFilter for threads. |
java.util.Iterator |
getThreads()
Returns an Iterable for all the threads in the community. |
java.util.Iterator |
getThreads(ResultFilter resultFilter)
Returns an Iterable for all the threads in the community 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 |
moveCategory(ForumCategory category,
ForumCategory destinationCategory)
Moves a sub-category to another category. |
void |
moveForum(Forum forum,
ForumCategory destinationCategory)
Moves a forum from this category to another. |
void |
readExternal(java.io.DataInput in)
|
static void |
refreshCategoryTree(boolean startup)
Loads the entire category tree into memory. |
static void |
reset()
|
void |
setCategoryIndex(ForumCategory category,
int newIndex)
Sets the display order of a sub-category. |
void |
setCreationDate(java.util.Date creationDate)
Sets the creation date of the category. |
void |
setDescription(java.lang.String description)
Sets the description of the forum category. |
void |
setForumIndex(Forum forum,
int newIndex)
Sets the index of the forum in the category. |
void |
setLocale(java.util.Locale locale)
Sets the locale for this category. |
void |
setModificationDate(java.util.Date modificationDate)
Sets the date the category was last modified. |
void |
setName(java.lang.String name)
Sets the name of the forum category. |
void |
setProperties(java.util.Map propertyMap)
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets an extended property of the category. |
java.lang.String |
toString()
|
protected void |
updateModifiedDate(long date,
java.sql.Connection con)
Updates the modified date of this category and all parent categories. |
void |
writeExternal(java.io.DataOutput out)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String FIND_FORUM_INDEX
protected static final java.lang.String FORUM_IN_CATEGORY_COUNT
protected static final java.lang.String SELECT_RECURSIVE_FORUMID
protected static final java.lang.String SELECT_FORUMID_AND_INDEX_1
protected static final java.lang.String SELECT_FORUMID_AND_INDEX_2
protected static final java.lang.String SHIFT_CATEGORY_INDEX
public static final boolean ENABLE_DATE_UPDATES
| Constructor Detail |
|---|
public DbForumCategory(long id)
throws ForumCategoryNotFoundException
id - the ID of the category to load.
ForumCategoryNotFoundException - if the category could not be loaded
protected DbForumCategory(long id,
java.sql.Connection con)
throws ForumCategoryNotFoundException
ForumCategoryNotFoundException
public DbForumCategory(java.lang.String name,
java.lang.String description,
DbForumCategory parentCategory)
name - the name of the new category.description - the description of the new categoryparentCategory - the parent category of the new categorypublic DbForumCategory()
| Method Detail |
|---|
public static void reset()
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 long getID()
JiveObject
getID in interface JiveObjectgetID in interface ForumCategorypublic java.lang.String getName()
ForumCategory
getName in interface ForumCategorypublic void setName(java.lang.String name)
ForumCategory
setName in interface ForumCategoryname - the name of the forum category.public java.lang.String getDescription()
ForumCategory
getDescription in interface ForumCategorypublic void setDescription(java.lang.String description)
ForumCategory
setDescription in interface ForumCategorydescription - the description of the forum category.public java.util.Date getCreationDate()
ForumCategory
getCreationDate in interface ForumCategorypublic void setCreationDate(java.util.Date creationDate)
ForumCategory
setCreationDate in interface ForumCategorycreationDate - the date the forum category was created.public java.util.Date getModificationDate()
ForumCategoryBy default, this feature is
getModificationDate in interface ForumCategorypublic void setModificationDate(java.util.Date modificationDate)
ForumCategory
setModificationDate in interface ForumCategorymodificationDate - the date the forum was modified.public java.util.Locale getLocale()
ForumCategory
getLocale in interface ForumCategory
public void setLocale(java.util.Locale locale)
throws UnauthorizedException
ForumCategory
setLocale in interface ForumCategorylocale - the locale of this category.
UnauthorizedException - if does not have admin permissions.public java.util.Locale getFinalLocale()
ForumCategory
getFinalLocale in interface ForumCategorypublic java.lang.String getProperty(java.lang.String name)
ForumCategory
getProperty in interface ForumCategoryname - the name of the property to get.
public java.util.Collection getProperties(java.lang.String parentName)
ForumCategory
getProperties in interface ForumCategoryparentName - the name of the parent property to return the children for.
public void setProperty(java.lang.String name,
java.lang.String value)
ForumCategory
If the property referenced by name already exists, its
value will be updated.
setProperty in interface ForumCategoryname - 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)
ForumCategory
deleteProperty in interface ForumCategoryname - the name of the property to delete.public java.util.Iterator getPropertyNames()
ForumCategory
getPropertyNames in interface ForumCategorypublic int getForumCount()
ForumCategoryForumCategory.getForums() since
that method only returns forums that a user has read permission for.
getForumCount in interface ForumCategorypublic int getForumCount(ResultFilter resultFilter)
ForumCategoryForumCategory.getForums() since that
method only returns forums that a user has read permission for.
getForumCount in interface ForumCategoryresultFilter - a resultFilter to limit the query on.
public int getRecursiveForumCount()
ForumCategoryForumCategory.getRecursiveForums() since that method only returns forums
that a user has read permission for.
getRecursiveForumCount in interface ForumCategorypublic int getRecursiveForumCount(ResultFilter resultFilter)
ForumCategoryForumCategory.getRecursiveForums() since that method only returns forums
that a user has read permission for.
getRecursiveForumCount in interface ForumCategoryresultFilter - a resultFilter to limit the query on.
public java.util.Iterator getForums()
ForumCategory
getForums in interface ForumCategorypublic java.util.Iterator getForums(ResultFilter resultFilter)
ForumCategory
getForums in interface ForumCategoryresultFilter - a ResultFilter object to perform filtering and
sorting with.
public java.util.Iterator getRecursiveForums()
ForumCategory
getRecursiveForums in interface ForumCategorypublic java.util.Iterator getRecursiveForums(ResultFilter resultFilter)
ForumCategory
getRecursiveForums in interface ForumCategoryresultFilter - a ResultFilter object to perform filtering and
sorting with.
public LongList getRecursiveForumIDs()
public void setForumIndex(Forum forum,
int newIndex)
ForumCategory
setForumIndex in interface ForumCategoryforum - the forum to adjust the index of.newIndex - the new index value for the forum.
public void moveForum(Forum forum,
ForumCategory destinationCategory)
ForumCategory
moveForum in interface ForumCategoryforum - the forum to move.destinationCategory - the category to move the forum to.public ForumCategory getParentCategory()
ForumCategory
getParentCategory in interface ForumCategoryprotected ForumCategory getParentCategory(java.sql.Connection con)
public int getCategoryCount()
ForumCategory
getCategoryCount in interface ForumCategorypublic java.util.Iterator getCategories()
ForumCategory
getCategories in interface ForumCategory
public java.util.Iterator getCategories(int startIndex,
int numResults)
ForumCategory
getCategories in interface ForumCategorystartIndex - the index of the first result to return.numResults - the max number of results to return.
public int getRecursiveCategoryCount()
ForumCategory
getRecursiveCategoryCount in interface ForumCategorypublic java.util.Iterator getRecursiveCategories()
ForumCategory
getRecursiveCategories in interface ForumCategorypublic int getCategoryDepth()
ForumCategory1 |-- 3 |-- |-- 4 |-- |-- |-- 7The depth of message 4 is 2, the depth of category 7 is 3, etc. This method is useful in combination with the
ForumCategory.getRecursiveCategories()
Iterator to build a UI of hierarchical categories.
getCategoryDepth in interface ForumCategory
public void setCategoryIndex(ForumCategory category,
int newIndex)
ForumCategory
setCategoryIndex in interface ForumCategorycategory - the sub category to set the index fornewIndex - the new index of the sub category
public void moveCategory(ForumCategory category,
ForumCategory destinationCategory)
ForumCategory1 |-- 3 |-- |-- 4 |-- |-- |-- 7Moving 3 to be a child of 7 is not allowed, since that breaks the tree structure.
moveCategory in interface ForumCategorycategory - the ForumCategory to move.destinationCategory - the category to move the sub-category to.
public ForumCategory createCategory(java.lang.String name,
java.lang.String description)
ForumCategory
createCategory in interface ForumCategoryname - the name of the new category.description - the description of the new category.
public void deleteCategory(ForumCategory forumCategory)
ForumCategory
deleteCategory in interface ForumCategoryforumCategory - the ForumCategory to delete.
public void deleteForum(Forum forum)
throws UnauthorizedException
ForumCategoryThis method is not always guaranteed to be safe to call. For example, if multiple clients have handles on a forum, and that forum is subsequently deleted, the behavior of the forum objects that the clients have handles on is unspecified and may result in errors.
deleteForum in interface ForumCategoryforum - the forum to delete.
UnauthorizedException - if not allowed to delete a forum.
public void deleteForum(Forum forum,
boolean fireEvent)
throws UnauthorizedException
UnauthorizedExceptionpublic java.util.Iterator getPopularThreads()
ForumCategoryA 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 ForumCategorypublic java.util.Iterator getThreads()
ContentRetrieval
getThreads in interface ContentRetrievalgetThreads in interface ForumCategorypublic java.util.Iterator getThreads(ResultFilter resultFilter)
ContentRetrieval
getThreads in interface ContentRetrievalgetThreads in interface ForumCategoryresultFilter - a ResultFilter object to perform filtering and sorting with.
public java.util.Iterator getMessages()
ContentRetrieval
getMessages in interface ContentRetrievalgetMessages in interface ForumCategorypublic java.util.Iterator getMessages(ResultFilter resultFilter)
ContentRetrieval
getMessages in interface ContentRetrievalgetMessages in interface ForumCategoryresultFilter - a ResultFilter object to perform filtering and sorting with.
public int getThreadCount()
ContentRetrievalContentRetrieval.getThreads() method.
getThreadCount in interface ContentRetrievalgetThreadCount in interface ForumCategorypublic int getThreadCount(ResultFilter resultFilter)
ContentRetrievalContentRetrieval.getThreads(com.jivesoftware.forum.ResultFilter) method.
getThreadCount in interface ContentRetrievalgetThreadCount in interface ForumCategoryresultFilter - a resultFilter to limit the query on.
public int getMessageCount()
ContentRetrievalContentRetrieval.getMessages() method.
getMessageCount in interface ContentRetrievalgetMessageCount in interface ForumCategorypublic int getMessageCount(ResultFilter resultFilter)
ContentRetrievalContentRetrieval.getMessages(ResultFilter) method.
getMessageCount in interface ContentRetrievalgetMessageCount in interface ForumCategoryresultFilter - a resultFilter to limit the query on.
public ForumMessage getLatestMessage()
ForumCategoryResultFilter, but this method offers a simpler, more optimized way to
access the data.
getLatestMessage in interface ForumCategorypublic PermissionsManager getPermissionsManager()
ForumCategory
getPermissionsManager in interface ForumCategorypublic InterceptorManager getInterceptorManager()
ForumCategory
getInterceptorManager in interface ForumCategorypublic ForumRenderManager getRenderManager()
ForumCategoryRenderManager.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 ForumCategoryRenderManagerpublic Permissions getPermissions(AuthToken authToken)
ForumCategory
getPermissions in interface ForumCategoryauthToken - the auth token to lookup permissions for.
public boolean isAuthorized(long type)
ForumCategoryForumPermissions.FORUM_CATEGORY_ADMIN)
would return true.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 ForumCategorytype - permissionType a permission type.
ForumPermissionspublic int getObjectType()
JiveObject
getObjectType in interface JiveObjectpublic int getCachedSize()
Cacheable
getCachedSize in interface Cacheablepublic 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.Objectprotected void clearCache()
protected CachedPreparedStatement getThreadListSQL(ResultFilter resultFilter,
boolean countQuery)
protected CachedPreparedStatement getMessageListSQL(ResultFilter resultFilter,
boolean countQuery)
public static LongTree getCategoryTree()
public static void refreshCategoryTree(boolean startup)
startup - true if the category refresh operation is being called when
the instance is first being initialized. In that case, only database loads
are performed and no cache clears are done since those might interfere
with other cluster members.
protected void updateModifiedDate(long date,
java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLException
protected CachedPreparedStatement getForumListSQL(ResultFilter resultFilter,
boolean countQuery,
boolean recursiveQuery)
resultFilter - the result filter to build the SQL from.countQuery - true if this should be a count query.recursiveQuery - if forums from all sub-categories should be in
the results.public static int[] getLftRgtValues(long categoryID)
categoryID - the category ID.
protected void deleteFromDb(java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.Map getTags()
ForumCategoryMap where the key is the
name of tag and the value is the number of times the tag has been used in this community.
getTags in interface ForumCategoryMap where the key is the
name of tag and the value is the number of times the tag has been used in this community.public java.util.Map getTags(TagResultFilter resultFilter)
ForumCategoryMap where the key is the
name of tag and the value is the number of times the tag has been used in this community
filtered by the TagResultFilter.
getTags in interface ForumCategoryresultFilter - 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 community
filtered by the TagResultFilter.public int getCombinedContentCount(long[] contentTypes)
ContentRetrievalContentRetrieval.getCombinedContent(long[]) method.
getCombinedContentCount in interface ContentRetrievalcontentTypes - the ContentTypes to include in the count.
public int getCombinedContentCount(ResultFilter filter,
long[] types)
ContentRetrievalContentRetrieval.getCombinedContent(ResultFilter, long[]) method.
getCombinedContentCount in interface ContentRetrievalfilter - the ResultFilter to filter the results.types - the ContentTypes to include in the count.
public java.util.Iterator getCombinedContent(long[] types)
ContentRetrieval
getCombinedContent in interface ContentRetrievaltypes - the ContentTypes to include in the result.
public java.util.Iterator getCombinedContent(ResultFilter filter,
long[] types)
ContentRetrievalResultFilter.
getCombinedContent in interface ContentRetrievalfilter - the ResultFilter to filter and sort the results.types - the ContentTypes to include in the result.
protected void fireModificationEvent()
|
Jive Forums Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||