From 1eacf6f493915b26a8556fc1f89f4f3bbba0effa Mon Sep 17 00:00:00 2001 From: "Benito J. Gonzalez" Date: Fri, 31 Aug 2018 12:12:08 -0700 Subject: [PATCH] enh(79): Add categories to news items. Resolves #79. --- .../jasig/portlet/newsreader/model/NewsFeedItem.java | 11 ++++++++++- .../newsreader/processor/RomeNewsProcessorImpl.java | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jasig/portlet/newsreader/model/NewsFeedItem.java b/src/main/java/org/jasig/portlet/newsreader/model/NewsFeedItem.java index e37714c7..e6155244 100644 --- a/src/main/java/org/jasig/portlet/newsreader/model/NewsFeedItem.java +++ b/src/main/java/org/jasig/portlet/newsreader/model/NewsFeedItem.java @@ -21,7 +21,7 @@ import java.util.Date; import java.util.List; -import com.fasterxml.jackson.annotation.JsonFormat; +import com.rometools.rome.feed.synd.SyndCategory; import com.rometools.rome.feed.synd.SyndPerson; /** @@ -40,6 +40,7 @@ public class NewsFeedItem implements Comparable { private String uri; private FullStory fullStory; private Date pubDate; + private List categories; public String getImageUrl() { return imageUrl; @@ -121,6 +122,14 @@ public void setPubDate(Date pubDate) { this.pubDate = pubDate; } + public List getCategories() { + return categories; + } + + public void setCategories(List categories) { + this.categories = categories; + } + @Override public int compareTo(NewsFeedItem that) { if (this.pubDate == null) { diff --git a/src/main/java/org/jasig/portlet/newsreader/processor/RomeNewsProcessorImpl.java b/src/main/java/org/jasig/portlet/newsreader/processor/RomeNewsProcessorImpl.java index aced706b..523a92e1 100644 --- a/src/main/java/org/jasig/portlet/newsreader/processor/RomeNewsProcessorImpl.java +++ b/src/main/java/org/jasig/portlet/newsreader/processor/RomeNewsProcessorImpl.java @@ -102,6 +102,7 @@ public PaginatingNewsFeed getFeed(InputStream in, String titlePolicy, String des protected NewsFeedItem getNewsFeedItem(SyndEntry entry, String titlePolicy, String descriptionPolicy) throws PolicyException, ScanException { NewsFeedItem item = new NewsFeedItem(); item.setAuthors(entry.getAuthors()); + item.setCategories(entry.getCategories()); item.setLink(entry.getLink()); item.setUri(entry.getUri());