com.sun.syndication.feed.synd.SyndCategory Java Examples

The following examples show how to use com.sun.syndication.feed.synd.SyndCategory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RSSGenServlet.java    From jivejdon with Apache License 2.0 5 votes vote down vote up
private void addMessage(String url, List<SyndEntrySorted> entries, ForumMessage message, HttpServletRequest request) {
	try {
		SyndEntrySorted entry = new SyndEntrySorted();
		entry.setTitle(message.getMessageVO().getSubject());
		entry.setLink(getItemLink(url, message, request));

		Date publishedDate = Constants.parseDateTime(message.getCreationDate());
		entry.setPublishedDate(publishedDate);
		entry.setAuthor(message.getAccount().getUsername());
		Date updateDate = Constants.parseDateTime(message.getModifiedDate());
		entry.setUpdatedDate(updateDate);

		SyndContent description = new SyndContentImpl();
		description.setType("text/html");
		description.setValue(message.getMessageVO().getShortBody(300));
		entry.setDescription(description);

		if (message.isRoot()) {
			List<SyndCategory> cats = new ArrayList<SyndCategory>();
			for (Object o : message.getForumThread().getTags()) {
				ThreadTag tag = (ThreadTag) o;
				SyndCategory cat = new SyndCategoryImpl();

				cat.setTaxonomyUri(url + "/tags/" + tag.getTagID());
				cat.setName(tag.getTitle());
				cats.add(cat);
			}
			entry.setCategories(cats);
		}
		entries.add(entry);
	} catch (Exception e) {
		e.printStackTrace();
	}
}