本文整理汇总了Java中com.sun.syndication.feed.synd.SyndEntryImpl类的典型用法代码示例。如果您正苦于以下问题:Java SyndEntryImpl类的具体用法?Java SyndEntryImpl怎么用?Java SyndEntryImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SyndEntryImpl类属于com.sun.syndication.feed.synd包,在下文中一共展示了SyndEntryImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: aggregate
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
SyndFeed oldFeed = oldExchange.getIn().getBody(SyndFeed.class);
SyndFeed newFeed = newExchange.getIn().getBody(SyndFeed.class);
if (oldFeed != null && newFeed != null) {
List<SyndEntryImpl> oldEntries = CastUtils.cast(oldFeed.getEntries());
List<SyndEntryImpl> newEntries = CastUtils.cast(newFeed.getEntries());
List<SyndEntryImpl> mergedList = new ArrayList<SyndEntryImpl>(oldEntries.size() + newEntries.size());
mergedList.addAll(oldEntries);
mergedList.addAll(newEntries);
oldFeed.setEntries(mergedList);
} else {
log.debug("Could not merge exchanges. One body was null.");
}
return oldExchange;
}
示例2: createFeedEntry
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private @Nonnull SyndEntry createFeedEntry(@Nonnull String extractPageElement, @Nullable String titleSelector,
@Nullable String linkSelector, @Nullable String authorSelector) {
SyndEntry entry = new SyndEntryImpl();
if(titleSelector != null) {
entry.setTitle(stripHtml(getText(extractPageElement, titleSelector)));
}
if(linkSelector != null) {
entry.setLink(makeAbsolute(getHref(getText(extractPageElement, linkSelector)), pageUrl));
}
if(authorSelector != null) {
entry.setAuthor(stripHtml(getText(extractPageElement, authorSelector)));
}
entry.setDescription(createFeedContent(extractPageElement));
return entry;
}
示例3: apply
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
@Override
public SyndEntry apply(final FedoraEvent event) {
final SyndEntry entry = new SyndEntryImpl();
try {
entry.setTitle(event.getIdentifier());
entry.setLink(event.getPath());
entry.setPublishedDate(new DateTime(event.getDate())
.toDate());
final SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description.setValue(event.getTypes().toString());
entry.setDescription(description);
} catch (final RepositoryException e) {
throw propagate(e);
}
return entry;
}
示例4: createEntries
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private List<SyndEntry> createEntries() throws DatabaseException {
List<SyndEntry> entries = Lists.newArrayList();
Date publishedData = new Date();
for (PacketProblem problem : database.getLastestProblems()) {
SyndEntry entry = new SyndEntryImpl();
String problemReportSentence = problem.getProblemReportSentence();
if (problemReportSentence.length() > 20) {
problemReportSentence = problemReportSentence.substring(0, 20);
}
entry.setTitle("問題番号:" + problem.id + " " + problemReportSentence + "...");
entry.setLink("http://kishibe.dyndns.tv/qmaclone/");
entry.setPublishedDate(publishedData);
SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description.setValue(problemReportSentence);
entry.setDescription(description);
entry.setAuthor(problem.creator);
entries.add(entry);
}
return entries;
}
示例5: createSyndEntry
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
protected SyndEntry createSyndEntry(Item item) {
SyndEntry syndEntry = new SyndEntryImpl();
syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));
syndEntry.setUri(item.getLink());
syndEntry.setTitle(item.getTitle());
syndEntry.setLink(item.getLink());
return syndEntry;
}
示例6: getBuildEntries
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private List getBuildEntries(final ConfigurationManager cm, final int activeBuildID, final BuildStatusURLGenerator urlGenerator) {
final List result = new ArrayList(11);
// traverse cmplete build runs for the given build
final List completedBuildRuns = cm.getCompletedBuildRuns(activeBuildID, 0, PublishedResultFeedGenerator.MAX_BUILD_RUNS);
for (final Iterator i = completedBuildRuns.iterator(); i.hasNext();) {
final BuildRun buildRun = (BuildRun)i.next();
// compose description
final String resultDescr = buildRun.getResultID() == BuildRun.BUILD_RESULT_BROKEN ? ": " + buildRun.getResultDescription() : "";
final StringBuffer subj = new StringBuffer(200);
subj.append(buildRun.getBuildName()).append(" # ").append(buildRun.getBuildRunNumberAsString());
subj.append(' ').append(new VerbialBuildResult().getVerbialResultString(buildRun));
subj.append(resultDescr);
// compose entry
final SyndEntry entry = new SyndEntryImpl();
entry.setTitle(subj.toString());
entry.setPublishedDate(buildRun.getFinishedAt());
entry.setLink(urlGenerator.makeBuildRunResultURL(buildRun));
final SyndContent description = new SyndContentImpl();
description.setType("text/plain");
//description.setType("text/html");
description.setValue(subj.toString());
entry.setDescription(description);
// edd entry to the result
result.add(entry);
}
return result;
}
示例7: getBuildEntries
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private List getBuildEntries(final ConfigurationManager cm, final int activeBuildID, final BuildStatusURLGenerator urlGenerator) {
final List result = new ArrayList(1);
// traverse cmplete build runs for the given build
final List completedBuildRuns = cm.getCompletedBuildRuns(activeBuildID, 0, MAX_BUILD_RUNS);
for (final Iterator i = completedBuildRuns.iterator(); i.hasNext();) {
final BuildRun buildRun = (BuildRun) i.next();
// compose description
final String resultDescr = buildRun.getResultID() == BuildRun.BUILD_RESULT_BROKEN ? ": " + buildRun.getResultDescription() : "";
final StringBuffer subj = new StringBuffer(200);
subj.append(buildRun.getBuildName()).append(" # ").append(buildRun.getBuildRunNumberAsString());
subj.append(" @ ").append(buildRun.getChangeListNumber());
subj.append(" on ").append(new SimpleDateFormat("yyyy-MM-dd HH:ss z").format(buildRun.getFinishedAt()));
subj.append(' ').append(new VerbialBuildResult().getVerbialResultString(buildRun));
subj.append(resultDescr);
// compose entry
final SyndEntry entry = new SyndEntryImpl();
entry.setTitle(subj.toString());
entry.setPublishedDate(buildRun.getFinishedAt());
entry.setLink(urlGenerator.makeBuildRunResultURL(buildRun));
final SyndContent description = new SyndContentImpl();
description.setType("text/plain");
//description.setType("text/html");
description.setValue(subj.toString());
entry.setDescription(description);
// edd entry to the result
result.add(entry);
}
return result;
}
示例8: check
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public static boolean check (SyndEntryImpl l, long time) {
if (l.getUpdatedDate() != null) {
return l.getUpdatedDate().getTime() >= (time);
} else {
return l.getPublishedDate().getTime() >= (time);
}
}
示例9: main
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public static void main (String args[]) {
SyndFeed feed = getFeed("http://status.aws.amazon.com/rss/all.rss");
//feed.getEntries().forEach(System.out::println);
System.out.println("---------------");
Date d = new Date((2016 - 1900), 9, 6);
System.out.println("date: " + d.getTime());
List<SyndEntryImpl> l = getFeedAfter(feed, d.getTime());
System.out.println("size: " + l.size());
l.forEach(System.out::println);
}
示例10: getServiceStatus
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
@Nonnull
@Override public String getServiceStatus () {
StringBuilder ret = new StringBuilder();
SyndFeed feed = RssUtils.getFeed(getFeedURL());
if (lastUpdate == 0) {
lastUpdate = new Date().getTime();
}
for (SyndEntryImpl syn : RssUtils.getFeedAfter(feed, lastUpdate)) {
ret.append(feed.getTitle()).append(", ");
}
return ret.toString();
}
示例11: createInvalidLinkedEntriesWithTestDescription
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private List<SyndEntry> createInvalidLinkedEntriesWithTestDescription() {
SyndEntry entry1 = new SyndEntryImpl();
entry1.setLink("test://not_exists1.html");
SyndContentImpl syndContent1 = new SyndContentImpl();
syndContent1.setValue("Test");
entry1.setDescription(syndContent1);
SyndEntry entry2 = new SyndEntryImpl();
entry2.setLink("test://not_exists2.html");
SyndContentImpl syndContent2 = new SyndContentImpl();
syndContent2.setValue("Test");
entry2.setDescription(syndContent2);
return Arrays.asList(entry1, entry2);
}
示例12: createValidLinkedEntriesWithEmptyDescription
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private List<SyndEntry> createValidLinkedEntriesWithEmptyDescription(String content) {
SyndEntry entry1 = new SyndEntryImpl();
entry1.setLink("test://feeds/valid_feed/content_1.html");
SyndContentImpl syndContent1 = new SyndContentImpl();
syndContent1.setValue(content);
entry1.setDescription(syndContent1);
SyndEntry entry2 = new SyndEntryImpl();
entry2.setLink("test://feeds/valid_feed/content_2.html");
SyndContentImpl syndContent2 = new SyndContentImpl();
syndContent2.setValue(content);
entry2.setDescription(syndContent2);
return Arrays.asList(entry1, entry2);
}
示例13: applyFeedEntry
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
private void applyFeedEntry(List<SyndEntry> result, String author, String content) {
SyndEntryImpl entry = new SyndEntryImpl();
entry.setAuthor(author);
SyndContentImpl desc = new SyndContentImpl();
desc.setValue(content);
entry.setDescription(desc);
entry.setContents(Arrays.asList(desc));
result.add(entry);
}
示例14: getSyndEntry
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public static SyndEntry getSyndEntry(Connection db, int id, String url) throws SQLException {
SyndEntry entry = new SyndEntryImpl();
try {
Project project = new Project(db, id);
if (!project.getApproved() || !project.getApprovalDate().before(new Timestamp(System.currentTimeMillis()))) {
return null;
}
entry.setTitle(project.getTitle());
// Need to check status
entry.setPublishedDate(project.getEntered());
entry.setAuthor(UserUtils.getUserName(project.getEnteredBy()));
entry.setLink(url + "/show/" + project.getUniqueId());
SyndContent description = new SyndContentImpl();
description.setType("text/html");
if (StringUtils.hasText(project.getShortDescription())) {
if (project.getShortDescription().length() > 1000) {
description.setValue(project.getShortDescription().substring(0, 1000));
} else {
description.setValue(project.getShortDescription());
}
}
entry.setDescription(description);
} catch (Exception e) {
//likely if the object does not exist.
return null;
}
return entry;
}
示例15: getSyndEntry
import com.sun.syndication.feed.synd.SyndEntryImpl; //导入依赖的package包/类
public static SyndEntry getSyndEntry(Connection db, int id, String url) throws SQLException {
SyndEntry entry = new SyndEntryImpl();
try {
BlogPost blogPost = new BlogPost(db, id);
Project project = ProjectUtils.loadProject(blogPost.getProjectId());
if (blogPost.getStatus() != BlogPost.PUBLISHED) {
return null;
}
entry.setTitle(blogPost.getSubject());
// Need to check status
entry.setPublishedDate(blogPost.getStartDate());
entry.setAuthor(UserUtils.getUserName(blogPost.getEnteredBy()));
entry.setLink(url + "/show/" + project.getUniqueId() + "/post/" + blogPost.getId());
SyndContent description = new SyndContentImpl();
description.setType("text/html");
if (StringUtils.hasText(blogPost.getIntro())) {
if (blogPost.getIntro().length() > 1000) {
description.setValue(blogPost.getIntro().substring(0, 1000));
} else {
description.setValue(blogPost.getIntro());
}
}
entry.setDescription(description);
} catch (Exception e) {
//likely if the object does not exist.
return null;
}
return entry;
}