Search in sources :

Example 11 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project archiva by apache.

the class RssFeedGenerator method getEntries.

private List<SyndEntry> getEntries(List<RssFeedEntry> dataEntries) {
    List<SyndEntry> entries = new ArrayList<>();
    SyndEntry entry;
    SyndContent description;
    for (RssFeedEntry dataEntry : dataEntries) {
        entry = new SyndEntryImpl();
        entry.setTitle(dataEntry.getTitle());
        entry.setPublishedDate(dataEntry.getPublishedDate());
        description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue(dataEntry.getDescription());
        entry.setDescription(description);
        entries.add(entry);
    }
    return entries;
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl) ArrayList(java.util.ArrayList)

Example 12 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project modules.playframework.org by playframework.

the class FeedCreationActor method createFeed.

private void createFeed(List<HistoricalEvent> historicalEvents, String feedType, File outputDirectory, String classifier) {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType(feedType);
    feed.setTitle("Play! Modules");
    feed.setLink("http://modules.playframework.org");
    feed.setUri("http://modules.playframework.org");
    feed.setPublishedDate(new Date());
    feed.setDescription("The Play! Framework's module repository feed");
    List<SyndEntry> entries = new ArrayList<SyndEntry>(historicalEvents.size());
    for (HistoricalEvent historicalEvent : historicalEvents) {
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(historicalEvent.category);
        entry.setAuthor("Play framework modules");
        entry.setPublishedDate(historicalEvent.creationDate);
        // todo this will be the url of the module
        entry.setLink("http://modules.playframework.org");
        entry.setUri("mpo-he-" + historicalEvent.id);
        SyndContent description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue(historicalEvent.message);
        entry.setDescription(description);
        entries.add(entry);
    }
    feed.setEntries(entries);
    Writer writer = null;
    try {
        File outputFile = new File(outputDirectory, String.format("mpo.%s.xml", classifier));
        writer = new FileWriter(outputFile);
        SyndFeedOutput output = new SyndFeedOutput();
        output.output(feed, writer);
        writer.close();
    } catch (IOException e) {
        Logger.error(String.format("A problem occurred when generating the %s feed", classifier), e);
    } catch (FeedException e) {
        Logger.error(String.format("A problem occurred when generating the %s feed", classifier), e);
    } finally {
        IOUtils.close(writer);
    }
}
Also used : SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) HistoricalEvent(models.HistoricalEvent) FileWriter(java.io.FileWriter) FeedException(com.sun.syndication.io.FeedException) ArrayList(java.util.ArrayList) SyndFeedOutput(com.sun.syndication.io.SyndFeedOutput) IOException(java.io.IOException) Date(java.util.Date) SyndFeed(com.sun.syndication.feed.synd.SyndFeed) SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl) SyndFeedImpl(com.sun.syndication.feed.synd.SyndFeedImpl) File(java.io.File) FileWriter(java.io.FileWriter) Writer(java.io.Writer)

Example 13 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project play-cookbook by spinscale.

the class FeedResult method createEntry.

private SyndEntry createEntry(String title, String link, String description, Date createDate) {
    SyndEntry entry = new SyndEntryImpl();
    entry.setTitle(title);
    entry.setLink(link);
    entry.setPublishedDate(createDate);
    SyndContent entryDescription = new SyndContentImpl();
    entryDescription.setType("text/html");
    entryDescription.setValue(description);
    entry.setDescription(entryDescription);
    return entry;
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl)

Example 14 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project maven-plugins by apache.

the class FeedGenerator method getSyndContent.

private static SyndContent getSyndContent(final Release release) {
    final SyndContent syndContent = new SyndContentImpl();
    syndContent.setType("text/html");
    final StringBuilder sb = new StringBuilder(512);
    final String description = release.getDescription();
    if (description != null && description.trim().length() > 0) {
        sb.append("<p>").append(description).append("</p>");
    }
    // TODO: localize?
    sb.append("<p>Version ").append(release.getVersion()).append(" is available with ");
    sb.append(release.getActions().size()).append(" fixed issues.</p>");
    syndContent.setValue(sb.toString());
    return syndContent;
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl)

Aggregations

SyndContentImpl (com.sun.syndication.feed.synd.SyndContentImpl)14 SyndContent (com.sun.syndication.feed.synd.SyndContent)12 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)12 SyndEntryImpl (com.sun.syndication.feed.synd.SyndEntryImpl)12 SyndFeed (com.sun.syndication.feed.synd.SyndFeed)5 SyndFeedImpl (com.sun.syndication.feed.synd.SyndFeedImpl)5 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5 FeedException (com.sun.syndication.io.FeedException)3 SyndFeedOutput (com.sun.syndication.io.SyndFeedOutput)3 IOException (java.io.IOException)3 OutputStreamWriter (java.io.OutputStreamWriter)2 Post (com.erudika.scoold.core.Post)1 Question (com.erudika.scoold.core.Question)1 FeedEntryModel (com.gitblit.models.FeedEntryModel)1 KBArticle (com.liferay.knowledgebase.model.KBArticle)1 SystemException (com.liferay.portal.kernel.exception.SystemException)1 GeoRSSModule (com.sun.syndication.feed.module.georss.GeoRSSModule)1 SimpleModuleImpl (com.sun.syndication.feed.module.georss.SimpleModuleImpl)1 W3CGeoModuleImpl (com.sun.syndication.feed.module.georss.W3CGeoModuleImpl)1