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


Java Item.setLink方法代码示例

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


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

示例1: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected List<Item> buildFeedItems(Map<String, Object> model,
		HttpServletRequest req, HttpServletResponse resp) throws Exception {
	
	// get data model which is passed by the Spring container
	List<HrmsNews> news = (List<HrmsNews>) model.get("allNews");
       List<Item> items = new ArrayList<Item>(news.size());
 	
	for(HrmsNews topic : news ){
	
		Item item = new Item();
		
		Content content = new Content();
		content.setValue(topic.getSummary());
		item.setContent(content);
		
		item.setTitle(topic.getDescription());
		item.setLink(topic.getLink());
		item.setPubDate(new Date());
		
		items.add(item);
	}
	
	return items;
}
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:27,代码来源:HrmsRssViewBuilder.java

示例2: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    	
        List<Podcast> podcasts = (List<Podcast>) model.get("list_of_podcasts");
        List<Item> items = new ArrayList<Item>(podcasts.size());

        for (Podcast podcast : podcasts) {
            Item item = new Item();
//            String date = String.format("%1$tY-%1$tm-%1$td", podcast.getLastEpisode().getPublicationDate());
            item.setTitle(podcast.getTitle());
            item.setPubDate(podcast.getPublicationDate());
            item.setLink(model.get("HOST_AND_PORT_URL") + "/podcasts/" + podcast.getPodcastId() 
            		+ "/" + podcast.getTitleInUrl());
            
            Description podcastDescription = new Description();
            podcastDescription.setValue(podcast.getDescription());
            item.setDescription(podcastDescription);  
                        
            items.add(item);
        }

        return items;
    }
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:24,代码来源:FoundPodcastsRssFeedView.java

示例3: createItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
private Item createItem(Post post) {
    Item item = new Item();
    item.setLink(applicationSettings.getBaseUrl() + "/post/" + post.getPostName());
    item.setTitle(post.getPostTitle());
    item.setDescription(createDescription(post));
    item.setPubDate(getPostDate(post));
    return item;
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:9,代码来源:RssPostFeedView.java

示例4: convertArticle

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
private Item convertArticle(Article article) {
  Item entry = new Item();
  Guid guid = new Guid();
  guid.setValue(article.getArticleId().toString());
  entry.setGuid(guid);
  entry.setTitle(cleanXml10Characters(article.getTitle()));
  entry.setPubDate(Date.from(article.getCreateTime()));
  Description summary = new Description();
  summary.setType("html");
  summary.setValue(buildSummary(article));
  entry.setDescription(summary);
  entry.setLink(articleUrl(article));
  return entry;
}
 
开发者ID:kaif-open,项目名称:kaif,代码行数:15,代码来源:HotArticleRssContentView.java

示例5: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response)
    throws Exception {
	
    List<Episode> episodes = (List<Episode>) model.get("list_of_episodes");
    List<Item> items = new ArrayList<Item>(episodes.size());

    for (Episode episode : episodes) {
        Item item = new Item();
        String date = String.format("%1$tY-%1$tm-%1$td", episode.getPublicationDate());
        item.setTitle(episode.getTitle());
        item.setPubDate(episode.getPublicationDate());
        item.setLink(model.get("HOST_AND_PORT_URL") + "/podcasts/" + episode.getPodcastId() 
        		+ "/" + episode.getPodcast().getTitleInUrl()+ "/episodes/" + episode.getEpisodeId()
        		+ "/" + episode.getTitleInUrl());
        
        Description episodeDescription = new Description();
        episodeDescription.setValue(episode.getDescription());
        item.setDescription(episodeDescription);  
        
        //set enclosures
        List<Enclosure> enclosures = new ArrayList<Enclosure>();
        Enclosure enclosure = new Enclosure();
        enclosure.setUrl(episode.getMediaUrl());
        if(episode.getLength() != null) enclosure.setLength(episode.getLength());
        if(episode.getEnclosureType() != null ) enclosure.setType(episode.getEnclosureType()); 
        enclosures.add(enclosure);
        item.setEnclosures(enclosures);
        
        items.add(item);
    }

    return items;
}
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:34,代码来源:FoundEpisodesRssFeedView.java

示例6: buildFeedItems

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response)
    throws Exception {
	
    List<Podcast> podcasts = (List<Podcast>) model.get("list_of_podcasts");
    List<Item> items = new ArrayList<Item>(podcasts.size());

    for (Podcast podcast : podcasts) {
        Episode episode = podcast.getLastEpisode();
        Item item = new Item();
        String date = String.format("%1$tY-%1$tm-%1$td", episode.getPublicationDate());
        item.setTitle(podcast.getTitle()+ " - " + episode.getTitle());
        item.setPubDate(podcast.getPublicationDate());
        item.setLink( model.get("HOST_AND_PORT_URL") + "/podcasts/" + podcast.getPodcastId() 
        		+ "/" + podcast.getTitleInUrl() );
        
        Description episodeDescription = new Description();
        episodeDescription.setValue(episode.getDescription());
        item.setDescription(episodeDescription);  
        
        //set enclosures
        List<Enclosure> enclosures = new ArrayList<Enclosure>();
        Enclosure enclosure = new Enclosure();
        enclosure.setUrl(episode.getMediaUrl());    
        if(episode.getLength() != null) enclosure.setLength(episode.getLength());
        if(episode.getEnclosureType() != null ) enclosure.setType(episode.getEnclosureType());             
        enclosures.add(enclosure);
        item.setEnclosures(enclosures);
        
        items.add(item);
    }

    return items;
}
 
开发者ID:PodcastpediaOrg,项目名称:podcastpedia-web,代码行数:34,代码来源:GenericRssFeedView.java

示例7: parseItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It reads title and link out of the 'item' element.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {

    final Item item = new Item();

    final Element title = eItem.getChild("title", getRSSNamespace());
    if (title != null) {
        item.setTitle(title.getText());
    }

    final Element link = eItem.getChild("link", getRSSNamespace());
    if (link != null) {
        item.setLink(link.getText());
        item.setUri(link.getText());
    }

    item.setModules(parseItemModules(eItem, locale));

    final List<Element> foreignMarkup = extractForeignMarkup(eItem, item, getRSSNamespace());
    // content:encoded elements are treated special, without a module, they have to be removed
    // from the foreign markup to avoid duplication in case of read/write. Note that this fix
    // will break if a content module is used
    final Iterator<Element> iterator = foreignMarkup.iterator();
    while (iterator.hasNext()) {
        final Element element = iterator.next();
        final Namespace eNamespace = element.getNamespace();
        final String eName = element.getName();
        if (getContentNamespace().equals(eNamespace) && eName.equals("encoded")) {
            iterator.remove();
        }
    }

    if (!foreignMarkup.isEmpty()) {
        item.setForeignMarkup(foreignMarkup);
    }

    return item;
}
 
开发者ID:rometools,项目名称:rome,代码行数:48,代码来源:RSS090Parser.java

示例8: createRSSItem

import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
protected Item createRSSItem(final SyndEntry sEntry) {

        final Item item = new Item();

        item.setModules(ModuleUtils.cloneModules(sEntry.getModules()));

        item.setTitle(sEntry.getTitle());

        item.setLink(sEntry.getLink());

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

        item.setSource(createSource(sEntry.getSource()));

        final String uri = sEntry.getUri();
        if (uri != null) {
            item.setUri(uri);
        }

        return item;
    }
 
开发者ID:rometools,项目名称:rome,代码行数:25,代码来源:ConverterForRSS090.java


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