Package org.alfresco.repo.discussion
Class DiscussionServiceImpl
- java.lang.Object
-
- org.alfresco.repo.discussion.DiscussionServiceImpl
-
- All Implemented Interfaces:
DiscussionService
public class DiscussionServiceImpl extends Object implements DiscussionService
- Since:
- 4.0
- Author:
- Nick Burch (based on existing webscript controllers in the REST API)
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringCANNED_QUERY_GET_CHILDRENprotected static StringCANNED_QUERY_GET_CHILDREN_TARGETSprotected static StringCANNED_QUERY_GET_TOPICS_WITH_POSTSstatic StringDISCUSSION_COMPONENTprotected static intMAX_REPLIES_FETCH_SIZE
-
Constructor Summary
Constructors Constructor Description DiscussionServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PostInfocreatePost(TopicInfo topic, String contents)Creates a newPostInfoin the given topic, with the specified contents.PostInfocreateReply(PostInfo parentPost, String contents)Creates a newPostInfowhich is a reply to the specified other post, with the given contents.TopicInfocreateTopic(String siteShortName, String title)Creates a newTopicInfoin the given siteTopicInfocreateTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String title)Creates a newTopicInfoattached to the specified Node.voiddeletePost(PostInfo post)Deletes an existingPostInfofrom the repositoryvoiddeleteTopic(TopicInfo topic)Deletes an existingTopicInfofrom the repositoryorg.alfresco.query.PagingResults<TopicInfo>findTopics(String siteShortName, String username, 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.query.PagingResults<TopicInfo>findTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, String username, 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.util.Pair<TopicInfo,PostInfo>getForNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)PostInfogetMostRecentPost(TopicInfo topic)Retrieves the newest (most recent) Post in a topic, be that the Primary Post or a Reply.PostInfogetPost(TopicInfo topic, String postName)Retrieves an existingPostInfofrom the repositoryPostInfogetPrimaryPost(TopicInfo topic)Retrieves the Primary (Root) Post in a topic, to which all replies belong.protected org.alfresco.service.cmr.repository.NodeRefgetSiteDiscussionsContainer(String siteShortName, boolean create)Fetches the Discussions Container on a site, creating as required if requested.TopicInfogetTopic(String siteShortName, String topicName)Retrieves an existingTopicInfofrom the repository, which is within a siteTopicInfogetTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String topicName)Retrieves an existingTopicInfofrom the repository, which is attached to the specified Node.org.alfresco.query.PagingResults<org.alfresco.util.Pair<TopicInfo,Integer>>listHotTopics(String siteShortName, 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<org.alfresco.util.Pair<TopicInfo,Integer>>listHotTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, 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.PostWithReplieslistPostReplies(PostInfo primaryPost, int levels)Retrieves all replies to a PostPostWithReplieslistPostReplies(TopicInfo topic, int levels)Retrieves all replies on a Topicorg.alfresco.query.PagingResults<PostInfo>listPosts(TopicInfo topic, org.alfresco.query.PagingRequest paging)Retrieves all posts in a topic, ordered by creation dateorg.alfresco.query.PagingResults<TopicInfo>listTopics(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<TopicInfo>listTopics(String siteShortName, 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.org.alfresco.query.PagingResults<TopicInfo>listTopics(String siteShortName, Date from, 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<TopicInfo>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<TopicInfo>listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, 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<TopicInfo>listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, Date from, 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.voidsetCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<? extends Object>> cannedQueryRegistry)Set the registry ofcanned queriesvoidsetContentService(ContentService contentService)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)voidsetNodeDAO(NodeDAO nodeDAO)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetSearchService(org.alfresco.service.cmr.search.SearchService searchService)voidsetSiteService(SiteService siteService)voidsetTaggingService(TaggingService taggingService)voidsetTenantService(org.alfresco.repo.tenant.TenantService tenantService)Set theTenantServicevoidsetTransactionService(TransactionService transactionService)PostInfoupdatePost(PostInfo post)Updates an existingPostInfoin the repository.TopicInfoupdateTopic(TopicInfo topic)Updates an existingTopicInfoin the repository.
-
-
-
Field Detail
-
DISCUSSION_COMPONENT
public static final String DISCUSSION_COMPONENT
- See Also:
- Constant Field Values
-
CANNED_QUERY_GET_CHILDREN
protected static final String CANNED_QUERY_GET_CHILDREN
- See Also:
- Constant Field Values
-
CANNED_QUERY_GET_CHILDREN_TARGETS
protected static final String CANNED_QUERY_GET_CHILDREN_TARGETS
- See Also:
- Constant Field Values
-
CANNED_QUERY_GET_TOPICS_WITH_POSTS
protected static final 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
-
-
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)
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
-
setCannedQueryRegistry
public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<? extends Object>> cannedQueryRegistry)
Set the registry ofcanned queries
-
setTenantService
public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
Set theTenantService
-
getSiteDiscussionsContainer
protected org.alfresco.service.cmr.repository.NodeRef getSiteDiscussionsContainer(String siteShortName, boolean create)
Fetches the Discussions Container on a site, creating as required if requested.
-
getTopic
public TopicInfo getTopic(String siteShortName, String topicName)
Description copied from interface:DiscussionServiceRetrieves an existingTopicInfofrom the repository, which is within a site- Specified by:
getTopicin interfaceDiscussionService
-
getTopic
public TopicInfo getTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String topicName)
Description copied from interface:DiscussionServiceRetrieves an existingTopicInfofrom the repository, which is attached to the specified Node. The parent Node should normally either be a Site Container, or aForumModel.TYPE_FORUM- Specified by:
getTopicin interfaceDiscussionService
-
getPost
public PostInfo getPost(TopicInfo topic, String postName)
Description copied from interface:DiscussionServiceRetrieves an existingPostInfofrom the repository- Specified by:
getPostin interfaceDiscussionService
-
createTopic
public TopicInfo createTopic(String siteShortName, String title)
Description copied from interface:DiscussionServiceCreates a newTopicInfoin the given site- Specified by:
createTopicin interfaceDiscussionService
-
createTopic
public TopicInfo createTopic(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String title)
Description copied from interface:DiscussionServiceCreates a newTopicInfoattached to the specified Node. The parent Node should normally either be a Site Container, or aForumModel.TYPE_FORUM- Specified by:
createTopicin interfaceDiscussionService
-
createPost
public PostInfo createPost(TopicInfo topic, String contents)
Description copied from interface:DiscussionServiceCreates a newPostInfoin 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 theDiscussionService.getPrimaryPost(TopicInfo)primary post.- Specified by:
createPostin interfaceDiscussionService- Returns:
- The newly created
PostInfo
-
createReply
public PostInfo createReply(PostInfo parentPost, String contents)
Description copied from interface:DiscussionServiceCreates a newPostInfowhich 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:
createReplyin interfaceDiscussionService- Returns:
- The newly created
PostInfo
-
updateTopic
public TopicInfo updateTopic(TopicInfo topic)
Description copied from interface:DiscussionServiceUpdates an existingTopicInfoin the repository.- Specified by:
updateTopicin interfaceDiscussionService- Returns:
- The updated
TopicInfo
-
updatePost
public PostInfo updatePost(PostInfo post)
Description copied from interface:DiscussionServiceUpdates an existingPostInfoin the repository.- Specified by:
updatePostin interfaceDiscussionService- Returns:
- The updated
PostInfo
-
deleteTopic
public void deleteTopic(TopicInfo topic)
Description copied from interface:DiscussionServiceDeletes an existingTopicInfofrom the repository- Specified by:
deleteTopicin interfaceDiscussionService
-
deletePost
public void deletePost(PostInfo post)
Description copied from interface:DiscussionServiceDeletes an existingPostInfofrom the repository- Specified by:
deletePostin interfaceDiscussionService
-
getForNodeRef
public org.alfresco.util.Pair<TopicInfo,PostInfo> getForNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface:DiscussionServiceFor a given NodeRef corresponding to either aTopicInfoor aPostInfo, 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:
getForNodeRefin interfaceDiscussionService
-
getPrimaryPost
public PostInfo getPrimaryPost(TopicInfo topic)
Description copied from interface:DiscussionServiceRetrieves the Primary (Root) Post in a topic, to which all replies belong. Returns null if the topic currently has no posts- Specified by:
getPrimaryPostin interfaceDiscussionService
-
getMostRecentPost
public PostInfo getMostRecentPost(TopicInfo topic)
Description copied from interface:DiscussionServiceRetrieves 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:
getMostRecentPostin interfaceDiscussionService
-
listTopics
public org.alfresco.query.PagingResults<TopicInfo> listTopics(String siteShortName, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all topics in a site, sorted by either oldest or newest topics first.- Specified by:
listTopicsin interfaceDiscussionService
-
listTopics
public org.alfresco.query.PagingResults<TopicInfo> listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all topics attached to the specified Node, sorted by either oldest or newest topics first.- Specified by:
listTopicsin interfaceDiscussionService
-
listTopics
public org.alfresco.query.PagingResults<TopicInfo> listTopics(String siteShortName, String username, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all topics in a site, filtered by username, sorted by either oldest or newest topics first.- Specified by:
listTopicsin interfaceDiscussionService
-
listTopics
public org.alfresco.query.PagingResults<TopicInfo> listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, String username, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all topics attached to the specified Node, filtered by username, sorted by either oldest or newest topics first.- Specified by:
listTopicsin interfaceDiscussionService
-
listTopics
public org.alfresco.query.PagingResults<TopicInfo> listTopics(String siteShortName, Date from, Date to, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all topics in a site, created in the given date range, sorted by either oldest or newest topics first.- Specified by:
listTopicsin interfaceDiscussionService
-
listTopics
public org.alfresco.query.PagingResults<TopicInfo> listTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, Date from, Date to, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all topics attached to the specified Node, created in the given date range, sorted by either oldest or newest topics first.- Specified by:
listTopicsin interfaceDiscussionService
-
listHotTopics
public org.alfresco.query.PagingResults<org.alfresco.util.Pair<TopicInfo,Integer>> listHotTopics(String siteShortName, Date since, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceFinds 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:
listHotTopicsin interfaceDiscussionService
-
listHotTopics
public org.alfresco.query.PagingResults<org.alfresco.util.Pair<TopicInfo,Integer>> listHotTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, Date since, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceFinds 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:
listHotTopicsin interfaceDiscussionService
-
findTopics
public org.alfresco.query.PagingResults<TopicInfo> findTopics(String siteShortName, String username, String tag, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceSearches for all topics in a site, filtered by username or tag, sorted by either oldest or newest topics first.- Specified by:
findTopicsin interfaceDiscussionService
-
findTopics
public org.alfresco.query.PagingResults<TopicInfo> findTopics(org.alfresco.service.cmr.repository.NodeRef nodeRef, String username, String tag, boolean sortAscending, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceSearches for all topics attached to the specified Node, filtered by username or tag, sorted by either oldest or newest topics first.- Specified by:
findTopicsin interfaceDiscussionService
-
listPosts
public org.alfresco.query.PagingResults<PostInfo> listPosts(TopicInfo topic, org.alfresco.query.PagingRequest paging)
Description copied from interface:DiscussionServiceRetrieves all posts in a topic, ordered by creation date- Specified by:
listPostsin interfaceDiscussionService
-
listPostReplies
public PostWithReplies listPostReplies(TopicInfo topic, int levels)
Description copied from interface:DiscussionServiceRetrieves all replies on a Topic- Specified by:
listPostRepliesin interfaceDiscussionService
-
listPostReplies
public PostWithReplies listPostReplies(PostInfo primaryPost, int levels)
Description copied from interface:DiscussionServiceRetrieves all replies to a Post- Specified by:
listPostRepliesin interfaceDiscussionService
-
-