當前位置: 首頁>>代碼示例>>Java>>正文


Java SyndFeed.setEntries方法代碼示例

本文整理匯總了Java中com.sun.syndication.feed.synd.SyndFeed.setEntries方法的典型用法代碼示例。如果您正苦於以下問題:Java SyndFeed.setEntries方法的具體用法?Java SyndFeed.setEntries怎麽用?Java SyndFeed.setEntries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.syndication.feed.synd.SyndFeed的用法示例。


在下文中一共展示了SyndFeed.setEntries方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copyInto

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));

    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));
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:ConverterForRSS090.java

示例2: getAllBuildsFeed

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 *
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getAllBuildsFeed(final int userID) {

  final List buildStatusList = org.parabuild.ci.security.SecurityManager.getInstance().getFeedBuildStatuses(userID);

  // traverse build statuses
  final List entries = new ArrayList(11);
  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  for (final Iterator i = buildStatusList.iterator(); i.hasNext();) {
    final int activeBuildID = ((BuildState)i.next()).getActiveBuildID();
    entries.addAll(getBuildEntries(cm, activeBuildID, urlGenerator));
  }

  // create feed and set collected entries
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Published Result Feed");
  feed.setLink(urlGenerator.makeBuildListURL());
  feed.setDescription("This feed provides information about published results at Parabuild server");
  feed.setEntries(entries);

  // return result
  return feed;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:31,代碼來源:PublishedResultFeedGenerator.java

示例3: getAllBuildsFeed

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getAllBuildsFeed(final int userID) {

  final List buildStatusList = SecurityManager.getInstance().getFeedBuildStatuses(userID);

  // traverse build statuses
  final List entries = new ArrayList(1);
  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  for (final Iterator i = buildStatusList.iterator(); i.hasNext();) {
    final int activeBuildID = ((BuildState) i.next()).getActiveBuildID();
    entries.addAll(getBuildEntries(cm, activeBuildID, urlGenerator));
  }

  // create feed and set collected entries
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Feed");
  feed.setLink(urlGenerator.makeBuildListURL());
  feed.setDescription("This feed provides information about build statuses at Parabuild server");
  feed.setEntries(entries);

  // return result
  return feed;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:FeedGenerator.java

示例4: generateFeed

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public SyndFeed generateFeed( String title, String description, List<RssFeedEntry> dataEntries )
{
    if( dataEntries.size() ==  0 )
    {
        log.debug( "No updates found, feed not generated." );
        return null;
    }
    
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle( title );        
    feed.setDescription( description );
    feed.setLanguage( DEFAULT_LANGUAGE );
    feed.setPublishedDate( dataEntries.get( dataEntries.size() - 1 ).getPublishedDate() );
    feed.setFeedType( DEFAULT_FEEDTYPE );
    feed.setEntries( getEntries( dataEntries ) );

    log.debug( "Finished generating the feed \'{}\'.", title );
    
    return feed;
}
 
開發者ID:ruikom,項目名稱:apache-archiva,代碼行數:21,代碼來源:RssFeedGenerator.java

示例5: aggregate

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
    if (oldExchange == null) {
        return newExchange;
    }
    SyndFeed oldFeed = oldExchange.getIn().getBody(SyndFeed.class);
    SyndFeed newFeed = newExchange.getIn().getBody(SyndFeed.class);
    if (oldFeed != null && newFeed != null) {                
        List<SyndEntryImpl> oldEntries = CastUtils.cast(oldFeed.getEntries());                  
        List<SyndEntryImpl> newEntries = CastUtils.cast(newFeed.getEntries());
        List<SyndEntryImpl> mergedList = new ArrayList<SyndEntryImpl>(oldEntries.size() + newEntries.size());
        mergedList.addAll(oldEntries);
        mergedList.addAll(newEntries);
        oldFeed.setEntries(mergedList);    
    } else {
        log.debug("Could not merge exchanges. One body was null.");
    }
    return oldExchange;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:19,代碼來源:AggregateRssFeedStrategy.java

示例6: doGet

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("WildFly-Camel Test RSS Feed");
    feed.setLink("http://localhost:8080/rss-tests");
    feed.setDescription("Test RSS feed for the camel-rss component");

    List<SyndEntry> entries = new ArrayList<>();
    for (int i = 1; i <= 5; i++) {
        entries.add(createFeedEntry("Test entry: ", "Test content: ", i));
    }
    feed.setEntries(entries);

    SyndFeedOutput output = new SyndFeedOutput();
    try {
        output.output(feed, response.getWriter());
    } catch (FeedException e) {
        throw new IllegalStateException("Error generating RSS feed", e);
    }
}
 
開發者ID:wildfly-extras,項目名稱:wildfly-camel,代碼行數:22,代碼來源:RSSFeedServlet.java

示例7: copyInto

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
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));
    }
}
 
開發者ID:Norkart,項目名稱:NK-VirtualGlobe,代碼行數:22,代碼來源:ConverterForRSS090.java

