Search in sources :

Example 1 with CommentCountView

use of org.ambraproject.rhino.view.comment.CommentCountView in project rhino by PLOS.

the class CommentCrudServiceImpl method getCommentCount.

@Override
public ServiceResponse<CommentCountView> getCommentCount(Article article) {
    CommentCountView view = hibernateTemplate.execute((Session session) -> {
        long all = getCount(session, article, "AND isRemoved = FALSE");
        long root = getCount(session, article, "AND isRemoved = FALSE AND parent IS NULL");
        long removed = getCount(session, article, "AND isRemoved = TRUE");
        return new CommentCountView(all, root, removed);
    });
    return ServiceResponse.serveView(view);
}
Also used : CommentCountView(org.ambraproject.rhino.view.comment.CommentCountView) Session(org.hibernate.Session)

Aggregations

CommentCountView (org.ambraproject.rhino.view.comment.CommentCountView)1 Session (org.hibernate.Session)1