org.alfresco.repo.discussion
Class DiscussionServiceImpl

java.lang.Object
  extended by org.alfresco.repo.discussion.DiscussionServiceImpl
All Implemented Interfaces:
DiscussionService

public class DiscussionServiceImpl
extends java.lang.Object
implements DiscussionService

Since:
4.0

Field Summary
protected static java.lang.String CANNED_QUERY_GET_CHILDREN
           
protected static java.lang.String CANNED_QUERY_GET_CHILDREN_TARGETS
           
protected static java.lang.String CANNED_QUERY_GET_TOPICS_WITH_POSTS
           
static java.lang.String DISCUSSION_COMPONENT
           
protected static int MAX_REPLIES_FETCH_SIZE
           
 
Constructor Summary
DiscussionServiceImpl()
           
 
Method Summary
 PostInfo createPost(TopicInfo topic, java.lang.String contents)
          Creates a new PostInfo in the given topic, with the specified contents.
 PostInfo createReply(PostInfo parentPost, java.lang.String contents)
          Creates a new PostInfo which is a reply to the specified other post, with the given contents.
 TopicInfo createTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, java.lang.String title)
          Creates a new TopicInfo attached to the specified Node.
 TopicInfo createTopic(java.lang.String siteShortName, java.lang.String title)
          Creates a new TopicInfo in the given site
 void deletePost(PostInfo post)
          Deletes an existing PostInfo from the repository
 void deleteTopic(TopicInfo topic)
          Deletes an existing TopicInfo from the repository
 org.alfresco.query.PagingResults findTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String username, java.lang.String tag, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Searches for all topics attached to the specified Node, filtered by username or tag, sorted by either oldest or newest topics first.
 org.alfresco.query.PagingResults findTopics(java.lang.String siteShortName, java.lang.String username, java.lang.String tag, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Searches for all topics in a site, filtered by username or tag, sorted by either oldest or newest topics first.
 org.alfresco.util.Pair getForNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          For a given NodeRef corresponding to either a TopicInfo or a PostInfo, returns the objects wrapping the Node.
 PostInfo getMostRecentPost(TopicInfo topic)
          Retrieves the newest (most recent) Post in a topic, be that the Primary Post or a Reply.
 PostInfo getPost(TopicInfo topic, java.lang.String postName)
          Retrieves an existing PostInfo from the repository
 PostInfo getPrimaryPost(TopicInfo topic)
          Retrieves the Primary (Root) Post in a topic, to which all replies belong.
protected  org.alfresco.service.cmr.repository.NodeRef getSiteDiscussionsContainer(java.lang.String siteShortName, boolean create)
          Fetches the Discussions Container on a site, creating as required if requested.
 TopicInfo getTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, java.lang.String topicName)
          Retrieves an existing TopicInfo from the repository, which is attached to the specified Node.
 TopicInfo getTopic(java.lang.String siteShortName, java.lang.String topicName)
          Retrieves an existing TopicInfo from the repository, which is within a site
 org.alfresco.query.PagingResults listHotTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Date since, org.alfresco.query.PagingRequest paging)
          Finds topics which have had replies since the specified date, and returns them along with the count of replies since then.
 org.alfresco.query.PagingResults listHotTopics(java.lang.String siteShortName, java.util.Date since, org.alfresco.query.PagingRequest paging)
          Finds topics which have had replies since the specified date, and returns them along with the count of replies since then.
 PostWithReplies listPostReplies(PostInfo primaryPost, int levels)
          Retrieves all replies to a Post
 PostWithReplies listPostReplies(TopicInfo topic, int levels)
          Retrieves all replies on a Topic
 org.alfresco.query.PagingResults listPosts(TopicInfo topic, org.alfresco.query.PagingRequest paging)
          Retrieves all posts in a topic, ordered by creation date
 org.alfresco.query.PagingResults listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Retrieves all topics attached to the specified Node, sorted by either oldest or newest topics first.
 org.alfresco.query.PagingResults listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Date from, java.util.Date to, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Retrieves all topics attached to the specified Node, created in the given date range, sorted by either oldest or newest topics first.
 org.alfresco.query.PagingResults listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String username, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Retrieves all topics attached to the specified Node, filtered by username, sorted by either oldest or newest topics first.
 org.alfresco.query.PagingResults listTopics(java.lang.String siteShortName, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Retrieves all topics in a site, sorted by either oldest or newest topics first.
 org.alfresco.query.PagingResults listTopics(java.lang.String siteShortName, java.util.Date from, java.util.Date to, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Retrieves all topics in a site, created in the given date range, sorted by either oldest or newest topics first.
 org.alfresco.query.PagingResults listTopics(java.lang.String siteShortName, java.lang.String username, boolean sortAscending, org.alfresco.query.PagingRequest paging)
          Retrieves all topics in a site, filtered by username, sorted by either oldest or newest topics first.
 void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry cannedQueryRegistry)
          Set the registry of canned queries
 void setContentService(ContentService contentService)
           
 void setFileFolderService(FileFolderService fileFolderService)
           
 void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
           
 void setNodeDAO(NodeDAO nodeDAO)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
           
 void setSiteService(SiteService siteService)
           
 void setTaggingService(TaggingService taggingService)
           
 void setTransactionService(TransactionService transactionService)
           
 PostInfo updatePost(PostInfo post)
          Updates an existing PostInfo in the repository.
 TopicInfo updateTopic(TopicInfo topic)
          Updates an existing TopicInfo in the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISCUSSION_COMPONENT

public static final java.lang.String DISCUSSION_COMPONENT
See Also:
Constant Field Values

CANNED_QUERY_GET_CHILDREN

protected static final java.lang.String CANNED_QUERY_GET_CHILDREN
See Also:
Constant Field Values

CANNED_QUERY_GET_CHILDREN_TARGETS

protected static final java.lang.String CANNED_QUERY_GET_CHILDREN_TARGETS
See Also:
Constant Field Values

CANNED_QUERY_GET_TOPICS_WITH_POSTS

protected static final java.lang.String CANNED_QUERY_GET_TOPICS_WITH_POSTS
See Also:
Constant Field Values

MAX_REPLIES_FETCH_SIZE

protected static final int MAX_REPLIES_FETCH_SIZE
See Also:
Constant Field Values
Constructor Detail

DiscussionServiceImpl

public DiscussionServiceImpl()
Method Detail

setNodeDAO

public void setNodeDAO(NodeDAO nodeDAO)

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)

