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


Java SyndEntry.getUpdatedDate方法代码示例

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


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

示例1: getEntryComparator

import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
 * This Comparator assumes that SyndEntry returns a valid Date either for
 * getPublishedDate() or getUpdatedDate().
 */
private Comparator<SyndEntry> getEntryComparator() {
	return new Comparator<SyndEntry>() {
		@Override
		public int compare(SyndEntry e1, SyndEntry e2) {
			if (e1.getPublishedDate() == null &&
					e1.getUpdatedDate() == null) {
				// we will be ignoring such entries anyway
				return 0;
			}
			Date d1 =
					e1.getPublishedDate() != null ? e1.getPublishedDate() :
							e1.getUpdatedDate();
			Date d2 =
					e2.getPublishedDate() != null ? e2.getPublishedDate() :
							e2.getUpdatedDate();
			if (d1.after(d2)) return 1;
			if (d1.before(d2)) return -1;
			return 0;
		}
	};
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:26,代码来源:FeedManagerImpl.java

示例2: postFeedEntries

import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private long postFeedEntries(Feed feed, List<SyndEntry> entries)
		throws DbException {

	long lastEntryTime = feed.getLastEntryTime();
	Transaction txn = db.startTransaction(false);
	try {
		Collections.sort(entries, getEntryComparator());
		for (SyndEntry entry : entries) {
			long entryTime;
			if (entry.getPublishedDate() != null) {
				entryTime = entry.getPublishedDate().getTime();
			} else if (entry.getUpdatedDate() != null) {
				entryTime = entry.getUpdatedDate().getTime();
			} else {
				// no time information available, ignore this entry
				LOG.warning("Entry has no date, ignored.");
				continue;
			}
			if (entryTime > feed.getLastEntryTime()) {
				postEntry(txn, feed, entry);
				if (entryTime > lastEntryTime) lastEntryTime = entryTime;
			}
		}
		db.commitTransaction(txn);
	} finally {
		db.endTransaction(txn);
	}
	return lastEntryTime;
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:30,代码来源:FeedManagerImpl.java

示例3: ExtLibOPDSEntry

import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
public ExtLibOPDSEntry(SyndEntry syndEntry) {
    id = syndEntry.getUri();
    title = new Res("opds.first.value",syndEntry.getTitle());
    links = syndEntry.getLinks().stream().
            map(ExtLibOPDSEntry::mapLink).filter(Objects::nonNull).collect(Collectors.toList());
    updated = syndEntry.getUpdatedDate();
    content = Optional.of(syndEntry.getContents().stream().
            map(sc -> new OPDSContent(sc.getType(), sc.getValue(), null)).collect(Collectors.toList()));

    List<OPDSAuthor> authors = syndEntry.getAuthors().stream().
            map(person -> new ExtLibAuthor(person.getName(), "")).collect(Collectors.toList());
    this.authors = Optional.of(authors);
}
 
开发者ID:patexoid,项目名称:ZombieLib2,代码行数:14,代码来源:ExtLibOPDSEntry.java

示例4: getLastDate

import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private Date getLastDate(SyndEntry entry) {
    if(entry.getUpdatedDate() != null) {
        return entry.getUpdatedDate();
    } else {
        return entry.getPublishedDate();
    }
}
 
开发者ID:kevoree,项目名称:kevoree-library,代码行数:8,代码来源:RSSEventListener.java

示例5: computeEntryTag

import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private String computeEntryTag(final SyndEntry entry) {

        // Following hash algorithm suggested by Robert Cooper needs to be
        // evaluated in future.
        // int hash = ( entry.getUri() != null ? entry.getUri().hashCode() :
        // entry.getLink().hashCode() ) ^
        // (entry.getUpdatedDate() != null ? entry.getUpdatedDate().hashCode() :
        // entry.getPublishedDate().hashCode()) ^
        // entry.getTitle().hashCode() ^
        // entry.getDescription().hashCode();

        final String id = entry.getUri();
        Date updateDate = entry.getUpdatedDate();
        final Date publishedDate = entry.getPublishedDate();
        if (updateDate == null) {
            if (publishedDate != null) {
                updateDate = publishedDate;
            } else {
                // For misbehaving feeds that do not set updateDate or
                // publishedDate we use current tiem which pretty mucg assures
                // that it will be viewed as
                // changed even when it is not
                updateDate = new Date();
            }
        }
        final String key = id + ":" + entry.getUpdatedDate();
        return computeDigest(key);
    }
 
开发者ID:rometools,项目名称:rome,代码行数:29,代码来源:DeltaSyndFeedInfo.java

示例6: getEntryUpdateDate

import com.rometools.rome.feed.synd.SyndEntry; //导入方法依赖的package包/类
private Date getEntryUpdateDate(SyndEntry item) {
	Date date = item.getUpdatedDate();
	if (date == null) {
		date = item.getPublishedDate();
	}
	if (date == null) {
		date = new Date();
	}
	return date;
}
 
开发者ID:Athou,项目名称:commafeed,代码行数:11,代码来源:FeedParser.java


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