本文整理汇总了Java中com.sun.syndication.feed.synd.SyndEntry.setPublishedDate方法的典型用法代码示例。如果您正苦于以下问题:Java SyndEntry.setPublishedDate方法的具体用法?Java SyndEntry.setPublishedDate怎么用?Java SyndEntry.setPublishedDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.syndication.feed.synd.SyndEntry
的用法示例。
在下文中一共展示了SyndEntry.setPublishedDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的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;
}
示例2: createEntries
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的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;
}
示例3: createSyndEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
protected SyndEntry createSyndEntry(Item item) {
SyndEntry syndEntry = super.createSyndEntry(item);
Date pubDate = item.getPubDate();
if (pubDate!=null) {
syndEntry.setPublishedDate(pubDate); //c
}
return syndEntry;
}
示例4: getBuildEntries
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的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;
}
示例5: getBuildEntries
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的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;
}
示例6: makeEntryFromRSSCorrespon
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
* コレポンからRSSのエントリー(それぞれのItem)を作成.
*/
private SyndEntry makeEntryFromRSSCorrespon(
RSSCorrespon c, String baseURL) {
if (log.isDebugEnabled()) {
log.debug("id[{}]", c.getId());
}
SyndEntry entry = new ExtendedSyndEntryImpl();
// title設定
entry.setTitle(c.getSubject());
// description設定
entry.setDescription(makeDescriptionFromRSSCorrespon(c, baseURL));
// link(とguid)設定
entry.setLink(baseURL + "correspon/correspon.jsf?id=" + c.getId()
+ "&projectId=" + c.getProjectId());
// author設定
SyndPerson author = new SyndPersonImpl();
author.setEmail(c.getProjectId() + " : " + c.getProjectNameE());
List<SyndPerson> authors = new ArrayList<SyndPerson>();
authors.add(author);
entry.setAuthors(authors);
// category設定
SyndCategory category = new SyndCategoryImpl();
category.setName(c.getCategory().getLabel());
List<SyndCategory> categories = new ArrayList<SyndCategory>();
categories.add(category);
entry.setCategories(categories);
// pubDate(とdc:date)設定
entry.setPublishedDate(c.getUpdatedAt());
return entry;
}
示例7: getSyndEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的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;
}
示例8: getSyndEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的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;
}
示例9: getSyndEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
public static SyndEntry getSyndEntry(Connection db, int id, String url) throws SQLException {
SyndEntry entry = new SyndEntryImpl();
try {
ProjectRating projectRating = new ProjectRating(db, id);
Project project = ProjectUtils.loadProject(projectRating.getProjectId());
if (!project.getApproved() || !project.getApprovalDate().before(new Timestamp(System.currentTimeMillis()))) {
return null;
}
entry.setTitle(project.getTitle() + " review " + "\"" + projectRating.getTitle() + "\" (" + projectRating.getRating() + "/5)");
entry.setPublishedDate(projectRating.getEntered());
entry.setAuthor(UserUtils.getUserName(projectRating.getEnteredBy()));
entry.setLink(url + "/show/" + project.getUniqueId() + "/review/" + projectRating.getId());
SyndContent description = new SyndContentImpl();
description.setType("text/html");
if (StringUtils.hasText(projectRating.getComment())) {
if (projectRating.getComment().length() > 500) {
description.setValue(projectRating.getComment().substring(0, 500));
} else {
description.setValue(projectRating.getComment());
}
}
entry.setDescription(description);
} catch (Exception e) {
//likely if the object does not exist.
return null;
}
return entry;
}
示例10: getSyndEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
public static SyndEntry getSyndEntry(Connection db, int id, String url) throws SQLException {
SyndEntry entry = new SyndEntryImpl();
try {
Topic topic = new Topic(db, id);
Project project = ProjectUtils.loadProject(topic.getProjectId());
if (!project.getApproved() || !project.getApprovalDate().before(new Timestamp(System.currentTimeMillis()))) {
return null;
}
entry.setTitle("Discussion - " + topic.getSubject());
entry.setPublishedDate(topic.getEntered());
entry.setAuthor(UserUtils.getUserName(topic.getEnteredBy()));
entry.setLink(url + "/show/" + project.getUniqueId() + "/topic/" + topic.getId());
SyndContent description = new SyndContentImpl();
description.setType("text/html");
if (StringUtils.hasText(topic.getBody())) {
if (topic.getBody().length() > 500) {
description.setValue(topic.getBody().substring(0, 500));
} else {
description.setValue(topic.getBody());
}
}
entry.setDescription(description);
} catch (Exception e) {
//likely if the object does not exist.
return null;
}
return entry;
}
示例11: createSyndEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
Date pubDate = item.getPubDate();
if (pubDate!=null) {
syndEntry.setPublishedDate(pubDate); //c
}
return syndEntry;
}
示例12: createFeedEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
private SyndEntry createFeedEntry(String title, String content, int index) {
SyndEntry entry = new SyndEntryImpl();
entry.setTitle(title + index);
entry.setLink("http://localhost:8080/rss-tests/" + index);
entry.setPublishedDate(new Date());
SyndContent description = new SyndContentImpl();
description.setType("text/plain");
description.setValue(content + index);
entry.setDescription(description);
return entry;
}
示例13: rss
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
public String rss() throws IOException, FeedException {
SyndFeed feed = new SyndFeedImpl();
feed.setTitle("hiscores.shmup.com");
feed.setFeedType("rss_2.0");
feed.setDescription("hiscores.shmup.com");
feed.setLink("http://hiscores.shmup.com");
List entries = new ArrayList();
feed.setEntries(entries);
for (Score score : scores) {
SyndEntry entry = new SyndEntryImpl();
entry.setTitle(score.getGameTitle());
entry.setAuthor(score.player.name);
entry.setLink("http://hiscores.shmup.com/score/" + score.id);
SyndContentImpl content = new SyndContentImpl();
content.setValue(score.tweet());
entry.setDescription(content);
entry.setPublishedDate(score.getCreatedAt());
entry.setUpdatedDate(score.getCreatedAt());
SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
enclosure.setUrl(score.game.cover);
enclosure.setType(score.game.getCoverType());
entry.setEnclosures(Lists.newArrayList(enclosure));
entries.add(entry);
}
Writer writer = new StringWriter();
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, writer);
writer.close();
Controller.response().setContentType("application/rss+xml");
return writer.toString();
}
示例14: createRssEntry
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
* Creates the feeds entry.
*
* @param item
* The note.
* @param locale
* The locale.
* @param dateFormatter
* The date formatter.
* @return The entry as {@link SyndEntry}.
*/
private SyndEntry createRssEntry(final NoteData item, Locale locale, DateFormat dateFormatter) {
SyndEntry entry = new SyndEntryImpl();
String noHtmlTitle = StringEscapeHelper.getSingleLineTextFromXML(item.getContent());
int endIndex = Math.min(noHtmlTitle.length(), 100);
String title = item.getBlog().getTitle() + ": " + noHtmlTitle.substring(0, endIndex);
if (title.length() < noHtmlTitle.length()) {
title += "...";
}
if (item.isDirect()) {
title = messages.getText("rss.item.direct.message.prefix", locale) + " " + title;
}
entry.setTitle(title);
entry.setLink(ServiceLocator.instance().getService(PermalinkGenerationManagement.class)
.getNoteLink(item.getBlog().getAlias(), item.getId(), true));
entry.setPublishedDate(item.getCreationDate());
entry.setUpdatedDate(item.getLastModificationDate());
String author = UserNameHelper.getCompleteSignature(item.getUser(), " ", item.getUser()
.getAlias());
entry.setAuthor(author);
ArrayList<SyndCategory> categories = new ArrayList<SyndCategory>();
for (TagData tag : item.getTags()) {
SyndCategoryImpl category = new SyndCategoryImpl();
category.setName(tag.getName());
category.setTaxonomyUri(ServiceLocator.instance()
.getService(PermalinkGenerationManagement.class)
.getTagLink(tag.getName(), true));
categories.add(category);
}
entry.setCategories(categories);
SyndContent description = new SyndContentImpl();
description.setType("text/html");
StringBuilder content = new StringBuilder();
content.append(messages.getText("newsfeed.microblog.content.metadata.author", locale));
content.append(author);
content.append(messages.getText(
"newsfeed.microblog.content.metadata.author.date.separator", locale));
content.append(dateFormatter.format(item.getCreationDate()));
content.append(messages.getText(
"newsfeed.microblog.content.metadata.date.content.separator", locale));
content.append(item.getContent());
if (CollectionUtils.isNotEmpty(item.getAttachments())) {
content.append(messages.getText("rss.item.attachment.list", locale) + " ");
for (AttachmentData attachment : item.getAttachments()) {
content.append("<a href=\"");
content.append(AttachmentHelper.determineAbsoluteAttachmentUrl(attachment, true));
content.append("\">");
content.append(attachment.getFileName());
content.append("</a> ");
}
}
description.setValue(content.toString());
entry.setDescription(description);
return entry;
}
示例15: RSSFeed
import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
/**
* Constructor. The identityKey is needed to generate personal URLs for the corresponding user.
*/
protected RSSFeed(final Feed feed, final Identity identity, final Long courseId, final String nodeId,final Translator translator, RepositoryService repositoryService) {
super();
// This helper object is required for generating the appropriate URLs for
// the given user (identity)
final FeedViewHelper helper = new FeedViewHelper(feed, identity, courseId, nodeId, translator, repositoryService);
setFeedType("rss_2.0");
setEncoding(RSSServlet.DEFAULT_ENCODING);
setTitle(feed.getTitle());
// According to the rss specification, the feed channel description is not
// (explicitly) allowed to contain html tags.
String strippedDescription = FilterFactory.getHtmlTagsFilter().filter(feed.getDescription());
strippedDescription = strippedDescription.replaceAll(" ", " "); // TODO: remove when filter
// does it
setDescription(strippedDescription);
setLink(helper.getJumpInLink());
setPublishedDate(feed.getLastModified());
// The image
if (feed.getImageName() != null) {
final SyndImage image = new SyndImageImpl();
image.setDescription(feed.getDescription());
image.setTitle(feed.getTitle());
image.setLink(getLink());
image.setUrl(helper.getImageUrl());
setImage(image);
}
final List<SyndEntry> episodes = new ArrayList<SyndEntry>();
for (final Item item : feed.getPublishedItems()) {
final SyndEntry entry = new SyndEntryImpl();
entry.setTitle(item.getTitle());
final SyndContent itemDescription = new SyndContentImpl();
itemDescription.setType("text/plain");
itemDescription.setValue(helper.getItemDescriptionForBrowser(item));
entry.setDescription(itemDescription);
// Link will also be converted to the rss guid tag. Except if there's an
// enclosure, then the enclosure url is used.
// Use jump-in link far all entries. This will be overriden if the item
// has an enclosure.
entry.setLink(helper.getJumpInLink() + "#" + item.getGuid());
entry.setPublishedDate(item.getPublishDate());
entry.setUpdatedDate(item.getLastModified());
// The enclosure is the media (audio or video) file of the episode
final Enclosure media = item.getEnclosure();
if (media != null) {
final SyndEnclosure enclosure = new SyndEnclosureImpl();
enclosure.setUrl(helper.getMediaUrl(item));
enclosure.setType(media.getType());
enclosure.setLength(media.getLength());
// Also set the item link to point to the enclosure
entry.setLink(helper.getMediaUrl(item));
final List<SyndEnclosure> enclosures = new ArrayList<SyndEnclosure>();
enclosures.add(enclosure);
entry.setEnclosures(enclosures);
}
episodes.add(entry);
}
setEntries(episodes);
}