Search in sources :

Example 1 with BlogEntity

use of org.alfresco.repo.blog.cannedqueries.BlogEntity in project alfresco-repository by Alfresco.

the class BlogServiceImpl method getPublished.

@Override
public PagingResults<BlogPostInfo> getPublished(NodeRef blogContainerNode, Date fromDate, Date toDate, String byUser, PagingRequest pagingReq) {
    ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
    ParameterCheck.mandatory("pagingReq", pagingReq);
    // get canned query
    GetBlogPostsCannedQuery cq = (GetBlogPostsCannedQuery) publishedPostsCannedQueryFactory.getGetPublishedCannedQuery(blogContainerNode, fromDate, toDate, byUser, pagingReq);
    // execute canned query
    CannedQueryResults<BlogEntity> results = cq.execute();
    return wrap(results, blogContainerNode);
}
Also used : BlogEntity(org.alfresco.repo.blog.cannedqueries.BlogEntity) GetBlogPostsCannedQuery(org.alfresco.repo.blog.cannedqueries.GetBlogPostsCannedQuery)

Example 2 with BlogEntity

use of org.alfresco.repo.blog.cannedqueries.BlogEntity in project alfresco-repository by Alfresco.

the class BlogServiceImpl method getMyDraftsAndAllPublished.

/**
 * @deprecated
 */
@Override
public PagingResults<BlogPostInfo> getMyDraftsAndAllPublished(NodeRef blogContainerNode, Date createdFrom, Date createdTo, PagingRequest pagingReq) {
    ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
    ParameterCheck.mandatory("pagingReq", pagingReq);
    // get canned query
    String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
    DraftsAndPublishedBlogPostsCannedQuery cq = (DraftsAndPublishedBlogPostsCannedQuery) draftsAndPublishedBlogPostsCannedQueryFactory.getCannedQuery(blogContainerNode, createdFrom, createdTo, currentUser, pagingReq);
    // execute canned query
    CannedQueryResults<BlogEntity> results = cq.execute();
    return wrap(results, blogContainerNode);
}
Also used : BlogEntity(org.alfresco.repo.blog.cannedqueries.BlogEntity) DraftsAndPublishedBlogPostsCannedQuery(org.alfresco.repo.blog.cannedqueries.DraftsAndPublishedBlogPostsCannedQuery)

Example 3 with BlogEntity

use of org.alfresco.repo.blog.cannedqueries.BlogEntity in project alfresco-repository by Alfresco.

the class BlogServiceImpl method wrap.

private PagingResults<BlogPostInfo> wrap(final CannedQueryResults<BlogEntity> results, final NodeRef containerNodeRef) {
    // Wrap
    return new PagingResults<BlogPostInfo>() {

        @Override
        public String getQueryExecutionId() {
            return results.getQueryExecutionId();
        }

        @Override
        public Pair<Integer, Integer> getTotalResultCount() {
            return results.getTotalResultCount();
        }

        @Override
        public boolean hasMoreItems() {
            return results.hasMoreItems();
        }

        @Override
        public List<BlogPostInfo> getPage() {
            List<BlogEntity> entities = results.getPage();
            List<BlogPostInfo> posts = new ArrayList<BlogPostInfo>(entities.size());
            for (BlogEntity entity : entities) {
                posts.add(new BlogPostInfoImpl(entity.getNodeRef(), containerNodeRef, entity.getName()));
            }
            return posts;
        }
    };
}
Also used : BlogEntity(org.alfresco.repo.blog.cannedqueries.BlogEntity) EmptyPagingResults(org.alfresco.query.EmptyPagingResults) PagingResults(org.alfresco.query.PagingResults) ArrayList(java.util.ArrayList) BlogPostInfo(org.alfresco.service.cmr.blog.BlogPostInfo)

Example 4 with BlogEntity

use of org.alfresco.repo.blog.cannedqueries.BlogEntity in project alfresco-repository by Alfresco.

the class BlogServiceImpl method getDrafts.

@Override
public PagingResults<BlogPostInfo> getDrafts(NodeRef blogContainerNode, String username, PagingRequest pagingReq) {
    ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
    ParameterCheck.mandatory("pagingReq", pagingReq);
    // get canned query
    GetBlogPostsCannedQuery cq = (GetBlogPostsCannedQuery) draftPostsCannedQueryFactory.getGetDraftsCannedQuery(blogContainerNode, username, pagingReq);
    // execute canned query
    CannedQueryResults<BlogEntity> results = cq.execute();
    return wrap(results, blogContainerNode);
}
Also used : BlogEntity(org.alfresco.repo.blog.cannedqueries.BlogEntity) GetBlogPostsCannedQuery(org.alfresco.repo.blog.cannedqueries.GetBlogPostsCannedQuery)

Aggregations

BlogEntity (org.alfresco.repo.blog.cannedqueries.BlogEntity)4 GetBlogPostsCannedQuery (org.alfresco.repo.blog.cannedqueries.GetBlogPostsCannedQuery)2 ArrayList (java.util.ArrayList)1 EmptyPagingResults (org.alfresco.query.EmptyPagingResults)1 PagingResults (org.alfresco.query.PagingResults)1 DraftsAndPublishedBlogPostsCannedQuery (org.alfresco.repo.blog.cannedqueries.DraftsAndPublishedBlogPostsCannedQuery)1 BlogPostInfo (org.alfresco.service.cmr.blog.BlogPostInfo)1