本文整理汇总了Java中com.rometools.rome.feed.rss.Item.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Item.setDescription方法的具体用法?Java Item.setDescription怎么用?Java Item.setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.rss.Item
的用法示例。
在下文中一共展示了Item.setDescription方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: createRSSItem
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(final SyndEntry sEntry) {
final Item item = super.createRSSItem(sEntry);
final SyndContent desc = sEntry.getDescription();
if (desc != null) {
item.setDescription(createItemDescription(desc));
}
final List<SyndContent> contents = sEntry.getContents();
if (Lists.isNotEmpty(contents)) {
item.setContent(createItemContent(contents.get(0)));
}
final String uri = sEntry.getUri();
if (uri != null) {
item.setUri(uri);
}
return item;
}
示例3: createRSSItem
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(final SyndEntry sEntry) {
final Item item = super.createRSSItem(sEntry);
item.setComments(sEntry.getComments());
final SyndContent sContent = sEntry.getDescription();
if (sContent != null) {
item.setDescription(createItemDescription(sContent));
}
final List<SyndContent> contents = sEntry.getContents();
if (Lists.isNotEmpty(contents)) {
final SyndContent syndContent = contents.get(0);
final Content cont = new Content();
cont.setValue(syndContent.getValue());
cont.setType(syndContent.getType());
item.setContent(cont);
}
return item;
}
示例4: parseItem
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
/**
* Parses an item element of an RSS document looking for item information.
* <p/>
* It first invokes super.parseItem and then parses and injects the description property if
* present.
* <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.
*/
@Override
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {
final Item item = super.parseItem(rssRoot, eItem, locale);
final Element description = eItem.getChild("description", getRSSNamespace());
if (description != null) {
item.setDescription(parseItemDescription(rssRoot, description));
}
final Element encoded = eItem.getChild("encoded", getContentNamespace());
if (encoded != null) {
final Content content = new Content();
content.setType(Content.HTML);
content.setValue(encoded.getText());
item.setContent(content);
}
final String about = eItem.getAttributeValue("about", getRDFNamespace());
if (about != null) {
item.setUri(about);
}
return item;
}
示例5: parseItem
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
/**
* Parses an item element of an RSS document looking for item information.
* <p/>
* It first invokes super.parseItem and then parses and injects the description property if
* present.
* <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.
*/
@Override
protected Item parseItem(final Element rssRoot, final Element eItem, final Locale locale) {
final Item item = super.parseItem(rssRoot, eItem, locale);
final Element description = eItem.getChild("description", getRSSNamespace());
if (description != null) {
item.setDescription(parseItemDescription(rssRoot, description));
}
final Element encoded = eItem.getChild("encoded", getContentNamespace());
if (encoded != null) {
final Content content = new Content();
content.setType(Content.HTML);
content.setValue(encoded.getText());
item.setContent(content);
}
return item;
}
示例6: 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;
}
示例7: buildFeedItems
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected List<Item> buildFeedItems(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
List<Item> items = new ArrayList<Item>();
for (String name : model.keySet()) {
Item item = new Item();
item.setTitle(name);
Description description = new Description();
description.setValue((String) model.get(name));
item.setDescription(description);
items.add(item);
}
return items;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: parseItem
import com.rometools.rome.feed.rss.Item; //导入方法依赖的package包/类
@Override
protected Item parseItem(Element rssRoot, Element eItem, Locale locale) {
Item item = super.parseItem(rssRoot, eItem, locale);
Element e = eItem.getChild("description", getRSSNamespace());
if (e != null) {
Description desc = new Description();
desc.setValue(e.getText());
item.setDescription(desc);
}
return item;
}