Package com.sun.syndication.feed.synd

Examples of com.sun.syndication.feed.synd.SyndEntry


    assertEquals(link,syndFeed.getLink());
   
    List<SyndEntry> entries = syndFeed.getEntries();
    assertEquals(1,entries.size());
   
    SyndEntry entry = entries.get(0);
    assertEquals("http://zirr.us/",entry.getLink());
    assertEquals("zirrus",entry.getTitle());
    assertEquals("gnizr",entry.getAuthor());
    SyndContent cont = entry.getDescription();
    assertNotNull(cont);
    assertEquals("website",cont.getValue());
    assertEquals("text/html",cont.getType());
   
    List<SyndCategory> cats = entry.getCategories();
    assertFalse(cats.isEmpty());
    SyndCategory cat = cats.get(0);
    assertEquals("cnn",cat.getName());
  }
View Full Code Here


    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");
View Full Code Here

    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");
View Full Code Here

            log.debug("starting conversion from feed URL: " + feedURL);

            Feed feed = convertSyndFeed(syndFeed);

            for (Object o : syndFeed.getEntries()) {
                SyndEntry syndEntry = (SyndEntry)o;
                FeedEntry fe = convertSyndEntry(syndEntry);

                // Append some information on the title
                fe.setTitlePrefix("(" + feed.getTitle() + ") ");
                //fe.setTitleSuffix(" (" + fe.getAuthor() + ")");
View Full Code Here

      setImage(image);
    }

    List<SyndEntry> episodes = new ArrayList<SyndEntry>();
    for (Item item : feed.getPublishedItems()) {
      SyndEntry entry = new SyndEntryImpl();
      entry.setTitle(item.getTitle());

      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
      Enclosure media = item.getEnclosure();
      if (media != null) {
        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));
        List<SyndEnclosure> enclosures = new ArrayList<SyndEnclosure>();
        enclosures.add(enclosure);
        entry.setEnclosures(enclosures);
      }

      episodes.add(entry);
    }
    setEntries(episodes);
View Full Code Here

      }
      URL realUrl = new URL(url);
      SyndFeed feed = input.build(new XmlReader(realUrl));
      if(!feed.getEntries().isEmpty()) {
        //check for enclosures
        SyndEntry entry = (SyndEntry)feed.getEntries().get(0);
        if(type != null && type.indexOf("BLOG") >= 0) {
          return new ValidatedURL(url, ValidatedURL.State.VALID);
        }
        if(entry.getEnclosures().isEmpty()) {
          return new ValidatedURL(url, ValidatedURL.State.NO_ENCLOSURE);
        }
      }
      //The feed was read successfully
      return new ValidatedURL(url, ValidatedURL.State.VALID);
View Full Code Here

    image.setTitle("OLAT - Online Learning And Training");
    image.setLink(getLink());
    setImage(image);

    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    SyndEntry entry = new SyndEntryImpl();
    entry.setTitle(translator.translate("rss.olat.title", new String[] { NotificationHelper.getFormatedName(identity) }));
    entry.setLink(getLink());
    SyndContent description = new SyndContentImpl();
    description.setType("text/plain");
    description.setValue(translator.translate("rss.olat.description"));
    entry.setDescription(description);
    entries.add(entry);

    // bookmark news
    for (Bookmark bookmark : bookmarks) {
      SyndEntry item = new SyndEntryImpl();
      item.setTitle(translator.translate("rss.bookmark.title", new String[] { bookmark.getTitle() }));
      // create jump in link with factory method from manager
      String itemLink = BookmarkManager.getInstance().createJumpInURL(bookmark);
      item.setLink(itemLink);
      SyndContent itemDescription = new SyndContentImpl();
      itemDescription.setType("text/plain");
      itemDescription.setValue(bookmark.getDescription());
      item.setDescription(itemDescription);
      entries.add(item);
    }

    // notification news
    // we are only interested in subscribers which listen to a valid publisher
    List<Subscriber> subs = man.getValidSubscribers(identity);
    for (Subscriber subscriber : subs) {
      SubscriptionItem si = man.createSubscriptionItem(subscriber, locale, SubscriptionInfo.MIME_PLAIN, SubscriptionInfo.MIME_HTML);
      if (si != null) {
        SyndEntry item = new SyndEntryImpl();
        item.setTitle(si.getTitle());
        item.setLink(si.getLink());
        SyndContent itemDescription = new SyndContentImpl();
        itemDescription.setType(SubscriptionInfo.MIME_HTML);
        itemDescription.setValue(si.getDescription());
        item.setDescription(itemDescription);
        entries.add(item);
      }
    }
    setEntries(entries);
  }
View Full Code Here

            SyndContent content = new SyndContentImpl();
            content.setType("text/html");
            content.setValue(Helper.cleanupHTML(event.getDescription()));

            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle(event.getTitle());
            entry.setLink(event.getEventURL());
            entry.setPublishedDate(event.getCreatedAt().toDate());

            entry.setAuthor(event.getOwner().getTwitterScreenName());
            entry.setDescription(content);

            entries.add(entry);
        }

        feed.setEntries(entries);
View Full Code Here

        for (EventActivity activity : activities) {
            SyndContent content = new SyndContentImpl();
            content.setType("text/html");
            content.setValue(Helper.cleanupHTML(activity.getContent()));

            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle(Helper.h(activity.getTitle()));
            entry.setDescription(content);

            entries.add(entry);
        }

        feed.setEntries(entries);
View Full Code Here

                    String thisLink = entryLink + "?articleContentId=" + v.getString("contentId") + "&blogContentId=" + contentId;
                    SyndContent desc = new SyndContentImpl();
                    desc.setType("text/plain");
                    desc.setValue(sub);

                    SyndEntry entry = new SyndEntryImpl();
                    entry.setTitle(v.getString("contentName"));
                    entry.setPublishedDate(v.getTimestamp("createdDate"));
                    entry.setDescription(desc);
                    entry.setLink(thisLink);
                    entry.setAuthor((v.getString("createdByUserLogin")));
                    entries.add(entry);
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.synd.SyndEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.