Search in sources :

Example 1 with SyndContent

use of com.sun.syndication.feed.synd.SyndContent 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 2 with SyndContent

use of com.sun.syndication.feed.synd.SyndContent 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 3 with SyndContent

use of com.sun.syndication.feed.synd.SyndContent 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 4 with SyndContent

use of com.sun.syndication.feed.synd.SyndContent in project ecf by eclipse.

the class Activator method printFeedContent.

private void printFeedContent(SyndFeed feed) {
    System.out.println("Author: " + feed.getAuthor());
    System.out.println("Authors:");
    if (feed.getAuthors() != null) {
        for (Object author : feed.getAuthors()) {
            System.out.println(((SyndPerson) author).getName());
            System.out.println(((SyndPerson) author).getEmail());
            System.out.println(((SyndPerson) author).getUri());
            System.out.println();
        }
    }
    System.out.println("Title: " + feed.getTitle());
    System.out.println("Title Ex: " + feed.getTitleEx());
    System.out.println("Description: " + feed.getDescription());
    System.out.println("Description Ex: " + feed.getDescriptionEx());
    System.out.println("Date" + feed.getPublishedDate());
    System.out.println("Type: " + feed.getFeedType());
    System.out.println("Encoding: " + feed.getEncoding());
    System.out.println("(C) " + feed.getCopyright());
    System.out.println();
    for (Object object : feed.getEntries()) {
        SyndEntry entry = (SyndEntry) object;
        System.out.println(entry.getTitle() + " - " + entry.getAuthor());
        System.out.println(entry.getLink());
        for (Object contobj : entry.getContents()) {
            SyndContent content = (SyndContent) contobj;
            System.out.println(content.getType());
            System.out.println(content.getValue());
        }
        SyndContent content = entry.getDescription();
        if (content != null)
            System.out.println(content.getValue());
        System.out.println(entry.getPublishedDate());
        System.out.println();
    }
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) SyndEntry(com.sun.syndication.feed.synd.SyndEntry)

Example 5 with SyndContent

use of com.sun.syndication.feed.synd.SyndContent in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method getDescription.

private String getDescription(SyndEntry entry) {
    SyndContent content = entry.getDescription();
    if (content == null) {
        List nestedContent = entry.getContents();
        if (!nestedContent.isEmpty()) {
            Object obj = nestedContent.get(0);
            if (obj instanceof SyndContent) {
                content = (SyndContent) obj;
            }
        }
    }
    if (content == null) {
        return "";
    }
    String value = content.getValue();
    if (value == null) {
        return "";
    }
    if (value.startsWith("<form>")) {
        return value;
    }
    return removeHtmlEntities(value);
}
Also used : SyndContent(com.sun.syndication.feed.synd.SyndContent) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

SyndContent (com.sun.syndication.feed.synd.SyndContent)17 SyndContentImpl (com.sun.syndication.feed.synd.SyndContentImpl)12 SyndEntry (com.sun.syndication.feed.synd.SyndEntry)12 SyndEntryImpl (com.sun.syndication.feed.synd.SyndEntryImpl)10 ArrayList (java.util.ArrayList)7 Date (java.util.Date)6 SyndFeed (com.sun.syndication.feed.synd.SyndFeed)5 SyndFeedImpl (com.sun.syndication.feed.synd.SyndFeedImpl)5 IOException (java.io.IOException)4 FeedException (com.sun.syndication.io.FeedException)3 SyndFeedOutput (com.sun.syndication.io.SyndFeedOutput)3 SyndCategory (com.sun.syndication.feed.synd.SyndCategory)2 OutputStreamWriter (java.io.OutputStreamWriter)2 List (java.util.List)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