Search in sources :

Example 16 with SyndEntryImpl

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;
}
Also used : SyndFeed(com.sun.syndication.feed.synd.SyndFeed) SQLException(java.sql.SQLException) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl) ArrayList(java.util.ArrayList) SyndFeedImpl(com.sun.syndication.feed.synd.SyndFeedImpl) NotificationModel(org.opennms.web.notification.NotificationModel) Notification(org.opennms.web.notification.Notification)

Example 17 with SyndEntryImpl

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;
}
Also used : SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl) ArrayList(java.util.ArrayList) Release(org.apache.maven.plugins.changes.model.Release)

Aggregations

SyndEntryImpl (com.sun.syndication.feed.synd.SyndEntryImpl)17 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)12 SyndFeed (com.sun.syndication.feed.synd.SyndFeed)10 ArrayList (java.util.ArrayList)10 SyndFeedImpl (com.sun.syndication.feed.synd.SyndFeedImpl)9 SyndContentImpl (com.sun.syndication.feed.synd.SyndContentImpl)8 SyndContent (com.sun.syndication.feed.synd.SyndContent)7 FeedException (com.sun.syndication.io.FeedException)4 Date (java.util.Date)4 SyndFeedOutput (com.sun.syndication.io.SyndFeedOutput)3 IOException (java.io.IOException)3 SQLException (java.sql.SQLException)3 FeedEntryModel (com.gitblit.models.FeedEntryModel)2 SyndCategory (com.sun.syndication.feed.synd.SyndCategory)2 OutputStreamWriter (java.io.OutputStreamWriter)2 OnmsSeverity (org.opennms.netmgt.model.OnmsSeverity)2 Filter (org.opennms.web.filter.Filter)2 Post (com.erudika.scoold.core.Post)1 Question (com.erudika.scoold.core.Question)1 GitBlitException (com.gitblit.GitBlitException)1