setSiteService

public void setSiteService(SiteService siteService)

setSearchService

public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)

setContentService

public void setContentService(ContentService contentService)

setTaggingService

public void setTaggingService(TaggingService taggingService)

setNamespaceService

public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)

setFileFolderService

public void setFileFolderService(FileFolderService fileFolderService)

setTransactionService

public void setTransactionService(TransactionService transactionService)

setCannedQueryRegistry

public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry cannedQueryRegistry)
Set the registry of canned queries


getSiteDiscussionsContainer

protected org.alfresco.service.cmr.repository.NodeRef getSiteDiscussionsContainer(java.lang.String siteShortName,
                                                                                  boolean create)
Fetches the Discussions Container on a site, creating as required if requested.


getTopic

public TopicInfo getTopic(java.lang.String siteShortName,
                          java.lang.String topicName)
Description copied from interface: DiscussionService
Retrieves an existing TopicInfo from the repository, which is within a site

Specified by:
getTopic in interface DiscussionService

getTopic

public TopicInfo getTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
                          java.lang.String topicName)
Description copied from interface: DiscussionService
Retrieves an existing TopicInfo from the repository, which is attached to the specified Node. The parent Node should normally either be a Site Container, or a ForumModel.TYPE_FORUM

Specified by:
getTopic in interface DiscussionService

getPost

public PostInfo getPost(TopicInfo topic,
                        java.lang.String postName)
Description copied from interface: DiscussionService
Retrieves an existing PostInfo from the repository

Specified by:
getPost in interface DiscussionService

createTopic

public TopicInfo createTopic(java.lang.String siteShortName,
                             java.lang.String title)
Description copied from interface: DiscussionService
Creates a new TopicInfo in the given site

Specified by:
createTopic in interface DiscussionService

createTopic

public TopicInfo createTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
                             java.lang.String title)
Description copied from interface: DiscussionService
Creates a new TopicInfo attached to the specified Node. The parent Node should normally either be a Site Container, or a ForumModel.TYPE_FORUM

Specified by:
createTopic in interface DiscussionService

createPost

public PostInfo createPost(TopicInfo topic,
                           java.lang.String contents)
Description copied from interface: DiscussionService
Creates a new PostInfo in the given topic, with the specified contents. Normally only one post is created this way on a topic, and the remainder of the posts are created as replies to the DiscussionService.getPrimaryPost(TopicInfo) primary post.

Specified by:
createPost in interface DiscussionService
Returns:
The newly created PostInfo

createReply

public PostInfo createReply(PostInfo parentPost,
                            java.lang.String contents)
Description copied from interface: DiscussionService
Creates a new PostInfo which is a reply to the specified other post, with the given contents. The link between the parent post and the reply is created as part of this.

Specified by:
createReply in interface DiscussionService
Returns:
The newly created PostInfo

updateTopic

public TopicInfo updateTopic(TopicInfo topic)
Description copied from interface: DiscussionService
Updates an existing TopicInfo in the repository.

Specified by:
updateTopic in interface DiscussionService
Returns:
The updated TopicInfo

updatePost

public PostInfo updatePost(PostInfo post)
Description copied from interface: DiscussionService
Updates an existing PostInfo in the repository.

Specified by:
updatePost in interface DiscussionService
Returns:
The updated PostInfo

