mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-10429 / ALF-10413 - Start to refactor the blog service to match the other new services, as a precursor to fixing the paging bug
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31166 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,7 +24,6 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.query.PagingResults;
|
||||
import org.alfresco.repo.blog.BlogIntegrationService;
|
||||
import org.alfresco.repo.security.permissions.PermissionCheckValue;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteService;
|
||||
@@ -42,6 +41,20 @@ import org.alfresco.service.namespace.QName;
|
||||
*/
|
||||
public interface BlogService
|
||||
{
|
||||
/**
|
||||
* Creates a new blog post in the specified site
|
||||
*
|
||||
* @param siteShortName the name of the site to add the post to.
|
||||
* @param blogTitle the title of the blog post.
|
||||
* @param blogContent text/html content of the blog post.
|
||||
* @param isDraft <tt>true</tt> if the blog post is a draft post, else <tt>false</tt>.
|
||||
*
|
||||
* @return The {@link BlogPostInfo} of the newly created blog post.
|
||||
*
|
||||
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
|
||||
*/
|
||||
BlogPostInfo createBlogPost(String siteShortName, String blogTitle, String blogContent, boolean isDraft);
|
||||
|
||||
/**
|
||||
* Creates a new blog post within the specified container node.
|
||||
*
|
||||
@@ -56,6 +69,31 @@ public interface BlogService
|
||||
*/
|
||||
BlogPostInfo createBlogPost(NodeRef blogContainerNode, String blogTitle, String blogContent, boolean isDraft);
|
||||
|
||||
/**
|
||||
* Updates an existing {@link BlogPostInfo} in the repository.
|
||||
*
|
||||
* @return The updated {@link BlogPostInfo}
|
||||
*/
|
||||
BlogPostInfo updateBlogPost(BlogPostInfo post);
|
||||
|
||||
/**
|
||||
* Deletes an existing {@link BlogPostInfo} from the repository.
|
||||
*/
|
||||
void deleteBlogPost(BlogPostInfo post);
|
||||
|
||||
/**
|
||||
* Gets the draft blog posts created by the specified user.
|
||||
*
|
||||
* @param siteShortName the name of the site to add the post to.
|
||||
* @param username to limit results to blogs with this cm:creator. <tt>null</tt> means all users.
|
||||
* @param pagingReq an object defining the paging parameters for the result set.
|
||||
*
|
||||
* @return a {@link PagingResults} object containing some or all of the results (subject to paging).
|
||||
*
|
||||
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
|
||||
*/
|
||||
PagingResults<BlogPostInfo> getDrafts(String siteShortName, String username, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Gets the draft blog posts created by the specified user.
|
||||
*
|
||||
@@ -69,6 +107,22 @@ public interface BlogService
|
||||
*/
|
||||
PagingResults<BlogPostInfo> getDrafts(NodeRef blogContainerNode, String username, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Gets the (internally, Alfresco-) published blog posts.
|
||||
*
|
||||
* @param siteShortName the name of the site to add the post to.
|
||||
* @param fromDate an inclusive date limit for the results (more recent than).
|
||||
* @param toDate an inclusive date limit for the results (before).
|
||||
* @param byUser if not <tt>null</tt> limits results to posts by the specified user.
|
||||
* if <tt>null</tt> results will be by all users.
|
||||
* @param pagingReq an object defining the paging parameters for the result set.
|
||||
*
|
||||
* @return a {@link PagingResults} object containing some or all of the results (subject to paging).
|
||||
*
|
||||
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
|
||||
*/
|
||||
PagingResults<BlogPostInfo> getPublished(String siteShortName, Date fromDate, Date toDate, String byUser, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Gets the (internally, Alfresco-) published blog posts.
|
||||
*
|
||||
@@ -85,6 +139,18 @@ public interface BlogService
|
||||
*/
|
||||
PagingResults<BlogPostInfo> getPublished(NodeRef blogContainerNode, Date fromDate, Date toDate, String byUser, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Gets blog posts published externally (i.e. to an external blog hosting site).
|
||||
*
|
||||
* @param siteShortName the name of the site to add the post to.
|
||||
* @param pagingReq an object defining the paging parameters for the result set.
|
||||
*
|
||||
* @return a {@link PagingResults} object containing some or all of the results (subject to paging).
|
||||
*
|
||||
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
|
||||
*/
|
||||
PagingResults<BlogPostInfo> getPublishedExternally(String siteShortName, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Gets blog posts published externally (i.e. to an external blog hosting site).
|
||||
*
|
||||
@@ -113,6 +179,22 @@ public interface BlogService
|
||||
*/
|
||||
PagingResults<BlogPostInfo> getMyDraftsAndAllPublished(NodeRef blogContainerNode, Date fromDate, Date toDate, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Finds blog posts by the specified user tagged with the given tag string. This method allows date ranges to be applied to any valid
|
||||
* {@link DataTypeDefinition#DATE} or {@link DataTypeDefinition#DATETIME} property. Examples include {@link ContentModel#PROP_CREATED} or
|
||||
* {@link ContentModel#PROP_PUBLISHED}.
|
||||
*
|
||||
* @param siteShortName the name of the site to add the post to.
|
||||
* @param dateRange a {@link RangedDateProperty} parameter object. Can be null.
|
||||
* @param tag tag string.
|
||||
* @param pagingReq an object defining the paging parameters for the result set.
|
||||
*
|
||||
* @return a {@link PagingResults} object containing some or all of the results (subject to paging).
|
||||
*
|
||||
* @see SiteService#getContainer(String, String) to retrieve the blogContainerNode
|
||||
*/
|
||||
PagingResults<BlogPostInfo> findBlogPosts(String siteShortName, RangedDateProperty dateRange, String tag, PagingRequest pagingReq);
|
||||
|
||||
/**
|
||||
* Finds blog posts by the specified user tagged with the given tag string. This method allows date ranges to be applied to any valid
|
||||
* {@link DataTypeDefinition#DATE} or {@link DataTypeDefinition#DATETIME} property. Examples include {@link ContentModel#PROP_CREATED} or
|
||||
@@ -134,44 +216,11 @@ public interface BlogService
|
||||
*
|
||||
* @param blogPostNode a NodeRef representing a blog-post.
|
||||
* @return <tt>true</tt> if it is a draft post, else <tt>false</tt>.
|
||||
*
|
||||
* @deprecated Add this to the BlogPostInfo shortly
|
||||
*/
|
||||
boolean isDraftBlogPost(NodeRef blogPostNode);
|
||||
|
||||
/**
|
||||
* A simple data object for storage of blog-related data.
|
||||
*
|
||||
* @author Neil Mc Erlean
|
||||
* @since 4.0
|
||||
*/
|
||||
public class BlogPostInfo implements PermissionCheckValue
|
||||
{
|
||||
private final NodeRef nodeRef;
|
||||
private final String name;
|
||||
|
||||
public BlogPostInfo(NodeRef nodeRef, String name)
|
||||
{
|
||||
this.nodeRef = nodeRef;
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* Gets the NodeRef representing this blog-post.
|
||||
*/
|
||||
@Override
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link ContentModel#PROP_NAME cm:name} of the blog post.
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple data object for expressing a date range search parameter.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user