示例8: getBuildFeed

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 *
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getBuildFeed(final int userID, final int activeBuildID) throws AccessForbiddenException, FeedNotFoundException {

  // validate that a build exists
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  final ActiveBuildConfig activeBuildConfig = cm.getActiveBuildConfig(activeBuildID);
  if (activeBuildConfig == null) {
    throw new FeedNotFoundException("Requested feed not found");
  }

  // validat build access
  if (!SystemConfigurationManagerFactory.getManager().isAnonymousAccessToProtectedFeedsIsEnabled()) {
    final SecurityManager securityManager = SecurityManager.getInstance();
    if (!securityManager.userCanViewBuild(userID, activeBuildID)) {
      throw new AccessForbiddenException("Access to this feed is forbidden");
    }
  }

  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final String buildName = activeBuildConfig.getBuildName();
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Feed for " + buildName);
  feed.setLink(urlGenerator.makeBuildStatusURL(activeBuildID));
  feed.setDescription("This feed provides information about statuses for " + buildName);
  feed.setEntries(getBuildEntries(cm, activeBuildID, urlGenerator));

  // return result
  return feed;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:36,代碼來源:PublishedResultFeedGenerator.java

示例9: getBuildFeed

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
 * Returns a feed for all builds that are allowed for a given user.
 *
 * @param userID for that to return feeds.
 * @return a feed for all builds that are allowed for the given user.
 */
public SyndFeed getBuildFeed(final int userID, final int activeBuildID) throws AccessForbiddenException, FeedNotFoundException {

  // validate that a build exists
  final ConfigurationManager cm = ConfigurationManager.getInstance();
  final ActiveBuildConfig activeBuildConfig = cm.getActiveBuildConfig(activeBuildID);
  if (activeBuildConfig == null) {
    throw new FeedNotFoundException("Requested feed not found");
  }

  // validat build access
  if (!SystemConfigurationManagerFactory.getManager().isAnonymousAccessToProtectedFeedsIsEnabled()) {
    final SecurityManager securityManager = SecurityManager.getInstance();
    if (!securityManager.userCanViewBuild(userID, activeBuildID)) {
      throw new AccessForbiddenException("Access to this feed is forbidden");
    }
  }

  final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
  final String buildName = activeBuildConfig.getBuildName();
  final SyndFeed feed = new SyndFeedImpl();
  feed.setTitle("Parabuild Feed for " + buildName);
  feed.setLink(urlGenerator.makeBuildStatusURL(activeBuildID));
  feed.setDescription("This feed provides information about statuses for " + buildName);
  feed.setEntries(getBuildEntries(cm, activeBuildID, urlGenerator));

  // return result
  return feed;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:FeedGenerator.java

示例10: rssFeed

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
@RequestMapping("/rss")
public void rssFeed(HttpServletResponse response) throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("atom_1.0");
    feed.setEntries(new LinkedList());

    podcastEpisodeService.allPodcasts().forEach(podcastEpisode -> {
        feed.getEntries().add(podcastEpisode.getSyndEntry());
    });

    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, response.getWriter());
}
 
開發者ID:DevWars,項目名稱:devwars.tv,代碼行數:14,代碼來源:PodcastController.java

示例11: makeRSSFromRSSCorresponList

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
 * コレポンリストからRSSを生成する.
 * @param rssCorresponList コレポンリスト
 * @param baseURL BaseURL
 * @return RSS
 * @throws ServiceAbortException 設定値からRSSを出力する際に例外発生
 */
private String makeRSSFromRSSCorresponList(
    List<RSSCorrespon> rssCorresponList, String baseURL) throws ServiceAbortException {
    String resultRSS = null;

    SyndFeed feed = (SyndFeed) new SyndFeedImpl();
    feed.setFeedType(FEED_TYPE);
    feed.setTitle(RSS_TITLE);
    feed.setLink("");
    feed.setDescription("");
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    if (rssCorresponList != null) {
        for (RSSCorrespon c : rssCorresponList) {
            entries.add(makeEntryFromRSSCorrespon(c, baseURL));
        }
    }
    feed.setEntries(entries);

    try {
        SyndFeedOutput output = new SyndFeedOutput();
        resultRSS = output.outputString(feed);
    } catch (FeedException e) {
        // 設定された値から生成されるXMLが異常だった際に発生. 起こり得ない.
        ServiceAbortException sae =
            new ServiceAbortException("RSS outputString error");
        sae.initCause(e);
        throw sae;
    }
    return resultRSS;
}
 
開發者ID:otsecbsol,項目名稱:linkbinder,代碼行數:37,代碼來源:RSSServiceImpl.java

