Exemplo n.º 1
0
 private FeedItem convertEntryToFeedItem(SyndEntry entry) {
   if (entry != null) {
     String content = this.getEntryContent(entry);
     String description =
         entry.getDescription() == null ? content : entry.getDescription().getValue();
     String title = entry.getTitle();
     String url = entry.getLink();
     Date date =
         entry.getUpdatedDate() == null ? entry.getPublishedDate() : entry.getUpdatedDate();
     return new FeedItem(content, description, title, url, date);
   }
   return null;
 }
Exemplo n.º 2
0
  private String getEntryContent(SyndEntry entry) {
    List contents = entry.getContents();
    StringBuffer buffer = new StringBuffer();
    for (int index = 0; contents != null && index < contents.size(); index++) {
      SyndContent content = (SyndContent) contents.get(index);
      buffer.append(content.getValue());
    }

    return (buffer.length() == 0) ? entry.getDescription().getValue() : buffer.toString();
  }