本文整理匯總了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);
}