use of com.sun.syndication.feed.synd.SyndEntryImpl in project opennms by OpenNMS.
the class NotificationFeed method getFeed.
/**
* <p>getFeed</p>
*
* @return a {@link com.sun.syndication.feed.synd.SyndFeed} object.
*/
@Override
public SyndFeed getFeed() {
SyndFeed feed = new SyndFeedImpl();
feed.setTitle("Notifications");
feed.setDescription("Notifications");
feed.setLink(getUrlBase() + "notification/browse");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
try {
NotificationModel model = new NotificationModel();
Notification[] notifications = model.allNotifications("desc");
SyndEntry entry;
int count = 0;
for (Notification notification : notifications) {
if (count++ == this.getMaxEntries()) {
break;
}
entry = new SyndEntryImpl();
entry.setPublishedDate(notification.getTimeSent());
if (notification.getTimeReplied() == null) {
entry.setTitle(sanitizeTitle(notification.getTextMessage()));
entry.setUpdatedDate(notification.getTimeSent());
} else {
entry.setTitle(sanitizeTitle(notification.getTextMessage()) + " (acknowledged)");
entry.setUpdatedDate(notification.getTimeReplied());
}
entry.setLink(getUrlBase() + "notification/detail.jsp?notice=" + notification.getId());
entry.setAuthor("OpenNMS");
entries.add(entry);
}
} catch (SQLException e) {
LOG.warn("unable to get outstanding notifications", e);
}
feed.setEntries(entries);
return feed;
}
use of com.sun.syndication.feed.synd.SyndEntryImpl in project maven-plugins by apache.
the class FeedGenerator method getEntries.
private List<SyndEntry> getEntries(final List<Release> releases) {
final List<SyndEntry> entries = new ArrayList<SyndEntry>(1);
if (releases.size() > 0) {
// TODO: is this guaranteed to be the latest?
final Release release = releases.get(0);
final SyndEntry entry = new SyndEntryImpl();
entry.setTitle(release.getVersion());
entry.setLink(link + "#" + HtmlTools.encodeId(release.getVersion()));
entry.setDescription(getSyndContent(release));
entry.setPublishedDate(getDate(release.getDateRelease(), dateFormat));
entries.add(entry);
}
return entries;
}
Aggregations