Example #1
0
 public static SyndFeed create(
     List<Bookmark> bookmarks,
     String author,
     String title,
     String link,
     Date pubDate,
     String feedUri) {
   logger.debug("SyndFeedFactory create method called");
   logger.debug("bookmarks=" + bookmarks);
   logger.debug("author=" + author);
   logger.debug("title=" + title);
   logger.debug("link=" + link);
   logger.debug("pubDate=" + pubDate);
   logger.debug("feedUri=" + feedUri);
   SyndFeed syndFeed = new SyndFeedImpl();
   syndFeed.setAuthor(author);
   syndFeed.setTitle(title);
   syndFeed.setUri(feedUri);
   syndFeed.setLink(link);
   syndFeed.setPublishedDate(pubDate);
   List<SyndEntry> entries = new ArrayList<SyndEntry>();
   for (Bookmark bmark : bookmarks) {
     SyndEntry entry = new SyndEntryImpl();
     entry.setTitle(bmark.getTitle());
     entry.setAuthor(bmark.getUser().getUsername());
     entry.setLink(bmark.getLink().getUrl());
     entry.setUri("urn:bookmark:" + bmark.getId());
     entry.setUpdatedDate(bmark.getLastUpdated());
     List<String> tags = bmark.getTagList();
     List<SyndCategory> cats = new ArrayList<SyndCategory>();
     for (String aTag : tags) {
       SyndCategory aCat = new SyndCategoryImpl();
       aCat.setName(aTag);
       cats.add(aCat);
     }
     if (cats.isEmpty() == false) {
       entry.setCategories(cats);
     }
     SyndContent cnt = new SyndContentImpl();
     cnt.setType("text/html");
     cnt.setValue(bmark.getNotes());
     entry.setDescription(cnt);
     entries.add(entry);
   }
   syndFeed.setEntries(entries);
   syndFeed.setEncoding("UTF-8");
   logger.debug("done initializing syndFeed object");
   return syndFeed;
 }
  public void copyInto(WireFeed feed, SyndFeed syndFeed) {
    syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
    if (((List) feed.getForeignMarkup()).size() > 0) {
      syndFeed.setForeignMarkup(feed.getForeignMarkup());
    }
    syndFeed.setEncoding(feed.getEncoding());
    Channel channel = (Channel) feed;
    syndFeed.setTitle(channel.getTitle());
    syndFeed.setLink(channel.getLink());
    syndFeed.setDescription(channel.getDescription());

    Image image = channel.getImage();
    if (image != null) {
      syndFeed.setImage(createSyndImage(image));
    }

    List items = channel.getItems();
    if (items != null) {
      syndFeed.setEntries(createSyndEntries(items));
    }
  }
Example #3
0
 public static SyndFeed createFromBookmarkDoc(
     List<BookmarkDoc> bookmarks,
     String author,
     String title,
     String link,
     Date pubDate,
     String feedUri) {
   logger.debug("SyndFeedFactory create method called");
   logger.debug("bookmarks=" + bookmarks);
   logger.debug("author=" + author);
   logger.debug("title=" + title);
   logger.debug("link=" + link);
   logger.debug("pubDate=" + pubDate);
   logger.debug("feedUri=" + feedUri);
   SyndFeed syndFeed = new SyndFeedImpl();
   syndFeed.setAuthor(author);
   syndFeed.setTitle(title);
   syndFeed.setUri(feedUri);
   syndFeed.setLink(link);
   syndFeed.setPublishedDate(pubDate);
   List<SyndEntry> entries = new ArrayList<SyndEntry>();
   for (BookmarkDoc bmark : bookmarks) {
     SyndEntry entry = new SyndEntryImpl();
     entry.setTitle(bmark.getTitle());
     entry.setAuthor(bmark.getUsername());
     entry.setLink(bmark.getUrl());
     entry.setUri("urn-x:gnizr:bookmark:" + bmark.getBookmarkId());
     SyndContent cnt = new SyndContentImpl();
     cnt.setType("text/html");
     if (bmark.getNotes() != null) {
       cnt.setValue(bmark.getNotes());
       entry.setDescription(cnt);
     }
     entries.add(entry);
   }
   syndFeed.setEntries(entries);
   syndFeed.setEncoding("UTF-8");
   logger.debug("done initializing syndFeed object");
   return syndFeed;
 }