当前位置: 首页>>代码示例>>Java>>正文


Java SyndFeed.setEntries方法代码示例

本文整理汇总了Java中com.rometools.rome.feed.synd.SyndFeed.setEntries方法的典型用法代码示例。如果您正苦于以下问题:Java SyndFeed.setEntries方法的具体用法?Java SyndFeed.setEntries怎么用?Java SyndFeed.setEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.rometools.rome.feed.synd.SyndFeed的用法示例。


在下文中一共展示了SyndFeed.setEntries方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSyndFeed

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
 * Gets a filtered version of the SyndFeed that only has entries that were changed in the last
 * setSyndFeed() call.
 *
 * @return
 */
@Override
public synchronized SyndFeed getSyndFeed() {
    try {
        final SyndFeed feed = (SyndFeed) super.getSyndFeed().clone();

        final List<SyndEntry> changedEntries = new ArrayList<SyndEntry>();

        final List<SyndEntry> entries = feed.getEntries();
        for (final SyndEntry entry : entries) {
            if (changedMap.containsKey(entry.getUri())) {
                changedEntries.add(entry);
            }
        }

        feed.setEntries(changedEntries);

        return feed;
    } catch (final CloneNotSupportedException ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:28,代码来源:DeltaSyndFeedInfo.java

示例2: writeRevisionsFeed

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private void writeRevisionsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws IOException, FeedException, ServiceException, PublicInterfaceNotFoundException {
	long poid = Long.parseLong(request.getParameter("poid"));
	SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);

	SyndFeed feed = new SyndFeedImpl();
	feed.setFeedType(FEED_TYPE);

	feed.setTitle("BIMserver.org revisions feed for project '" + sProject.getName() + "'");
	feed.setLink(request.getContextPath());
	feed.setDescription("This feed represents all the revisions of project '" + sProject.getName() + "'");

	List<SyndEntry> entries = new ArrayList<SyndEntry>();
	try {
		List<SRevision> allRevisionsOfProject = serviceMap.getServiceInterface().getAllRevisionsOfProject(poid);
		Collections.sort(allRevisionsOfProject, new SRevisionIdComparator(false));
		for (SRevision sVirtualRevision : allRevisionsOfProject) {
			SUser user = serviceMap.getServiceInterface().getUserByUoid(sVirtualRevision.getUserId());
			SyndEntry entry = new SyndEntryImpl();
			entry.setTitle("Revision " + sVirtualRevision.getOid());
			entry.setLink(request.getContextPath() + "/revision.jsp?poid=" + sVirtualRevision.getOid() + "&roid=" + sVirtualRevision.getOid());
			entry.setPublishedDate(sVirtualRevision.getDate());
			SyndContent description = new SyndContentImpl();
			description.setType("text/html");
			description.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Comment</td><td>" + sVirtualRevision.getComment()
					+ "</td></tr></table>");
			entry.setDescription(description);
			entries.add(entry);
		}
	} catch (ServiceException e) {
		LOGGER.error("", e);
	}
	feed.setEntries(entries);
	SyndFeedOutput output = new SyndFeedOutput();
	output.output(feed, response.getWriter());
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:36,代码来源:SyndicationServlet.java

示例3: writeCheckoutsFeed

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
private void writeCheckoutsFeed(HttpServletRequest request, HttpServletResponse response, ServiceMap serviceMap) throws ServiceException, IOException, FeedException, PublicInterfaceNotFoundException {
	long poid = Long.parseLong(request.getParameter("poid"));
	SProject sProject = serviceMap.getServiceInterface().getProjectByPoid(poid);

	SyndFeed feed = new SyndFeedImpl();
	feed.setFeedType(FEED_TYPE);

	feed.setTitle("BIMserver.org checkouts feed for project '" + sProject.getName() + "'");
	feed.setLink(request.getContextPath());
	feed.setDescription("This feed represents all the checkouts of project '" + sProject.getName() + "'");

	List<SyndEntry> entries = new ArrayList<SyndEntry>();
	try {
		List<SCheckout> allCheckoutsOfProject = serviceMap.getServiceInterface().getAllCheckoutsOfProjectAndSubProjects(poid);
		for (SCheckout sCheckout : allCheckoutsOfProject) {
			SRevision revision = serviceMap.getServiceInterface().getRevision(sCheckout.getRevision().getOid());
			SProject project = serviceMap.getServiceInterface().getProjectByPoid(sCheckout.getProjectId());
			SUser user = serviceMap.getServiceInterface().getUserByUoid(sCheckout.getUserId());
			SyndEntry entry = new SyndEntryImpl();
			entry.setTitle("Checkout on " + project.getName() + ", revision " + revision.getId());
			entry.setLink(request.getContextPath() + "/project.jsp?poid=" + sProject.getOid());
			entry.setPublishedDate(sCheckout.getDate());
			SyndContent description = new SyndContentImpl();
			description.setType("text/plain");
			description
					.setValue("<table><tr><td>User</td><td>" + user.getUsername() + "</td></tr><tr><td>Revision</td><td>" + sCheckout.getRevision().getOid() + "</td></tr></table>");
			entry.setDescription(description);
			entries.add(entry);
		}
	} catch (UserException e) {
		LOGGER.error("", e);
	}
	feed.setEntries(entries);
	SyndFeedOutput output = new SyndFeedOutput();
	output.output(feed, response.getWriter());
}
 
开发者ID:opensourceBIM,项目名称:BIMserver,代码行数:37,代码来源:SyndicationServlet.java

示例4: copyInto

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
@Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {

    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));

    final List<Element> foreignMarkup = feed.getForeignMarkup();
    if (!foreignMarkup.isEmpty()) {
        syndFeed.setForeignMarkup(foreignMarkup);
    }

    syndFeed.setStyleSheet(feed.getStyleSheet());

    syndFeed.setEncoding(feed.getEncoding());

    final Channel channel = (Channel) feed;

    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    final Image image = channel.getImage();
    if (image != null) {
        syndFeed.setImage(createSyndImage(image));
    }

    final List<Item> items = channel.getItems();
    if (items != null) {
        syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed()));
    }
}
 
