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


Java SyndEntry.getContents方法代码示例

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


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

示例1: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent desc = sEntry.getDescription();
    if (desc!=null) {
        item.setDescription(createItemDescription(desc));
    }
    List contents = sEntry.getContents();
    if (contents!=null && contents.size() > 0) {
        item.setContent(createItemContent((SyndContent)contents.get(0)));
    }
    
    String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }
    
    return item;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:21,代码来源:ConverterForRSS10.java

示例2: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent sContent = sEntry.getDescription();

    if (sContent != null) {
        item.setDescription(createItemDescription(sContent));
    }

    List contents = sEntry.getContents();

    if ((contents != null) && (contents.size() > 0)) {
        SyndContent syndContent = (SyndContent) contents.get(0);
        Content cont = new Content();
        cont.setValue(syndContent.getValue());
        cont.setType(syndContent.getType());
        item.setContent(cont);
    }

    return item;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:23,代码来源:ConverterForRSS091Userland.java

示例3: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent desc = sEntry.getDescription();
    if (desc!=null) {
        item.setDescription(createItemDescription(desc));
    }
    List contents = sEntry.getContents();
    if (contents!=null && contents.size() > 0) {
        item.setContent(createItemContent((SyndContent)contents.get(0)));
    }
    
    String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }
    
    return item;
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:20,代码来源:ConverterForRSS10.java

示例4: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent sContent = sEntry.getDescription();
    if (sContent!=null) {
        item.setDescription(createItemDescription(sContent));
    }
    List contents = sEntry.getContents();
    if (contents != null && contents.size() > 0) {
        SyndContent syndContent = (SyndContent)contents.get(0);
        Content cont = new Content();
        cont.setValue(syndContent.getValue());
        cont.setType(syndContent.getType());
        item.setContent(cont);
    }
    return item;
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:18,代码来源:ConverterForRSS091Userland.java

示例5: applyNewContentToEntry

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
 * Applies the given html <code>pageContent</code> to the description or the first available
 * content element of the given <code>feedEntry</code>.
 * 
 * @param feedEntry The feed entry where the <code>pageContent</code> should be applied to.
 * @param pageContent The expanded html page which should be applied to the <code>feedEntry</code>.
 */
private void applyNewContentToEntry(@Nonnull SyndEntry feedEntry, @Nonnull String pageContent) {
	if(feedEntry.getDescription() != null) {
		applyNewContentToEntry(feedEntry.getDescription(), pageContent);
	} else if(feedEntry.getContents() != null) {
		applyNewContentToFirstEntry(feedEntry, pageContent);
	} else {
		logger.warn(String.format("Can not find any element in the feed entry %s to apply the page content", feedEntry));
	}
}
 
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:17,代码来源:FeedContentExchangerImpl.java

示例6: convertToItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
 * Converts a <code>SyndEntry</code> into an <code>Item</code>
 * 
 * @param entry
 *            The SyndEntry
 * @return The Item
 */
private Item convertToItem(final SyndEntry entry) {
    // A SyncEntry can potentially have many attributes like title, description,
    // guid, link, enclosure or content. In OLAT, however, items are limited
    // to the attributes, title, description and one media file (called
    // enclosure in RSS) for simplicity.
    final Item e = new Item();
    e.setTitle(entry.getTitle());
    e.setDescription(entry.getDescription() != null ? entry.getDescription().getValue() : null);
    // Extract content objects from syndication item
    final StringBuffer sb = new StringBuffer();
    for (final SyndContent content : (List<SyndContent>) entry.getContents()) {
        // we don't check for type, assume it is html or txt
        if (sb.length() > 0) {
            sb.append("<p />");
        }
        sb.append(content.getValue());
    }
    // Set aggregated content from syndication item as our content
    if (sb.length() > 0) {
        e.setContent(sb.toString());
    }
    e.setGuid(entry.getUri());
    e.setExternalLink(entry.getLink());
    e.setLastModified(entry.getUpdatedDate());
    e.setPublishDate(entry.getPublishedDate());

    for (final Object enclosure : entry.getEnclosures()) {
        if (enclosure instanceof SyndEnclosure) {
            final SyndEnclosure syndEnclosure = (SyndEnclosure) enclosure;
            final Enclosure media = new Enclosure();
            media.setExternalUrl(syndEnclosure.getUrl());
            media.setType(syndEnclosure.getType());
            media.setLength(syndEnclosure.getLength());
            e.setEnclosure(media);
        }
        // Break after one cycle because only one media file is supported
        break;
    }
    return e;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:48,代码来源:FeedManagerImpl.java


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