Package com.sun.syndication.feed.synd

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


            if (contents!=null && contents.size()>0) {
                content = (Content) contents.get(0);
            }
        }
        if (content!=null) {
            SyndContent sContent = new SyndContentImpl();
            sContent.setType(content.getType());
            sContent.setValue(content.getValue());
            syndEntry.setDescription(sContent);
        }

        List contents = entry.getContents();
        if (contents.size()>0) {
            List sContents = new ArrayList();
            for (int i=0;i<contents.size();i++) {
                content = (Content) contents.get(i);
                SyndContent sContent = new SyndContentImpl();
                sContent.setType(content.getType());
                sContent.setValue(content.getValue());
                sContents.add(sContent);
            }
            syndEntry.setContents(sContents);
        }
View Full Code Here


            List list = new ArrayList();
            list.add(link);
            aEntry.setAlternateLinks(list);
        }

        SyndContent sContent = sEntry.getDescription();
        if (sContent!=null) {
            Content content = new Content();
            content.setType(sContent.getType());
            content.setValue(sContent.getValue());
            content.setMode(Content.XML);
            aEntry.setSummary(content);
        }

        List contents = sEntry.getContents();
        if (contents.size()>0) {
            List aContents = new ArrayList();
            for (int i=0;i<contents.size();i++) {
                sContent = (SyndContentImpl) contents.get(i);
                Content content = new Content();
                content.setType(sContent.getType());
                content.setValue(sContent.getValue());
                content.setMode(Content.XML);
                aContents.add(content);

            }
            aEntry.setContents(aContents);
View Full Code Here

          feed.setLink("http://rome.dev.java.net");
          feed.setDescription("This tests using rfc3229 delta encoding.");
 
          List entries = new ArrayList();
          SyndEntry entry;
          SyndContent description;
 
          entry = new SyndEntryImpl();
          entry.setTitle(DELTA_FEED_ENTRY_TITLE);
          entry.setLink("http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html");
          try {
              DateFormat dateParser = new SimpleDateFormat("yyyy-MM-dd");
              entry.setPublishedDate(dateParser.parse("2004-11-25"));
          }
          catch (ParseException ex) {
              //
          }
          description = new SyndContentImpl();
          description.setType("text/plain");
          description.setValue("Test for RFC3229 Delta Encoding");         
          entry.setDescription(description);         
          entries.add(entry);
         
          feed.setEntries(entries);
         
View Full Code Here

    protected SyndEntry createSyndEntry(Item item) {
        SyndEntry syndEntry = super.createSyndEntry(item);

        Description desc = item.getDescription();
        if (desc!=null) {
            SyndContent content = new SyndContentImpl();
            content.setType(desc.getType());
            content.setValue(desc.getValue());
            syndEntry.setDescription(content);

            // contents[0] and description then reference the same content
            //
            List contents = new ArrayList();
View Full Code Here

    }

    protected Item createRSSItem(SyndEntry sEntry) {
        Item item = super.createRSSItem(sEntry);

        SyndContent sContent = sEntry.getDescription();
        if (sContent!=null) {
            item.setDescription(createItemDescription(sContent));
        }
        return item;
    }
View Full Code Here

          tags.add(cat);
        }
        entry.setCategories(tags);
      }

      SyndContent content = new SyndContentImpl();
      if (StringUtils.isEmpty(entryModel.contentType)
          || entryModel.contentType.equalsIgnoreCase("text/plain")) {
        content.setType("text/html");
        content.setValue(StringUtils.breakLinesForHtml(entryModel.content));
      } else {
        content.setType(entryModel.contentType);
        content.setValue(entryModel.content);
      }
      entry.setDescription(content);

      entries.add(entry);
    }
View Full Code Here

     * @throws IOException when the SyndEntry fields can't be read or parsed to JSON.
     */
    private String determineMessageBodyAsJsonFromSyndEntry(SyndEntry entry) throws IOException {
        String body = ""; //default Body
        ObjectMapper om = new ObjectMapper();
        SyndContent desc = entry.getDescription();

        if (desc != null) {
            body = om.writeValueAsString(desc);
        } else if (entry.getContents().size() > 0) {
            body = om.writeValueAsString(entry.getContents().get(0)); //grab the first content item and use as body
View Full Code Here

        DateTimeFormatter df = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
        List<SyndEntry> entries = new LinkedList<SyndEntry>();
        for (int i = 0; i < 9; i++) {
            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle("テスト" + i);
            SyndContent description = new SyndContentImpl();
            description.setValue("テスト説明" + i);
            entry.setDescription(description);
            entry.setLink("http://ryu22e.org/" + i);

            NicoliveModule module = new NicoliveModule();
            module.setOpenTime(datetime.minusDays(i).toString(df));
            module.setStartTime(datetime
                .minusDays(i)
                .plusMinutes(10)
                .toString(df));
            module.setType("official");
            entry.getModules().add(module);

            entries.add(entry);
        }
        // NicoliveModuleなしのデータも含める。
        SyndEntry invalidEntry = new SyndEntryImpl();
        invalidEntry.setTitle("NicoliveModuleなしデータ");
        SyndContent description = new SyndContentImpl();
        description.setValue("テスト説明");
        invalidEntry.setDescription(description);
        invalidEntry.setLink("http://ryu22e.org/");
        entries.add(invalidEntry);

        feed.setEntries(entries);
View Full Code Here

        categories.add(syndCategory);
       
        syndEntry.setCategories(categories);
       
        // description.
        SyndContent descriptionContent = new SyndContentImpl();
       
        descriptionContent.setType("text/html");
        descriptionContent.setValue(description);
        syndEntry.setDescription(descriptionContent);
       
        // title, link, author, categories.
        syndEntry.setTitle(title);
        syndEntry.setLink(link);
View Full Code Here

    for (Iterator itr = entries.iterator(); itr.hasNext(); ) {
      SyndEntry entry = (SyndEntry)itr.next();
      Document doc = docFactory.createDocument();
      doc.addField("title", entry.getTitle(), StoreOption.YES,
          IndexOption.TOKENIZED);
      SyndContent descContent = entry.getDescription();
      String contentType = descContent.getType();
      String description = null;
      if (contentType != null && contentType.indexOf("text/html") != -1) {
        // HTML description; removes the tags
        description = descContent.getValue().replaceAll("<[^>]+>", "");
      } else {
        description = descContent.getValue();
      }
      doc.addField("description", description, StoreOption.YES,
          IndexOption.TOKENIZED);
      String author = entry.getAuthor();
      if (author == null)
View Full Code Here

TOP

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

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.