本文整理汇总了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;
}
};
}
示例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;
}
示例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);
}
示例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();
}
}
示例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);
}
示例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;
}