Search in sources :

Example 1 with SyndContentImpl

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

the class FeedDownloadTaskTest method syndEntry.

private SyndEntry syndEntry(String title, String link, String description, Date date) {
    SyndEntry entry = new SyndEntryImpl();
    entry.setLink(link);
    entry.setTitle(title);
    SyndContentImpl content = new SyndContentImpl();
    content.setValue(description);
    entry.setDescription(content);
    entry.setPublishedDate(date);
    return entry;
}
Also used : SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl)

Example 2 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project xwiki-platform by xwiki.

the class SyndEntryDocumentSource method getSyndContent.

/**
 * Creates a new {@link SyndContent} instance for the given content type and value.
 *
 * @param type content type
 * @param value the content
 * @return a new {@link SyndContent} instance
 */
protected SyndContent getSyndContent(String type, String value) {
    SyndContent content = new SyndContentImpl();
    content.setType(type);
    content.setValue(value);
    return content;
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl)

Example 3 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project wildfly-camel by wildfly-extras.

the class RSSFeedServlet method createFeedEntry.

private SyndEntry createFeedEntry(String title, String content, int index) {
    SyndEntry entry = new SyndEntryImpl();
    entry.setTitle(title + index);
    entry.setLink("http://localhost:8080/rss-tests/" + index);
    entry.setPublishedDate(new Date());
    SyndContent description = new SyndContentImpl();
    description.setType("text/plain");
    description.setValue(content + index);
    entry.setDescription(description);
    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) Date(java.util.Date)

Example 4 with SyndContentImpl

use of com.sun.syndication.feed.synd.SyndContentImpl in project ofbiz-framework by apache.

the class BlogRssServices method generateEntryList.

public static List<SyndEntry> generateEntryList(LocalDispatcher dispatcher, Delegator delegator, String contentId, String entryLink, Locale locale, GenericValue userLogin) {
    List<SyndEntry> entries = new LinkedList<SyndEntry>();
    List<GenericValue> contentRecs = null;
    try {
        contentRecs = EntityQuery.use(delegator).from("ContentAssocViewTo").where("contentIdStart", contentId, "caContentAssocTypeId", "PUBLISH_LINK", "statusId", "CTNT_PUBLISHED").orderBy("-caFromDate").queryList();
    } catch (GenericEntityException e) {
        Debug.logError(e, module);
    }
    if (contentRecs != null) {
        for (GenericValue v : contentRecs) {
            String sub = null;
            try {
                Map<String, Object> dummy = new HashMap<String, Object>();
                sub = ContentWorker.renderSubContentAsText(dispatcher, v.getString("contentId"), mapKey, dummy, locale, mimeTypeId, true);
            } catch (GeneralException e) {
                Debug.logError(e, module);
            } catch (IOException e) {
                Debug.logError(e, module);
            }
            if (sub != null) {
                String thisLink = entryLink + "?articleContentId=" + v.getString("contentId") + "&blogContentId=" + contentId;
                SyndContent desc = new SyndContentImpl();
                desc.setType("text/plain");
                desc.setValue(sub);
                SyndEntry entry = new SyndEntryImpl();
                entry.setTitle(v.getString("contentName"));
                entry.setPublishedDate(v.getTimestamp("createdDate"));
                entry.setDescription(desc);
                entry.setLink(thisLink);
                entry.setAuthor((v.getString("createdByUserLogin")));
                entries.add(entry);
            }
        }
    }
    return entries;
}
Also used : GenericValue(org.apache.ofbiz.entity.GenericValue) GeneralException(org.apache.ofbiz.base.util.GeneralException) HashMap(java.util.HashMap) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) IOException(java.io.IOException) LinkedList(java.util.LinkedList) SyndContent(com.sun.syndication.feed.synd.SyndContent) GenericEntityException(org.apache.ofbiz.entity.GenericEntityException) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl)

Example 5 with SyndContentImpl

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

the class SyndicationUtils method toRSS.

/**
 * Outputs an RSS feed of the list of entries to the outputstream.
 *
 * @param hostUrl
 * @param feedLink
 * @param title
 * @param description
 * @param entryModels
 * @param os
 * @throws IOException
 * @throws FeedException
 */
public static void toRSS(String hostUrl, String feedLink, String title, String description, List<FeedEntryModel> entryModels, OutputStream os) throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setEncoding("UTF-8");
    feed.setTitle(title);
    feed.setLink(feedLink);
    if (StringUtils.isEmpty(description)) {
        feed.setDescription(title);
    } else {
        feed.setDescription(description);
    }
    SyndImageImpl image = new SyndImageImpl();
    image.setTitle(Constants.NAME);
    image.setUrl(hostUrl + "/gitblt_25.png");
    image.setLink(hostUrl);
    feed.setImage(image);
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    for (FeedEntryModel entryModel : entryModels) {
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(entryModel.title);
        entry.setAuthor(entryModel.author);
        entry.setLink(entryModel.link);
        entry.setPublishedDate(entryModel.published);
        if (entryModel.tags != null && entryModel.tags.size() > 0) {
            List<SyndCategory> tags = new ArrayList<SyndCategory>();
            for (String tag : entryModel.tags) {
                SyndCategoryImpl cat = new SyndCategoryImpl();
                cat.setName(tag);
                tags.add(cat);
            }
            entry.setCategories(tags);
        }
        SyndContent content = new SyndContentImpl();
        if (StringUtils.isEmpty(entryModel.contentType) || entryModel.contentType.equalsIgnoreCase("text/plain")) {
            content.setType("text/html");
            content.setValue(StringUtils.breakLinesForHtml(entryModel.content));
        } else {
            content.setType(entryModel.contentType);
            content.setValue(entryModel.content);
        }
        entry.setDescription(content);
        entries.add(entry);
    }
    feed.setEntries(entries);
    OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8");
    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, writer);
    writer.close();
}
Also used : SyndCategory(com.sun.syndication.feed.synd.SyndCategory) SyndImageImpl(com.sun.syndication.feed.synd.SyndImageImpl) FeedEntryModel(com.gitblit.models.FeedEntryModel) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) SyndContentImpl(com.sun.syndication.feed.synd.SyndContentImpl) ArrayList(java.util.ArrayList) SyndFeedOutput(com.sun.syndication.io.SyndFeedOutput) SyndFeed(com.sun.syndication.feed.synd.SyndFeed) SyndCategoryImpl(com.sun.syndication.feed.synd.SyndCategoryImpl) SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndEntryImpl(com.sun.syndication.feed.synd.SyndEntryImpl) SyndFeedImpl(com.sun.syndication.feed.synd.SyndFeedImpl) OutputStreamWriter(java.io.OutputStreamWriter)

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