Java Code Examples for com.rometools.rome.feed.rss.Channel#setPubDate()

The following examples show how to use com.rometools.rome.feed.rss.Channel#setPubDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HotArticleRssContentView.java    From kaif with Apache License 2.0 6 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object> model,
    Channel feed,
    HttpServletRequest request) {
  ZoneInfo zoneInfo = (ZoneInfo) model.get("zoneInfo");
  @SuppressWarnings("unchecked")
  List<Article> articles = (List<Article>) model.get("articles");
  if (zoneInfo != null) {
    feed.setTitle(zoneInfo.getName() + " kaif.io");
    feed.setLink(zoneUrl(zoneInfo.getZone()));
    feed.setDescription(zoneInfo.getAliasName() + " 熱門");
    feed.setPubDate(buildFeedUpdateTime(articles, zoneInfo.getCreateTime()));
  } else {
    feed.setTitle("熱門 kaif.io");
    feed.setLink(SCHEME_AND_HOST);
    feed.setDescription("綜合熱門");
    feed.setPubDate(buildFeedUpdateTime(articles, DEFAULT_INSTANT));
  }
}
 
Example 2
Source File: ConverterForRSS091Userland.java    From rome with Apache License 2.0 6 votes vote down vote up
@Override
protected WireFeed createRealFeed(final String type, final SyndFeed syndFeed) {
    final Channel channel = (Channel) super.createRealFeed(type, syndFeed);
    channel.setLanguage(syndFeed.getLanguage()); // c
    channel.setCopyright(syndFeed.getCopyright()); // c
    channel.setPubDate(syndFeed.getPublishedDate()); // c
    channel.setDocs(syndFeed.getDocs());
    channel.setManagingEditor(syndFeed.getManagingEditor());
    channel.setWebMaster(syndFeed.getWebMaster());
    channel.setGenerator(syndFeed.getGenerator());

    final List<SyndPerson> authors = syndFeed.getAuthors();
    if (Lists.isNotEmpty(authors)) {
        final SyndPerson author = authors.get(0);
        channel.setManagingEditor(author.getName());
    }

    return channel;
}
 
Example 3
Source File: ArticleRssController.java    From tutorials with MIT License 6 votes vote down vote up
private Channel buildChannel(List<Article> articles){
    Channel channel = new Channel("rss_2.0");
    channel.setLink("http://localhost:8080/spring-mvc-simple/rss");
    channel.setTitle("Article Feed");
    channel.setDescription("Article Feed Description");
    channel.setPubDate(new Date());

    List<Item> items = new ArrayList<>();
    for (Article article : articles) {
        Item item = new Item();
        item.setLink(article.getLink());
        item.setTitle(article.getTitle());
        Description description1 = new Description();
        description1.setValue(article.getDescription());
        item.setDescription(description1);
        item.setPubDate(article.getPublishedDate());
        item.setAuthor(article.getAuthor());
        items.add(item);
    }

    channel.setItems(items);
    return channel;
}
 
Example 4
Source File: BasicPodfeedService.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This puts the pieces together to generate the actual feed.
 * 
 * @param title
 *            The global title for the podcast
 * @param link
 *            The URL for the feed
 * @param description_loc
 *            Global description of the feed
 * @param copyright
 *            Copyright information
 * @param entries
 *            The list of individual podcasts
 * @param feedTyle
 * 			 The output feed type (for potential future development). Set to rss_2.0
 * @param pubDate
 * 			 The date to set the publish date for this feed
 * 
 * @eturn SyndFeed
 * 			The entire podcast stuffed into a SyndFeed object
 */
private Channel doSyndication(Map feedInfo, List entries,
		String feedType, Date pubDate, Date lastBuildDate) {

	final Channel channel = new Channel();

	// FUTURE: How to determine what podcatcher supports and feed that to them
	channel.setFeedType(feedType);
	channel.setTitle((String) feedInfo.get("title"));
	channel.setLanguage(LANGUAGE);

	channel.setPubDate(pubDate);
	channel.setLastBuildDate(lastBuildDate);

	channel.setLink((String) feedInfo.get("url"));
	channel.setDescription((String) feedInfo.get("desc"));		
	channel.setCopyright((String) feedInfo.get("copyright"));
	channel.setGenerator((String) feedInfo.get("gen"));

	channel.setItems(entries);

	// Used to remove the dc: tags from the channel level info
	List modules = new ArrayList();
	
	channel.setModules(modules);

	return channel;
}
 
Example 5
Source File: BasicPodfeedService.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * This puts the pieces together to generate the actual feed.
 * 
 * @param title
 *            The global title for the podcast
 * @param link
 *            The URL for the feed
 * @param description_loc
 *            Global description of the feed
 * @param copyright
 *            Copyright information
 * @param entries
 *            The list of individual podcasts
 * @param feedTyle
 * 			 The output feed type (for potential future development). Set to rss_2.0
 * @param pubDate
 * 			 The date to set the publish date for this feed
 * 
 * @eturn SyndFeed
 * 			The entire podcast stuffed into a SyndFeed object
 */
private Channel doSyndication(Map feedInfo, List entries,
		String feedType, Date pubDate, Date lastBuildDate) {

	final Channel channel = new Channel();

	// FUTURE: How to determine what podcatcher supports and feed that to them
	channel.setFeedType(feedType);
	channel.setTitle((String) feedInfo.get("title"));
	channel.setLanguage(LANGUAGE);

	channel.setPubDate(pubDate);
	channel.setLastBuildDate(lastBuildDate);

	channel.setLink((String) feedInfo.get("url"));
	channel.setDescription((String) feedInfo.get("desc"));		
	channel.setCopyright((String) feedInfo.get("copyright"));
	channel.setGenerator((String) feedInfo.get("gen"));

	channel.setItems(entries);

	// Used to remove the dc: tags from the channel level info
	List modules = new ArrayList();
	
	channel.setModules(modules);

	return channel;
}
 
Example 6
Source File: ArticleFeedView.java    From tutorials with MIT License 5 votes vote down vote up
protected Channel newFeed() {
    Channel channel = new Channel("rss_2.0");
    channel.setLink("http://localhost:8080/spring-mvc-simple/rss");
    channel.setTitle("Article Feed");
    channel.setDescription("Article Feed Description");
    channel.setPubDate(new Date());
    return channel;
}
 
Example 7
Source File: ArticleFeedView.java    From tutorials with MIT License 5 votes vote down vote up
protected Channel newFeed() {
    Channel channel = new Channel("rss_2.0");
    channel.setLink("http://localhost:8080/rss");
    channel.setTitle("Article Feed");
    channel.setDescription("Article Feed Description");
    channel.setPubDate(new Date());
    return channel;
}