public RssData view() {
Question latestQuestion = questionService.findQuestionForDate(new JDateTime());
List<Question> questions = questionService.findPreviousQuestions(latestQuestion, 24);
questions.add(0, latestQuestion);
Feed feed = new Feed();
feed.setTitle("uphea.com");
feed.setLink("http://uphea.com");
feed.setDescription("the nice way of asking smart questions");
feed.setEncoding(StringPool.UTF_8);
feed.setPublishedDate(DateUtil.toJDateTime(latestQuestion.getDate()));
for (Question q : questions) {
FeedEntry entry = new FeedEntry();
entry.setPublishedDate(DateUtil.toJDateTime(q.getDate()));
entry.setTitle(Format.textPlain(q.getText()));
String link = feed.getLink() + "/q/" + q.getDate();
entry.setLink(link);
entry.setGuid(link);
entry.setDescription("What do you think about?");
feed.addEntry(entry);
}
return new RssData(feed);
}