當前位置: 首頁>>代碼示例>>Java>>正文


Java SyndEntry.setAuthor方法代碼示例

本文整理匯總了Java中com.sun.syndication.feed.synd.SyndEntry.setAuthor方法的典型用法代碼示例。如果您正苦於以下問題:Java SyndEntry.setAuthor方法的具體用法?Java SyndEntry.setAuthor怎麽用?Java SyndEntry.setAuthor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.syndication.feed.synd.SyndEntry的用法示例。


在下文中一共展示了SyndEntry.setAuthor方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createFeedEntry

import com.sun.syndication.feed.synd.SyndEntry; //導入方法依賴的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;
}
 
開發者ID:rrauschenbach,項目名稱:FeedExpander,代碼行數:17,代碼來源:FeedCreatorImpl.java

示例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;
}
 
開發者ID:nodchip,項目名稱:QMAClone,代碼行數:25,代碼來源:RssServletStub.java

示例3: 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;
}
 
開發者ID:Concursive,項目名稱:concourseconnect-community,代碼行數:31,代碼來源:ProjectFeedEntry.java

示例4: 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;
}
 
開發者ID:Concursive,項目名稱:concourseconnect-community,代碼行數:31,代碼來源:BlogPostFeedEntry.java

示例5: 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;
}
 
開發者ID:Concursive,項目名稱:concourseconnect-community,代碼行數:31,代碼來源:ProjectRatingFeedEntry.java

示例6: 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;
}
 
開發者ID:Concursive,項目名稱:concourseconnect-community,代碼行數:31,代碼來源:DiscussionTopicFeedEntry.java

示例7: 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();
}
 
開發者ID:jsmadja,項目名稱:shmuphiscores,代碼行數:32,代碼來源:Timeline.java

示例8: 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;
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:68,代碼來源:RssNoteWriter.java


注:本文中的com.sun.syndication.feed.synd.SyndEntry.setAuthor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。