@SuppressWarnings("unchecked") public static SyndFeed addOpenSearchModule( SyndFeed feed, int itemsPerPage, int startIdx, int totalResult, String searchDescriptionUrl) { if (feed == null) { throw new NullPointerException("feed is NULL"); } List<Module> mods = null; mods = feed.getModules(); if (mods == null) { mods = new ArrayList<Module>(); } OpenSearchModule osm = new OpenSearchModuleImpl(); osm.setItemsPerPage(itemsPerPage); osm.setStartIndex(startIdx); osm.setTotalResults(totalResult); if (searchDescriptionUrl != null) { Link link = new Link(); link.setHref(searchDescriptionUrl); link.setType("application/opensearchdescription+xml"); osm.setLink(link); } mods.add(osm); feed.setModules(mods); return feed; }
public void copyInto(WireFeed feed, SyndFeed syndFeed) { syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules())); if (((List) feed.getForeignMarkup()).size() > 0) { syndFeed.setForeignMarkup(feed.getForeignMarkup()); } syndFeed.setEncoding(feed.getEncoding()); Channel channel = (Channel) feed; syndFeed.setTitle(channel.getTitle()); syndFeed.setLink(channel.getLink()); syndFeed.setDescription(channel.getDescription()); Image image = channel.getImage(); if (image != null) { syndFeed.setImage(createSyndImage(image)); } List items = channel.getItems(); if (items != null) { syndFeed.setEntries(createSyndEntries(items)); } }