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);
}
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);
}
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;
}
};
}
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);
}
Aggregations