private void fillComments(ContextBuilder context, AEntity entity) { CommentDao commentDao = (CommentDao) entity.getDaoService().getDaoByClass(Comment.class); Collection<Comment> comments = commentDao.getPublishedCommentsByParent(entity); comments = Utl.sort(comments); for (Comment comment : comments) { fillComment(context.addSubContext("comments"), comment); } }
private Set<Comment> getComments(Collection<? extends AEntity> entities, boolean latestOnly) { Set<Comment> ret = new HashSet<Comment>(); for (AEntity entity : entities) { Set<Comment> comments = commentDao.getCommentsByParent(entity); ret.addAll(latestOnly ? getLatest(comments) : comments); } return ret; }
@Override public void onRequestComments(GwtConversation conversation, String parentId) { conversation.sendToClient(commentDao.getCommentsByParentId(parentId)); }