Package org.alfresco.repo.blog
Class BlogServiceImpl
- java.lang.Object
-
- org.alfresco.repo.blog.BlogServiceImpl
-
- All Implemented Interfaces:
BlogService
public class BlogServiceImpl extends Object implements BlogService
- Since:
- 4.0
- Author:
- Neil Mc Erlean (based on existing webscript controllers in the REST API)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.alfresco.service.cmr.blog.BlogService
BlogService.RangedDateProperty
-
-
Field Summary
Fields Modifier and Type Field Description static StringBLOG_COMPONENT
-
Constructor Summary
Constructors Constructor Description BlogServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BlogPostInfocreateBlogPost(String siteShortName, String blogTitle, String blogContent, boolean isDraft)Creates a new blog post in the specified siteBlogPostInfocreateBlogPost(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, String blogTitle, String blogContent, boolean isDraft)Creates a new blog post within the specified container node.voiddeleteBlogPost(BlogPostInfo post)Deletes an existingBlogPostInfofrom the repository.org.alfresco.query.PagingResults<BlogPostInfo>findBlogPosts(String siteShortName, BlogService.RangedDateProperty dateRange, String tag, org.alfresco.query.PagingRequest pagingReq)Finds blog posts by the specified user tagged with the given tag string.org.alfresco.query.PagingResults<BlogPostInfo>findBlogPosts(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, BlogService.RangedDateProperty dateRange, String tag, org.alfresco.query.PagingRequest pagingReq)Finds blog posts by the specified user tagged with the given tag string.BlogPostInfogetBlogPost(String siteShortName, String postName)Retrieves an existingBlogPostInfofrom the repository, which is within a siteBlogPostInfogetBlogPost(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String postName)Retrieves an existingBlogPostInfofrom the repository, which is attached to the specified Node.org.alfresco.query.PagingResults<BlogPostInfo>getDrafts(String siteShortName, String username, org.alfresco.query.PagingRequest pagingReq)Gets the draft blog posts created by the specified user.org.alfresco.query.PagingResults<BlogPostInfo>getDrafts(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, String username, org.alfresco.query.PagingRequest pagingReq)Gets the draft blog posts created by the specified user.BlogPostInfogetForNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)For a given NodeRef corresponding to aBlogPostInfo, returns the object wrapping the Node.org.alfresco.query.PagingResults<BlogPostInfo>getMyDraftsAndAllPublished(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, Date createdFrom, Date createdTo, org.alfresco.query.PagingRequest pagingReq)Deprecated.org.alfresco.query.PagingResults<BlogPostInfo>getPublished(String siteShortName, Date fromDate, Date toDate, String byUser, org.alfresco.query.PagingRequest pagingReq)Gets the (internally, Alfresco-) published blog posts.org.alfresco.query.PagingResults<BlogPostInfo>getPublished(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, Date fromDate, Date toDate, String byUser, org.alfresco.query.PagingRequest pagingReq)Gets the (internally, Alfresco-) published blog posts.org.alfresco.query.PagingResults<BlogPostInfo>getPublishedExternally(String siteShortName, org.alfresco.query.PagingRequest pagingReq)Gets blog posts published externally (i.e.org.alfresco.query.PagingResults<BlogPostInfo>getPublishedExternally(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, org.alfresco.query.PagingRequest pagingReq)Gets blog posts published externally (i.e.protected org.alfresco.service.cmr.repository.NodeRefgetSiteBlogContainer(String siteShortName, boolean create)Fetches the Blogs Container on a site, creating as required if requested.booleanisDraftBlogPost(org.alfresco.service.cmr.repository.NodeRef blogPostNode)Returns true if the specified blog-post node is a 'draft' blog post.voidsetCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<BlogPostInfo>> cannedQueryRegistry)voidsetContentService(ContentService contentService)voidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)voidsetDraftBlogPostsCannedQueryFactory(GetBlogPostsCannedQueryFactory cannedQueryFactory)voidsetDraftsAndPublishedBlogPostsCannedQueryFactory(DraftsAndPublishedBlogPostsCannedQueryFactory cannedQueryFactory)voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)voidsetNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)voidsetPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)voidsetPublishedBlogPostsCannedQueryFactory(GetBlogPostsCannedQueryFactory cannedQueryFactory)voidsetPublishedExternallyBlogPostsCannedQueryFactory(GetBlogPostsCannedQueryFactory cannedQueryFactory)voidsetSearchService(org.alfresco.service.cmr.search.SearchService searchService)voidsetSiteService(SiteService siteService)voidsetTaggingService(TaggingService taggingService)voidsetTransactionService(TransactionService transactionService)BlogPostInfoupdateBlogPost(BlogPostInfo post)Updates an existingBlogPostInfoin the repository.
-
-
-
Field Detail
-
BLOG_COMPONENT
public static final String BLOG_COMPONENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
setCannedQueryRegistry
public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry<org.alfresco.query.CannedQueryFactory<BlogPostInfo>> cannedQueryRegistry)
-
setDraftBlogPostsCannedQueryFactory
public void setDraftBlogPostsCannedQueryFactory(GetBlogPostsCannedQueryFactory cannedQueryFactory)
-
setPublishedBlogPostsCannedQueryFactory
public void setPublishedBlogPostsCannedQueryFactory(GetBlogPostsCannedQueryFactory cannedQueryFactory)
-
setPublishedExternallyBlogPostsCannedQueryFactory
public void setPublishedExternallyBlogPostsCannedQueryFactory(GetBlogPostsCannedQueryFactory cannedQueryFactory)
-
setDraftsAndPublishedBlogPostsCannedQueryFactory
public void setDraftsAndPublishedBlogPostsCannedQueryFactory(DraftsAndPublishedBlogPostsCannedQueryFactory cannedQueryFactory)
-
setContentService
public void setContentService(ContentService contentService)
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
-
setNamespaceService
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
-
setSiteService
public void setSiteService(SiteService siteService)
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
-
setPermissionService
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
-
setTaggingService
public void setTaggingService(TaggingService taggingService)
-
setSearchService
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
-
getSiteBlogContainer
protected org.alfresco.service.cmr.repository.NodeRef getSiteBlogContainer(String siteShortName, boolean create)
Fetches the Blogs Container on a site, creating as required if requested.
-
isDraftBlogPost
public boolean isDraftBlogPost(org.alfresco.service.cmr.repository.NodeRef blogPostNode)
Description copied from interface:BlogServiceReturns true if the specified blog-post node is a 'draft' blog post.- Specified by:
isDraftBlogPostin interfaceBlogService- Parameters:
blogPostNode- a NodeRef representing a blog-post.- Returns:
- true if it is a draft post, else false.
-
createBlogPost
public BlogPostInfo createBlogPost(String siteShortName, String blogTitle, String blogContent, boolean isDraft)
Description copied from interface:BlogServiceCreates a new blog post in the specified site- Specified by:
createBlogPostin interfaceBlogService- Parameters:
siteShortName- the name of the site to add the post to.blogTitle- the title of the blog post.blogContent- text/html content of the blog post.isDraft- true if the blog post is a draft post, else false.- Returns:
- The
BlogPostInfoof the newly created blog post. - See Also:
to retrieve the blogContainerNode
-
createBlogPost
public BlogPostInfo createBlogPost(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, String blogTitle, String blogContent, boolean isDraft)
Description copied from interface:BlogServiceCreates a new blog post within the specified container node.- Specified by:
createBlogPostin interfaceBlogService- Parameters:
blogContainerNode- the container node for blog posts (under the site).blogTitle- the title of the blog post.blogContent- text/html content of the blog post.isDraft- true if the blog post is a draft post, else false.- Returns:
- The
BlogPostInfoof the newly created blog post. - See Also:
to retrieve the blogContainerNode
-
updateBlogPost
public BlogPostInfo updateBlogPost(BlogPostInfo post)
Description copied from interface:BlogServiceUpdates an existingBlogPostInfoin the repository.- Specified by:
updateBlogPostin interfaceBlogService- Returns:
- The updated
BlogPostInfo
-
deleteBlogPost
public void deleteBlogPost(BlogPostInfo post)
Description copied from interface:BlogServiceDeletes an existingBlogPostInfofrom the repository.- Specified by:
deleteBlogPostin interfaceBlogService
-
getForNodeRef
public BlogPostInfo getForNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Description copied from interface:BlogServiceFor a given NodeRef corresponding to aBlogPostInfo, returns the object wrapping the Node. For anything else, the response is null.- Specified by:
getForNodeRefin interfaceBlogService
-
getBlogPost
public BlogPostInfo getBlogPost(String siteShortName, String postName)
Description copied from interface:BlogServiceRetrieves an existingBlogPostInfofrom the repository, which is within a site- Specified by:
getBlogPostin interfaceBlogService
-
getBlogPost
public BlogPostInfo getBlogPost(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String postName)
Description copied from interface:BlogServiceRetrieves an existingBlogPostInfofrom the repository, which is attached to the specified Node. The parent Node should normally be a Site Container- Specified by:
getBlogPostin interfaceBlogService
-
getDrafts
public org.alfresco.query.PagingResults<BlogPostInfo> getDrafts(String siteShortName, String username, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceGets the draft blog posts created by the specified user.- Specified by:
getDraftsin interfaceBlogService- Parameters:
siteShortName- the name of the site to add the post to.username- to limit results to blogs with this cm:creator. null means all users.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
getDrafts
public org.alfresco.query.PagingResults<BlogPostInfo> getDrafts(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, String username, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceGets the draft blog posts created by the specified user.- Specified by:
getDraftsin interfaceBlogService- Parameters:
blogContainerNode- the container node for blog posts (under the site).username- to limit results to blogs with this cm:creator. null means all users.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
getPublishedExternally
public org.alfresco.query.PagingResults<BlogPostInfo> getPublishedExternally(String siteShortName, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceGets blog posts published externally (i.e. to an external blog hosting site).- Specified by:
getPublishedExternallyin interfaceBlogService- Parameters:
siteShortName- the name of the site to add the post to.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
getPublishedExternally
public org.alfresco.query.PagingResults<BlogPostInfo> getPublishedExternally(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceGets blog posts published externally (i.e. to an external blog hosting site).- Specified by:
getPublishedExternallyin interfaceBlogService- Parameters:
blogContainerNode- the container node for blog posts (under the site).pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
getPublished
public org.alfresco.query.PagingResults<BlogPostInfo> getPublished(String siteShortName, Date fromDate, Date toDate, String byUser, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceGets the (internally, Alfresco-) published blog posts.- Specified by:
getPublishedin interfaceBlogService- Parameters:
siteShortName- the name of the site to add the post to.fromDate- an inclusive date limit for the results (more recent than).toDate- an inclusive date limit for the results (before).byUser- if not null limits results to posts by the specified user. if null results will be by all users.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
getPublished
public org.alfresco.query.PagingResults<BlogPostInfo> getPublished(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, Date fromDate, Date toDate, String byUser, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceGets the (internally, Alfresco-) published blog posts.- Specified by:
getPublishedin interfaceBlogService- Parameters:
blogContainerNode- the container node for blog posts (under the site).fromDate- an inclusive date limit for the results (more recent than).toDate- an inclusive date limit for the results (before).byUser- if not null limits results to posts by the specified user. if null results will be by all users.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
getMyDraftsAndAllPublished
public org.alfresco.query.PagingResults<BlogPostInfo> getMyDraftsAndAllPublished(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, Date createdFrom, Date createdTo, org.alfresco.query.PagingRequest pagingReq)
Deprecated.Description copied from interface:BlogServiceGets draft blog posts by the currently authenticated user along with all published posts.- Specified by:
getMyDraftsAndAllPublishedin interfaceBlogService- Parameters:
blogContainerNode- the container node for blog posts (under the site).createdFrom- an inclusive date limit for the results (more recent than).createdTo- an inclusive date limit for the results (before).pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
findBlogPosts
public org.alfresco.query.PagingResults<BlogPostInfo> findBlogPosts(String siteShortName, BlogService.RangedDateProperty dateRange, String tag, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceFinds blog posts by the specified user tagged with the given tag string. This method allows date ranges to be applied to any validDataTypeDefinition.DATEorDataTypeDefinition.DATETIMEproperty. Examples includeContentModel.PROP_CREATEDorContentModel.PROP_PUBLISHED.- Specified by:
findBlogPostsin interfaceBlogService- Parameters:
siteShortName- the name of the site to add the post to.dateRange- aBlogService.RangedDatePropertyparameter object. Can be null.tag- tag string.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
findBlogPosts
public org.alfresco.query.PagingResults<BlogPostInfo> findBlogPosts(org.alfresco.service.cmr.repository.NodeRef blogContainerNode, BlogService.RangedDateProperty dateRange, String tag, org.alfresco.query.PagingRequest pagingReq)
Description copied from interface:BlogServiceFinds blog posts by the specified user tagged with the given tag string. This method allows date ranges to be applied to any validDataTypeDefinition.DATEorDataTypeDefinition.DATETIMEproperty. Examples includeContentModel.PROP_CREATEDorContentModel.PROP_PUBLISHED.- Specified by:
findBlogPostsin interfaceBlogService- Parameters:
blogContainerNode- the container node for blog posts (under the site).dateRange- aBlogService.RangedDatePropertyparameter object. Can be null.tag- tag string.pagingReq- an object defining the paging parameters for the result set.- Returns:
- a
PagingResultsobject containing some or all of the results (subject to paging). - See Also:
to retrieve the blogContainerNode
-
-