data.feed = new SyndFeedImpl(); if ( Utils.isEmpty( meta.getVersion() ) ) { data.feed.setFeedType( "rss_2.0" );
/** * Creates a real feed containing the information of the SyndFeedImpl. * <p> * The feed type of the created WireFeed is taken from the SyndFeedImpl feedType property. * <p> * @return the real feed. * */ public WireFeed createWireFeed() { return createWireFeed(_feedType); }
/** * Sets the feed author. * <p> * This method is a convenience method, it maps to the Dublin Core module creator. * <p> * @param author the feed author to set, <b>null</b> if none. * */ public void setAuthor(String author) { getDCModule().setCreator(author); }
/** * Indicates whether some other object is "equal to" this one as defined by the Object equals() method. * <p> * @param other he reference object with which to compare. * @return <b>true</b> if 'this' object is equal to the 'other' object. * */ public boolean equals(Object other) { if (other == null) { return false; } // can't use foreign markup in equals, due to JDOM equals impl Object fm = getForeignMarkup(); setForeignMarkup(((SyndFeedImpl)other).getForeignMarkup()); boolean ret = _objBean.equals(other); // restore foreign markup setForeignMarkup(fm); return ret; }
private SyndFeedImpl createFeed() { SyndFeedImpl feed = new SyndFeedImpl(); feed.setTitle(getTitle()); feed.setDescription(getDescription()); feed.setAuthor("Nexus " + getApplicationStatusSource().getSystemStatus().getVersion()); feed.setPublishedDate(new Date()); return feed; }
/** * Get the activity feed for the given request * * @param activityRequest The request * @return The ATOM feed */ public SyndFeed getActivityFeed(final ActivityRequest activityRequest) { final SyndFeedImpl feed = new SyndFeedImpl(); feed.setUri("refimpl"); feed.setTitle("Reference Implementation Feed"); feed.setPublishedDate(new Date()); final List<SyndEntry> entries = new ArrayList<SyndEntry>(); entries.add(buildEntry(createEntry("http://example.com/1", "did something", "This is a comment.", "saying", new Date(), "fred").setIcon(applicationProperties.getBaseUrl() + "/download/resources/com.atlassian.streams.refimpl/itemicon"))); entries.add(buildEntry(createEntry("http://example.com/2", "did something else", null, null, new Date(), "barney").setReplyTo( applicationProperties.getBaseUrl() + "/plugins/servlet/streamscomments/2"))); entries.add(buildEntry(createEntry("http://example.com/3", "commented on something", "I can comment on stuff", "saying", new Date(), "fred").setInReplyTo("http://example.com/2").setCategory("comment"))); entries.add(buildEntry(createEntry("http://example.com/4", "commented on something", "I can comment on stuff too", "saying", new Date(), "admin").setInReplyTo("http://example.com/2").setCategory("comment").setReplyTo( applicationProperties.getBaseUrl() + "/plugins/servlet/streamscomments/4"))); feed.setEntries(entries.subList(0, Math.min(entries.size(), activityRequest.getMaxResults()))); return feed; }
/** * Returns the module identified by a given URI. * <p> * @param uri the URI of the ModuleImpl. * @return The module with the given URI, <b>null</b> if none. */ public Module getModule(String uri) { return ModuleUtils.getModule(getModules(),uri); }
/** * Returns the Dublin Core module of the feed. * @return the DC module, it's never <b>null</b> * */ private DCModule getDCModule() { return (DCModule) getModule(DCModule.URI); }
public SyndFeed getFeed(final Integer from, final Integer count, final Map<String, String> params) throws IOException { final SyndFeedImpl feed = new SyndFeedImpl(); feed.setTitle(getTitle()); feed.setDescription(getDescription()); feed.setAuthor(getNexusAuthor()); feed.setPublishedDate(new Date()); final Iterable<String> logFilenamesToScan = getLogFilenamesToScan(params); // default same as org.sonatype.nexus.feeds.DefaultFeedRecorder.DEFAULT_PAGE_SIZE int remainingCount = count != null ? count : 40; final List<SyndEntry> entries = Lists.newArrayList(); for (String logFileName : logFilenamesToScan) { final File logFile = logManager.getLogFile(logFileName); if (logFile == null) { // not found the file. This is either as nexus.log does not exists // or not yet rolled over, so nexus.log.1 not found // In any case, we can stop safely, as either way // we have nothing to scan. Worst case is that we // run as WAR or user completely customized logging configuration. break; } final List<SyndEntry> logFileEntries = extractEntriesFromLogfile(logFile, remainingCount); remainingCount -= logFileEntries.size(); entries.addAll(logFileEntries); } feed.setEntries(entries); return feed; }
/** * Indicates whether some other object is "equal to" this one as defined by the Object equals() method. * <p> * @param other he reference object with which to compare. * @return <b>true</b> if 'this' object is equal to the 'other' object. * */ public boolean equals(Object other) { if (other == null) { return false; } // can't use foreign markup in equals, due to JDOM equals impl Object fm = getForeignMarkup(); setForeignMarkup(((SyndFeedImpl)other).getForeignMarkup()); boolean ret = _objBean.equals(other); // restore foreign markup setForeignMarkup(fm); return ret; }
/** * Returns the module identified by a given URI. * <p> * @param uri the URI of the ModuleImpl. * @return The module with the given URI, <b>null</b> if none. */ public Module getModule(String uri) { return ModuleUtils.getModule(getModules(),uri); }
/** * Returns the Dublin Core module of the feed. * @return the DC module, it's never <b>null</b> * */ private DCModule getDCModule() { return (DCModule) getModule(DCModule.URI); }
/** * @see FeedPluginApi#getFeed() */ public SyndFeed getFeed(XWikiContext context) { return new SyndFeedImpl(); }
SyndFeedImpl feed = new SyndFeedImpl(); feed.setTitle(getTitle()); feed.setDescription(getDescription()); feed.setAuthor("Nexus " + getApplicationStatusSource().getSystemStatus().getVersion()); feed.setPublishedDate(new Date()); entry.setAuthor(feed.getAuthor()); feed.setEntries(entries);
/** * Sets the feed copyright. * <p> * This method is a convenience method, it maps to the Dublin Core module rights. * <p> * @param copyright the feed copyright to set, <b>null</b> if none. * */ public void setCopyright(String copyright) { getDCModule().setRights(copyright); }
/** * Indicates whether some other object is "equal to" this one as defined by the Object equals() method. * <p> * @param other he reference object with which to compare. * @return <b>true</b> if 'this' object is equal to the 'other' object. * */ public boolean equals(Object other) { if (other == null) { return false; } // can't use foreign markup in equals, due to JDOM equals impl Object fm = getForeignMarkup(); setForeignMarkup(((SyndFeedImpl)other).getForeignMarkup()); boolean ret = _objBean.equals(other); // restore foreign markup setForeignMarkup(fm); return ret; }
/** * Creates a real feed containing the information of the SyndFeedImpl. * <p> * The feed type of the created WireFeed is taken from the SyndFeedImpl feedType property. * <p> * @return the real feed. * */ public WireFeed createWireFeed() { return createWireFeed(_feedType); }
/** * Returns the module identified by a given URI. * <p> * @param uri the URI of the ModuleImpl. * @return The module with the given URI, <b>null</b> if none. */ public Module getModule(String uri) { return ModuleUtils.getModule(getModules(),uri); }
/** * Returns the Dublin Core module of the feed. * @return the DC module, it's never <b>null</b> * */ private DCModule getDCModule() { return (DCModule) getModule(DCModule.URI); }
/** * Builds SyndFeedImpl from an Reader. * <p> * @param reader Reader to read to create the SyndFeedImpl. * @return the SyndFeedImpl read from the Reader. * @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers. * @throws FeedException if the feed could not be parsed * */ public SyndFeed build(Reader reader) throws IllegalArgumentException,FeedException { return new SyndFeedImpl(_feedInput.build(reader), preserveWireFeed); }