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;
}
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;
}
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;
}
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();
}
}
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);
}
Aggregations