deleteTopic

public void deleteTopic(TopicInfo topic)
Description copied from interface: DiscussionService
Deletes an existing TopicInfo from the repository

Specified by:
deleteTopic in interface DiscussionService

deletePost

public void deletePost(PostInfo post)
Description copied from interface: DiscussionService
Deletes an existing PostInfo from the repository

Specified by:
deletePost in interface DiscussionService

getForNodeRef

public org.alfresco.util.Pair getForNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface: DiscussionService
For a given NodeRef corresponding to either a TopicInfo or a PostInfo, returns the objects wrapping the Node. For a Topic, the 2nd half of the pair is null. For a Post, both halves of the pair are set. For anything else, the response is null.

Specified by:
getForNodeRef in interface DiscussionService

getPrimaryPost

public PostInfo getPrimaryPost(TopicInfo topic)
Description copied from interface: DiscussionService
Retrieves the Primary (Root) Post in a topic, to which all replies belong. Returns null if the topic currently has no posts

Specified by:
getPrimaryPost in interface DiscussionService

getMostRecentPost

public PostInfo getMostRecentPost(TopicInfo topic)
Description copied from interface: DiscussionService
Retrieves the newest (most recent) Post in a topic, be that the Primary Post or a Reply. This is typically used when identifying if a topic has had new posts added to it since the user last saw it. Note that this works on Created Date, and not Modified/Updated, so edits to an existing post will not change this.

Specified by:
getMostRecentPost in interface DiscussionService

listTopics

public org.alfresco.query.PagingResults listTopics(java.lang.String siteShortName,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all topics in a site, sorted by either oldest or newest topics first.

Specified by:
listTopics in interface DiscussionService

listTopics

public org.alfresco.query.PagingResults listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all topics attached to the specified Node, sorted by either oldest or newest topics first.

Specified by:
listTopics in interface DiscussionService

listTopics

public org.alfresco.query.PagingResults listTopics(java.lang.String siteShortName,
                                                   java.lang.String username,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all topics in a site, filtered by username, sorted by either oldest or newest topics first.

Specified by:
listTopics in interface DiscussionService

listTopics

public org.alfresco.query.PagingResults listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                   java.lang.String username,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all topics attached to the specified Node, filtered by username, sorted by either oldest or newest topics first.

Specified by:
listTopics in interface DiscussionService

listTopics

public org.alfresco.query.PagingResults listTopics(java.lang.String siteShortName,
                                                   java.util.Date from,
                                                   java.util.Date to,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all topics in a site, created in the given date range, sorted by either oldest or newest topics first.

Specified by:
listTopics in interface DiscussionService

listTopics

public org.alfresco.query.PagingResults listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                   java.util.Date from,
                                                   java.util.Date to,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all topics attached to the specified Node, created in the given date range, sorted by either oldest or newest topics first.

Specified by:
listTopics in interface DiscussionService

listHotTopics

public org.alfresco.query.PagingResults listHotTopics(java.lang.String siteShortName,
                                                      java.util.Date since,
                                                      org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Finds topics which have had replies since the specified date, and returns them along with the count of replies since then. Primary posts are not included in this.

Specified by:
listHotTopics in interface DiscussionService

listHotTopics

public org.alfresco.query.PagingResults listHotTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                      java.util.Date since,
                                                      org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Finds topics which have had replies since the specified date, and returns them along with the count of replies since then. Primary posts are not included in this.

Specified by:
listHotTopics in interface DiscussionService

findTopics

public org.alfresco.query.PagingResults findTopics(java.lang.String siteShortName,
                                                   java.lang.String username,
                                                   java.lang.String tag,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Searches for all topics in a site, filtered by username or tag, sorted by either oldest or newest topics first.

Specified by:
findTopics in interface DiscussionService

findTopics

public org.alfresco.query.PagingResults findTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                   java.lang.String username,
                                                   java.lang.String tag,
                                                   boolean sortAscending,
                                                   org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Searches for all topics attached to the specified Node, filtered by username or tag, sorted by either oldest or newest topics first.

Specified by:
findTopics in interface DiscussionService

listPosts

public org.alfresco.query.PagingResults listPosts(TopicInfo topic,
                                                  org.alfresco.query.PagingRequest paging)
Description copied from interface: DiscussionService
Retrieves all posts in a topic, ordered by creation date

Specified by:
listPosts in interface DiscussionService

listPostReplies

public PostWithReplies listPostReplies(TopicInfo topic,
                                       int levels)
Description copied from interface: DiscussionService
Retrieves all replies on a Topic

Specified by:
listPostReplies in interface DiscussionService

listPostReplies

public PostWithReplies listPostReplies(PostInfo primaryPost,
                                       int levels)
Description copied from interface: DiscussionService
Retrieves all replies to a Post

Specified by:
listPostReplies in interface DiscussionService


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.