/** * 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; }
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; }
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; }
feed.setTitle(getTitle());
feed.setTitle(getTitle());