|
Clearspace API (1.3.0) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Community
A container for threads, documents and a hierarchy of other communities. In other words, the community structure is a tree, with lists of threads and documents for every community node. There is always a "root" community (ID of 1), of which all other communities are children.
Community names are not unique, therefore it is not possible to load a community by name.
CommunityManager.getRootCommunity(),
CommunityManager.getCommunity(long)| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.jivesoftware.community.ContentRetrieval |
|---|
ContentRetrieval.ContentType |
| Field Summary |
|---|
| Fields inherited from interface com.jivesoftware.community.ContentRetrieval |
|---|
ALL_TYPES |
| Method Summary | |
|---|---|
void |
addBlog(Blog blog)
Associates the specified Blog with this community. |
void |
addDocument(Document document)
Add a document as a child of the community. |
void |
addDocument(Document document,
com.jivesoftware.community.impl.PermissionsBundle permBundle)
Add a document as a child of the community with permissions defined by the provided permission bundle. |
void |
addDocumentApprover(User user)
Add the user as a document approver for this entire community. |
void |
addThread(ForumThread thread)
Adds a new thread to the community. |
Community |
createCommunity(java.lang.String name,
java.lang.String displayName,
java.lang.String description)
Creates a new Community as a sub-community of this community using the name and description. |
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. |
ForumThread |
createThread(ForumMessage rootMessage)
Factory method to create a new thread. |
int |
getBlogCount()
Returns the number of blogs associated with this community. |
JiveIterator<Blog> |
getBlogs()
Returns all Blogs associated with this community. |
JiveIterator<Community> |
getCommunities()
Returns an Iterable for the child communities of this community. |
JiveIterator<Community> |
getCommunities(int startIndex,
int numResults)
Returns an Iterable for the child communities of this community using a start index and the number of results to return. |
int |
getCommunityCount()
Returns the number of sub-communities of this community. |
int |
getCommunityDepth()
Returns the depth of a this community relative to the root. |
ContentRetrieval.ContentType[] |
getContentTypes()
Gets an array of ContentRetrieval.ContentTypes that are enabled for this community. |
java.util.Date |
getCreationDate()
Returns the Date that the community was created. |
java.lang.String |
getDescription()
Returns the description of the community. |
java.lang.String |
getDisplayName()
Gets the display name of the community. |
java.util.Collection<User> |
getDocumentApprovers()
Returns all of the users that must approve new documents before they reach a PUBLISHED state when it is in a PENDING_APPROVAL state. |
int |
getDocumentCount()
Returns the number of published documents in the community. |
int |
getDocumentCount(DocumentResultFilter resultFilter)
Returns the number of documents in the community {and possibly all subcommunities} based on the specified ResultFilter. |
JiveIterator<Document> |
getDocuments()
Returns an Iterable for all the published documents in the community. |
JiveIterator<Document> |
getDocuments(DocumentResultFilter resultFilter)
Returns an Iterable for all the documents in the community {and possibly all subcommunities} that match the criteria specified by the ResultFilter. |
JiveIterator<Document> |
getDocumentsUnderEdit()
Returns an Iterable of documents currently being editted in the community. |
int |
getDocumentsUnderEditCount()
Returns the count of the number of documents currently being editted in the community. |
java.util.Locale |
getFinalLocale()
Returns the locale for this community. |
InterceptorManager |
getInterceptorManager()
Returns a message interceptor manager that can be used to manage interceptors for this community. |
Document |
getLatestDocument()
Returns the most recently created or edited document in this community (including all sub-communities). |
ForumMessage |
getLatestMessage()
Returns the most recently created or edited message in this community (including all sub-communities). |
java.util.Locale |
getLocale()
Returns the locale for this community. |
int |
getMaxCommunityIndex()
Returns the largest community index value for a message in the community. |
int |
getMinCommunityIndex()
Returns the smallest community index value for a message in the community. |
int |
getModerationDefaultMessageValue()
Returns the default number of moderation points for messages created in the community. |
int |
getModerationDefaultThreadValue()
Returns the default number of moderation points for threads created in the community. |
java.util.Date |
getModificationDate()
Returns the Date this community was last modified. |
java.lang.String |
getName()
Returns the name of the community. |
java.lang.String |
getNNTPName()
Returns the NNTP name for the community, which is the name of the community used in the NNTP protocol (newsgroups). |
Community |
getParentCommunity()
Returns the parent community of this community. |
Permissions |
getPermissions(AuthToken authToken)
Returns the permissions for the community that correspond to the passed-in AuthToken. |
PermissionsManager |
getPermissionsManager()
Returns a permissions manager that can be used to set permissions for this community. |
JiveIterator<Document> |
getPopularDocuments()
Returns the top x documents according to document views, number of comments & time passed since the document was created. |
JiveIterator<ForumThread> |
getPopularThreads()
Returns the top x threads according to thread views, replies per thread & time passed since the thread was last modified. |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Retrieve a map of all the extended properties for the community. |
JiveIterator<Community> |
getRecursiveCommunities()
Returns an Iterable for all sub-communities of this community, including sub-communities of sub-communities, etc. |
int |
getRecursiveCommunityCount()
Returns the total count of all sub-communities of this community, including sub-communities of sub-communities, etc. |
RenderManager |
getRenderManager()
Returns a render manager that can be used to manage render filters and macros for this community. |
java.util.Map<java.lang.String,java.lang.Integer> |
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<java.lang.String,java.lang.Integer> |
getTags(TagResultFilter resultFilter,
ContentRetrieval.ContentType... types)
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. |
JiveIterator<TagSet> |
getTagSets()
Returns all TagSets which are defined for this Community. |
int |
getViewCount()
Returns the number of times this thread has been community. |
boolean |
isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. |
boolean |
isRead(User user)
Returns true if this community has been read by the user, false otherwise. |
boolean |
isUniqueDisplayName(java.lang.String displayName)
Returns true if the provided display name is unique within this community, false otherwise |
boolean |
isUnread(User user)
Returns true if this community has not been read by the user, false otherwise. |
boolean |
isUpdated(User user)
Returns true if this community has been updated since read by the user, false otherwise. |
void |
removeBlog(Blog blog)
Disassociates the specified Blog from this community. |
void |
removeDocumentApprover(User user)
Remove this user as a document approver for this community. |
void |
setCommunityIndex(Community subCommunity,
int newIndex)
Sets the display order of a sub-community. |
void |
setContentTypes(ContentRetrieval.ContentType... types)
Sets an array of ContentRetrieval.ContentTypes that are enabled for this community; |
void |
setCreationDate(java.util.Date creationDate)
Sets the creation date of the community. |
void |
setDescription(java.lang.String description)
Sets the description of the community. |
void |
setDisplayName(java.lang.String name)
Sets the display name of the community that is used as the URI. |
void |
setLocale(java.util.Locale locale)
Sets the locale for this community. |
void |
setModerationDefaultMessageValue(int value)
Sets the default number of moderation points for threads created in the community. |
void |
setModerationDefaultThreadValue(int value)
Sets the default number of moderation points for threads created in the community. |
void |
setModificationDate(java.util.Date modificationDate)
Sets the date the community was last modified. |
void |
setName(java.lang.String name)
Sets the name of the community. |
void |
setNNTPName(java.lang.String nntpName)
Sets the NNTP name for the community, which is the name of the community used in the NNTP protocol (newsgroups). |
| Methods inherited from interface com.jivesoftware.community.JiveObject |
|---|
getID, getObjectType |
| Methods inherited from interface com.jivesoftware.community.ContentRetrieval |
|---|
getBlogPostCount, getBlogPostCount, getBlogPosts, getBlogPosts, getCombinedContent, getCombinedContent, getCombinedContentCount, getCombinedContentCount, getMessageCount, getMessageCount, getMessages, getMessages, getThreadCount, getThreadCount, getThreads, getThreads |
| Method Detail |
|---|
java.lang.String getName()
void setName(java.lang.String name)
throws UnauthorizedException
name - the name of the community.
UnauthorizedException - if does not have admin permissions.java.lang.String getDisplayName()
void setDisplayName(java.lang.String name)
throws UnauthorizedException,
NameAlreadyExistsException
This method will throw an IllegalArgumentException if
CommunityManager.getCommunity(String) method to find out if
a community with the new name already exists and
StringUtils.containsNonAlphanumeric(String)
to test a string for non alphanumeric characters.
name - the display name
UnauthorizedException - if does not have admin permissions.
NameAlreadyExistsException - if attempting to use an existing display name.java.lang.String getNNTPName()
NNTP names must follow certain rules. In particular:
void setNNTPName(java.lang.String nntpName)
throws UnauthorizedException,
NameAlreadyExistsException
NNTP names must follow certain rules. Therefore, any name passed into this method will automatically converted based on the following rules:
nntpName - the NNTP name of the community.
UnauthorizedException - if does not have admin permissions.
NameAlreadyExistsException - if attempting to use an existing NNTP name.java.lang.String getDescription()
void setDescription(java.lang.String description)
throws UnauthorizedException
description - the description of the community.
UnauthorizedException - if does not have admin permissions.java.util.Date getCreationDate()
void setCreationDate(java.util.Date creationDate)
throws UnauthorizedException
creationDate - the date the community was created.
UnauthorizedException - if does not have admin permissions.java.util.Date getModificationDate()
void setModificationDate(java.util.Date modificationDate)
throws UnauthorizedException
modificationDate - the date the community was modified.
UnauthorizedException - if does not have admin permissions.java.util.Locale getLocale()
void setLocale(java.util.Locale locale)
throws UnauthorizedException
locale - the locale of this community.
UnauthorizedException - if does not have admin permissions.java.util.Locale getFinalLocale()
Community getParentCommunity()
int getCommunityCount()
JiveIterator<Community> getCommunities()
JiveIterator<Community> getCommunities(int startIndex,
int numResults)
startIndex - the index of the first result to return.numResults - the max number of results to return.
int getRecursiveCommunityCount()
JiveIterator<Community> getRecursiveCommunities()
int getCommunityDepth()
1 |-- 3 |-- |-- 4 |-- |-- |-- 7The depth of community 4 is 2, the depth of community 7 is 3, etc. This method is useful in combination with the
getRecursiveCommunities()
Iterable to build a UI of hierarchical communities.
boolean isUniqueDisplayName(java.lang.String displayName)
displayName - the display name to check for uniqueness
void setCommunityIndex(Community subCommunity,
int newIndex)
throws UnauthorizedException
subCommunity - the sub community to set the index fornewIndex - the new index of the sub community
UnauthorizedException - if not an admin of the community
Community createCommunity(java.lang.String name,
java.lang.String displayName,
java.lang.String description)
throws UnauthorizedException,
NameAlreadyExistsException
name - the name of the new community.displayName - the display name of the new community.description - the description of the new community.
UnauthorizedException - if not an admin.
NameAlreadyExistsException - if the display name of the community is not unique.ContentRetrieval.ContentType[] getContentTypes()
ContentRetrieval.ContentTypes that are enabled for this community.
ContentRetrieval.ContentTypes that are enabled for this community.
void setContentTypes(ContentRetrieval.ContentType... types)
throws UnauthorizedException
ContentRetrieval.ContentTypes that are enabled for this community;
types - an array of ContentRetrieval.ContentTypes that are enabled for this community
UnauthorizedException - if not an admin of this communityJiveIterator<ForumThread> getPopularThreads()
Top x of ((thread views) * (number of messages in thread + 2)) * 1/(1 + number of days since modification date)
The number of threads to return is determined by the property "popularThreads.number", defaulting to 5 if the property is not specified. Popular threads are only calculated once every 15 minutes.
ForumThread createThread(ForumMessage rootMessage)
throws UnauthorizedException
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 community with the addThread(ForumThread) method before it is saved to the database. It is illegal to create a thread in one community and then add it to another community.
rootMessage - the root message of the thread.
UnauthorizedException - if does not have CREATE_THREAD permissions.
void addThread(ForumThread thread)
throws RejectedException,
UnauthorizedException
Adding an existing thread to a community is illegal. Instead, the
moveForum
method should be used.
thread - the thread to add to the community.
RejectedException - if one of the installed interceptors prevents the
root message from being posted.
UnauthorizedException - if does not have CREATE_THREAD permissions.ForumMessage getLatestMessage()
ThreadResultFilter, but this method offers a simpler, more optimized way to
access the data.
Document getLatestDocument()
DocumentResultFilter, but this method offers a simpler, more optimized way to
access the data.
ForumMessage createMessage()
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 community and then add it to a thread in another community.
ForumMessage createMessage(User user)
throws UnauthorizedException
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 community and then add it to a thread in another community.
user - the author of the message.
UnauthorizedException - if does not have permission to post as the specified user.JiveIterator<Blog> getBlogs()
Blogs associated with this community.
Blogs associated with this community.int getBlogCount()
void addBlog(Blog blog)
Blog with this community. All posts within the blog
will be available for viewing through the ContentRetrieval.getBlogPosts() method. Blogs are not
logically contained by a community the way threads and documents are. Instead, blogs are
autonomous entities that can be associated with one or more communities.
blog - the Blog to associate with this community.void removeBlog(Blog blog)
Blog from this community.
blog - the Blog to remove.JiveIterator<Document> getPopularDocuments()
Top x of ((document views) * (number of document comments + 2)) * 1/(1 + number of days since creation date)
The number of documents to return is determined by the property "popularDocuments.number", defaulting to 5 if the property is not specified. Popular documents are only calculated once every 15 minutes.
int getDocumentCount()
DocumentResultFilter.setRecusive(true).
getDocumentCount in interface ContentRetrievalJiveIterator<Document> getDocuments()
DocumentResultFilter.setRecusive(true).
getDocuments in interface ContentRetrievalint getDocumentCount(DocumentResultFilter resultFilter)
getDocumentCount in interface ContentRetrievalresultFilter - a DocumentResultFilter to limit the query on.
JiveIterator<Document> getDocuments(DocumentResultFilter resultFilter)
getDocuments in interface ContentRetrievalresultFilter - a DocumentResultFilter object to perform filtering and sorting with.
int getDocumentsUnderEditCount()
JiveIterator<Document> getDocumentsUnderEdit()
void addDocument(Document document)
throws RejectedException,
DocumentAlreadyExistsException,
UnauthorizedException
Document.save() for more details.
Adding a document to a community may cause a DocumentAlreadyExistsException to be
thrown if the subject of the document is not unique among the published documents in the
community.
An UnauthorizedException will be thrown if the user is not a system administrator or does not
have the proper permissions on either the document or the community.
document - the document to add into this community.
RejectedException - if one of the installed interceptors prevents the
document from being added.
DocumentAlreadyExistsException - if the subject of the document is not unique in the community
UnauthorizedException - if user does not have the proper permissions for the community.
void addDocument(Document document,
com.jivesoftware.community.impl.PermissionsBundle permBundle)
throws RejectedException,
DocumentAlreadyExistsException,
UnauthorizedException
Document.save() for more details.
Adding a document to a community may cause a DocumentAlreadyExistsException to be
thrown if the subject of the document is not unique among the published documents in the
community.
An UnauthorizedException will be thrown if the user is not a system administrator or does not
have the proper permissions on either the document or the community.
document - the document to add into this community.permBundle - the permissions to assign to the document
RejectedException - if one of the installed interceptors prevents the
document from being added.
DocumentAlreadyExistsException - if the subject of the document is not unique in the community
UnauthorizedException - if user does not have the proper permissions for the community.java.util.Collection<User> getDocumentApprovers()
void addDocumentApprover(User user)
user - The user to add as a document approver.void removeDocumentApprover(User user)
user - The user to remove as a document approver.java.util.Map<java.lang.String,java.lang.Integer> getTags()
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.
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<java.lang.String,java.lang.Integer> getTags(TagResultFilter resultFilter,
ContentRetrieval.ContentType... types)
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.
resultFilter - the filter to use to restrict tag resultstypes - the content types 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.JiveIterator<TagSet> getTagSets()
TagSets which are defined for this Community.
TagSets which are defined for this Community.
PermissionsManager getPermissionsManager()
throws UnauthorizedException
UnauthorizedException - is not an admin.
InterceptorManager getInterceptorManager()
throws UnauthorizedException
UnauthorizedException - if does not have admin permissions.RenderManager getRenderManager()
RenderManager.render(JiveObject,com.jivesoftware.community.renderer.RenderType,String) and
RenderManager.render(JiveObject,com.jivesoftware.community.renderer.RenderType,com.jivesoftware.community.renderer.RenderStrategy,String)
methods, which may be useful to skin writers.
RenderManagerPermissions getPermissions(AuthToken authToken)
authToken - the auth token to lookup permissions for.
boolean isAuthorized(long permissionType)
Permissions.COMMUNITY_ADMIN)
would return true.A list of possible permissions can be found in the Permissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
permissionType - permissionType a permission type.
Permissionsboolean isRead(User user)
user - the user to check read stats for this community
boolean isUnread(User user)
user - the user to check read stats for this community
boolean isUpdated(User user)
user - the user to check read stats for this community
int getViewCount()
java.util.Map<java.lang.String,java.lang.String> getProperties()
If the user is not authorized to modify the community any method which modifies the map will fail with a UnsupportedOperationException;
int getModerationDefaultThreadValue()
void setModerationDefaultThreadValue(int value)
throws UnauthorizedException
value - default number of moderation points for threads.
UnauthorizedException - if does not have permission.int getModerationDefaultMessageValue()
void setModerationDefaultMessageValue(int value)
throws UnauthorizedException
value - default number of moderation points for messages.
UnauthorizedException - if does not have permission.int getMinCommunityIndex()
int getMaxCommunityIndex()
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||