本文整理汇总了Java中com.sun.syndication.feed.synd.SyndFeed.getDescription方法的典型用法代码示例。如果您正苦于以下问题:Java SyndFeed.getDescription方法的具体用法?Java SyndFeed.getDescription怎么用?Java SyndFeed.getDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.syndication.feed.synd.SyndFeed
的用法示例。
在下文中一共展示了SyndFeed.getDescription方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFeed
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
protected Feed createFeed(long id, String feedUrl, SyndFeed syndFeed) {
String selfUrl = syndFeed.getLink() != null ? syndFeed.getLink() : feedUrl;
// TODO: author
return new Feed(
id,
0,
selfUrl,
syndFeed.getTitle() != null && syndFeed.getTitle().length() > 0 ? syndFeed.getTitle() : feedUrl,
syndFeed.getDescription() != null && syndFeed.getDescription().length() > 0 ? syndFeed.getDescription() : "-",
syndFeed.getPublishedDate() != null ? syndFeed.getPublishedDate().getTime() : 0
);
}
示例2: createRealFeed
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
public WireFeed createRealFeed(SyndFeed syndFeed) {
Feed aFeed = new Feed(getType());
aFeed.setModules(ModuleUtils.cloneModules(syndFeed.getModules()));
aFeed.setEncoding(syndFeed.getEncoding());
aFeed.setId(syndFeed.getUri());
aFeed.setTitle(syndFeed.getTitle());
String sLink = syndFeed.getLink();
if (sLink!=null) {
Link link = new Link();
link.setRel("alternate");
link.setHref(sLink);
List list = new ArrayList();
list.add(link);
aFeed.setAlternateLinks(list);
}
String sDesc = syndFeed.getDescription();
if (sDesc!=null) {
Content tagline = new Content();
tagline.setValue(sDesc);
aFeed.setTagline(tagline);
}
aFeed.setLanguage(syndFeed.getLanguage());
List authors = syndFeed.getAuthors();
if (authors!=null && authors.size() > 0) {
aFeed.setAuthors(createAtomPersons(authors));
}
aFeed.setCopyright(syndFeed.getCopyright());
aFeed.setModified(syndFeed.getPublishedDate());
List sEntries = syndFeed.getEntries();
if (sEntries!=null) {
aFeed.setEntries(createAtomEntries(sEntries));
}
return aFeed;
}
示例3: feedUpdate
import com.sun.syndication.feed.synd.SyndFeed; //导入方法依赖的package包/类
/**
* Updates feed information such as accessed time and other attributes
* pertaining feed/channel.
*
* @param feedDB
* @param feed
*/
@SuppressWarnings("unchecked")
private void feedUpdate(DBObject feedDB, SyndFeed feed) {
// this field is for RSS Delegate worker to check for stalled threads or
// threads that crashed and were not able to update used filed back to 0
feedDB.put("accessedAt", new Date());
/******** REQUIRED channel elements as defined in RSS 2.0 Specification ********/
// http://cyber.law.harvard.edu/rss/rss.html#
// even though this elements are required by specification we
// cannot trust the source
if (feed.getTitle() != null)
feedDB.put("title", feed.getTitle());
if (feed.getLink() != null)
feedDB.put("link", feed.getLink());
if (feed.getDescription() != null)
feedDB.put("description", feed.getDescription());
/******** OPTIONAL channel elements as defined in RSS 2.0 Specification ********/
if (feed.getLanguage() != null)
feedDB.put("language", feed.getLanguage());
if (feed.getCopyright() != null)
feedDB.put("copyright", feed.getCopyright());
// no specific get method for managing editor and web master in rome
// library. Using authors instead
if (feed.getAuthors() != null && feed.getAuthors().size() > 0) {
ArrayList<BasicDBObject> authors = getAuthors((ArrayList<SyndPerson>) feed
.getAuthors());
feedDB.put("authors", authors);
}
if (feed.getPublishedDate() != null)
feedDB.put("pubDate", feed.getPublishedDate());
// last build date does not exist in rome library
if (feed.getCategories() != null && feed.getCategories().size() > 0) {
ArrayList<BasicDBObject> categories = getCategories((ArrayList<SyndCategory>) feed
.getCategories());
feedDB.put("category", categories);
}
// generator does not exist in rome library
// docs does not exist in rome library
// cloud does not exist in rome library
// ttl does not exist in rome library
SyndImage feedImage = feed.getImage();
if (feedImage != null) {
BasicDBObject imageDB = new BasicDBObject();
if (feedImage.getUrl() != null)
imageDB.append("url", feedImage.getUrl());
if (feedImage.getTitle() != null)
imageDB.append("title", feedImage.getTitle());
if (feedImage.getLink() != null)
imageDB.append("link", feedImage.getLink());
if (feedImage.getDescription() != null)
imageDB.append("description", feedImage.getDescription());
if (feedImage.getUrl() != null || feedImage.getTitle() != null
|| feedImage.getLink() != null
|| feedImage.getDescription() != null)
feedDB.put("image", imageDB);
// width does not exist in rome library
// height does not exist in rome library
}
// rating does not exist in rome library
// text input does not exist in rome library
// skip hours does not exist in rome library
// skip days does not exist in rome library
rssColl.update(new BasicDBObject("feedUrl", feedDB.get("feedUrl")),
feedDB);
}