Ejemplo n.º 1
0
 @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;
 }
  protected WireFeed createRealFeed(String type, SyndFeed syndFeed) {
    Channel channel = new Channel(type);
    channel.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));

    channel.setEncoding(syndFeed.getEncoding());

    channel.setTitle(syndFeed.getTitle());
    channel.setLink(syndFeed.getLink());
    channel.setDescription(syndFeed.getDescription());
    SyndImage sImage = syndFeed.getImage();
    if (sImage != null) {
      channel.setImage(createRSSImage(sImage));
    }

    List sEntries = syndFeed.getEntries();
    if (sEntries != null) {
      channel.setItems(createRSSItems(sEntries));
    }
    return channel;
  }
Ejemplo n.º 3
0
 /**
  * Add a ROME plugin module (e.g. for OpenSearch) at the feed level.
  *
  * @param m module
  */
 public void addModule(Module m) {
   feed.getModules().add(m);
 }