public List<Topic> getTopicsForCategory(String id) { List<Topic> topics = this.repository.getTopicsForCategory(id); for (Topic topic : topics) { topic.setCommentsCount(repository.getCommentsCount(topic.getId())); } return topics; }
public void insertTopic(Topic topic) { Date date = new Date(); DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); topic.setDate(df.format(date)); this.repository.insert(topic); }