mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-9385. Refactoring of the findTaggedBlogPosts method.
Now a more general findBlogPosts(), which simplifies the webscript implementation slightly & removes possibility of an UnsupportedOperationException. Also added new test case that finds before/after/within specified date ranges. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28988 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,12 +24,14 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.query.PagingRequest;
|
||||
import org.alfresco.query.PagingResults;
|
||||
import org.alfresco.repo.web.scripts.blogs.AbstractBlogWebScript;
|
||||
import org.alfresco.repo.web.scripts.blogs.BlogPostLibJs;
|
||||
import org.alfresco.repo.web.scripts.blogs.RequestUtilsLibJs;
|
||||
import org.alfresco.service.cmr.blog.BlogService.BlogPostInfo;
|
||||
import org.alfresco.service.cmr.blog.BlogService.RangedDateProperty;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -174,15 +176,9 @@ public abstract class AbstractGetBlogWebScript extends AbstractBlogWebScript
|
||||
{
|
||||
return getBlogResultsImpl(node, fromDate, toDate, pagingReq);
|
||||
}
|
||||
// and tag-based Lucene searches with no other query params
|
||||
else if (fromDate == null && toDate == null)
|
||||
{
|
||||
return blogService.findTaggedBlogPosts(node, tag, pagingReq);
|
||||
}
|
||||
// But we might change the below to use a Lucene query.
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException("Cannot get BlogPosts with both tags and date limits.");
|
||||
return blogService.findBlogPosts(node, new RangedDateProperty(fromDate, toDate, ContentModel.PROP_CREATED), tag, pagingReq);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user