示例12: rss

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public String rss() throws IOException, FeedException {
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle("hiscores.shmup.com");
    feed.setFeedType("rss_2.0");
    feed.setDescription("hiscores.shmup.com");
    feed.setLink("http://hiscores.shmup.com");
    List entries = new ArrayList();
    feed.setEntries(entries);
    for (Score score : scores) {
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(score.getGameTitle());
        entry.setAuthor(score.player.name);
        entry.setLink("http://hiscores.shmup.com/score/" + score.id);
        SyndContentImpl content = new SyndContentImpl();
        content.setValue(score.tweet());
        entry.setDescription(content);
        entry.setPublishedDate(score.getCreatedAt());
        entry.setUpdatedDate(score.getCreatedAt());
        SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
        enclosure.setUrl(score.game.cover);
        enclosure.setType(score.game.getCoverType());
        entry.setEnclosures(Lists.newArrayList(enclosure));
        entries.add(entry);
    }
    Writer writer = new StringWriter();
    SyndFeedOutput output = new SyndFeedOutput();
    output.output(feed, writer);
    writer.close();
    Controller.response().setContentType("application/rss+xml");
    return writer.toString();
}
 
開發者ID:jsmadja,項目名稱:shmuphiscores,代碼行數:32,代碼來源:Timeline.java

示例13: copyInto

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed, SyndFeed syndFeed) {
    Feed aFeed = (Feed) feed;

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

    syndFeed.setEncoding(aFeed.getEncoding());

    syndFeed.setUri(aFeed.getId());

    syndFeed.setTitle(aFeed.getTitle());

    Content aSubtitle = aFeed.getSubtitle();
    if (aSubtitle!=null) {
        syndFeed.setDescription(aSubtitle.getValue());
    }

    // if there is exactly one alternate link, use that as THE link
    if (aFeed.getAlternateLinks() != null 
            && aFeed.getAlternateLinks().size() == 1) {
        Link theLink = (Link)aFeed.getAlternateLinks().get(0);
        syndFeed.setLink(theLink.getHref());
    }
    // lump alternate and other links together
    List syndLinks = new ArrayList();
    if (aFeed.getAlternateLinks() != null 
            && aFeed.getAlternateLinks().size() > 0) {
        syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
    }
    if (aFeed.getOtherLinks() != null 
            && aFeed.getOtherLinks().size() > 0) {
        syndLinks.addAll(createSyndLinks(aFeed.getOtherLinks()));
    }
        
    List aEntries = aFeed.getEntries();
    if (aEntries!=null) {
        syndFeed.setEntries(createSyndEntries(aFeed, aEntries));
    }

    // Core Atom language/author/copyright/modified elements have precedence
    // over DC equivalent info.

    List authors = aFeed.getAuthors();
    if (authors!=null && authors.size() > 0) {
        syndFeed.setAuthors(ConverterForAtom03.createSyndPersons(authors));
    }

    String rights = aFeed.getRights();
    if (rights!=null) {
        syndFeed.setCopyright(rights);
    }

    Date date = aFeed.getUpdated();
    if (date!=null) {
        syndFeed.setPublishedDate(date);
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:57,代碼來源:ConverterForAtom10.java

示例14: copyInto

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
    Feed aFeed = (Feed) feed;

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

    syndFeed.setEncoding(aFeed.getEncoding());

    syndFeed.setUri(aFeed.getId());

    syndFeed.setTitle(aFeed.getTitle());

    String linkHref = null;
    if (aFeed.getAlternateLinks().size() > 0) {
        linkHref = ((Link) aFeed.getAlternateLinks().get(0)).getHref();
    }
    syndFeed.setLink(linkHref);

    Content tagline = aFeed.getTagline();
    if (tagline!=null) {
        syndFeed.setDescription(tagline.getValue());
    }


    List aEntries = aFeed.getEntries();
    if (aEntries!=null) {
        syndFeed.setEntries(createSyndEntries(aEntries));
    }

    // Core Atom language/author/copyright/modified elements have precedence
    // over DC equivalent info.

    String language = aFeed.getLanguage();
    if (language!=null) {
        syndFeed.setLanguage(language);
    }

    List authors = aFeed.getAuthors();
    if (authors!=null && authors.size() > 0) {
        syndFeed.setAuthors(createSyndPersons(authors));
    }

    String copyright = aFeed.getCopyright();
    if (copyright!=null) {
        syndFeed.setCopyright(copyright);
    }

    Date date = aFeed.getModified();
    if (date!=null) {
        syndFeed.setPublishedDate(date);
    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:53,代碼來源:ConverterForAtom03.java

示例15: main

import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public static void main(String[] args) {
    boolean ok = false;
    if (args.length>=2) {
        try {
            String outputType = args[0];

            SyndFeed aggrFeed = new SyndFeedImpl();
            aggrFeed.setFeedType(outputType);

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

            List entries = new ArrayList();
            aggrFeed.setEntries(entries);

            for (int i=1;i<args.length;i++) {
                URL feedUrl = new URL(args[i]);
                SyndFeedInput input = new SyndFeedInput();

                SyndFeed feed = input.build(new XmlReader(feedUrl));

                entries.addAll(feed.getEntries());
            }

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

            ok = true;
        }
        catch (Exception ex) {
            System.out.println("ERROR: "+ex.getMessage());
        }
    }

    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:parabuild-ci,項目名稱:parabuild-ci,代碼行數:47,代碼來源:FeedAggregator.java


注:本文中的com.sun.syndication.feed.synd.SyndFeed.setEntries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。