data.feed.setAuthor( author );
public class MyConverterForRSS20 extends ConverterForRSS20 { public MyConverterForRSS20() { this("rss_2.0"); } protected MyConverterForRSS20(String type) { super(type); } @Override protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) { SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem); Source source = item.getSource(); if (source != null) { SyndFeed syndFeed = new SyndFeedImpl(); syndFeed.setLink(source.getUrl()); syndFeed.setAuthor(source.getValue()); syndEntry.setSource(syndFeed); } return syndEntry; } }
feed.setAuthor("anonymous"); feed.setLink("http://www.anonymous.com");
feed.setAuthor("anonymous"); feed.setLink("http://www.anonymous.com");
public SyndFeed getFeeds(String sfeeds, boolean ignoreInvalidFeeds, boolean force, XWikiContext context) throws IOException { String[] feeds; if (sfeeds.indexOf("\n") != -1) { feeds = sfeeds.split("\n"); } else { feeds = sfeeds.split("\\|"); } List<SyndEntry> entries = new ArrayList<SyndEntry>(); SyndFeed outputFeed = new SyndFeedImpl(); if (context.getDoc() != null) { outputFeed.setTitle(context.getDoc().getFullName()); outputFeed.setUri(context.getWiki().getURL(context.getDoc().getFullName(), "view", context)); outputFeed.setAuthor(context.getDoc().getAuthor()); } else { outputFeed.setTitle("XWiki Feeds"); outputFeed.setAuthor("XWiki Team"); } for (int i = 0; i < feeds.length; i++) { SyndFeed feed = getFeed(feeds[i], ignoreInvalidFeeds, force, context); if (feed != null) { entries.addAll(feed.getEntries()); } } SyndEntryComparator comp = new SyndEntryComparator(); Collections.sort(entries, comp); outputFeed.setEntries(entries); return outputFeed; }
/** * {@inheritDoc} */ public SyndFeed getFeed(List<ActivityEvent> events, String author, String title, String description, String copyright, String encoding, String url, String suffix, XWikiContext context) { SyndFeed feed = getFeed(events, suffix, context); feed.setAuthor(author); feed.setDescription(description); feed.setCopyright(copyright); feed.setEncoding(encoding); feed.setLink(url); feed.setTitle(title); return feed; }
/** * Set the standard feed metadata values, based on static translated messages and wiki configuration. * * @param feed the feed to configure * @param context the current request context * @throws XWikiException if the wiki can't be properly accessed */ private void setFeedMetaData(SyndFeed feed, XWikiContext context) throws XWikiException { String msgPrefix = DefaultWatchList.APP_RES_PREFIX + "rss."; feed.setAuthor(localization.getTranslationPlain(msgPrefix + "author")); feed.setTitle(localization.getTranslationPlain(msgPrefix + "title")); feed.setDescription(localization.getTranslationPlain(msgPrefix + "description")); feed.setCopyright(context.getWiki().getXWikiPreference("copyright", context)); feed.setLink(context.getWiki().getExternalURL("xwiki:Main.WebHome", "view", context)); } }