use of org.ambraproject.rhino.view.comment.CommentNodeView in project rhino by PLOS.
the class CommentCrudServiceImpl method getCommentsCreatedOn.
@Override
public ServiceResponse<Collection<CommentNodeView>> getCommentsCreatedOn(LocalDate date) {
Collection<CommentNodeView> views = hibernateTemplate.execute(session -> {
Query query = session.createQuery("FROM Comment WHERE DATE(created) = :date");
query.setParameter("date", java.sql.Date.valueOf(date));
Collection<Comment> comments = query.list();
return comments.stream().map(commentNodeViewFactory::create).collect(Collectors.toList());
});
return ServiceResponse.serveView(views);
}
Aggregations