开发者ID:rometools,项目名称:rome,代码行数:31,代码来源:ConverterForRSS090.java

示例5: main

import com.rometools.rome.feed.synd.SyndFeed; //导入方法依赖的package包/类
public static void main(final String[] args) {

        boolean ok = false;

        if (args.length >= 2) {

            try {

                final String outputType = args[0];

                final SyndFeed feed = new SyndFeedImpl();
                feed.setFeedType(outputType);

                feed.setTitle("Aggregated Feed");
                feed.setDescription("Anonymous Aggregated Feed");
                feed.setAuthor("anonymous");
                feed.setLink("http://www.anonymous.com");

                final List<SyndEntry> entries = new ArrayList<SyndEntry>();
                feed.setEntries(entries);

                final FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
                final FeedFetcher feedFetcher = new HttpURLFeedFetcher(feedInfoCache);

                for (int i = 1; i < args.length; i++) {
                    final URL inputUrl = new URL(args[i]);
                    final SyndFeed inFeed = feedFetcher.retrieveFeed(inputUrl);
                    entries.addAll(inFeed.getEntries());
                }

                final SyndFeedOutput output = new SyndFeedOutput();
                output.output(feed, new PrintWriter(System.out));

                ok = true;

            } catch (final Exception ex) {
                System.out.println("ERROR: " + ex.getMessage());
                ex.printStackTrace();
            }

        }

        if (!ok) {
            System.out.println();
            System.out.println("FeedAggregator aggregates different feeds into a single one.");
            System.out.println("The first parameter must be the feed type for the aggregated feed.");
            System.out.println(" [valid values are: rss_0.9, rss_0.91, rss_0.92, rss_0.93, ]");
            System.out.println(" [                  rss_0.94, rss_1.0, rss_2.0 & atom_0.3  ]");
            System.out.println("The second to last parameters are the URLs of feeds to aggregate.");
            System.out.println();
        }
    }
 
开发者ID:rometools,项目名称:rome,代码行数:53,代码来源:FeedAggregator.java


注:本文中的com.rometools.rome.feed.synd.SyndFeed.setEntries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。