Examples of SyndEntryImpl


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

    image.setLink(hostUrl);
    feed.setImage(image);

    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    for (FeedEntryModel entryModel : entryModels) {
      SyndEntry entry = new SyndEntryImpl();
      entry.setTitle(entryModel.title);
      entry.setAuthor(entryModel.author);
      entry.setLink(entryModel.link);
      entry.setPublishedDate(entryModel.published);

      if (entryModel.tags != null && entryModel.tags.size() > 0) {
        List<SyndCategory> tags = new ArrayList<SyndCategory>();
        for (String tag : entryModel.tags) {
          SyndCategoryImpl cat = new SyndCategoryImpl();
          cat.setName(tag);
          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);
    }
    feed.setEntries(entries);
View Full Code Here

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

      throw new GitBlitException(f);
    }
    is.close();
    List<FeedEntryModel> entries = new ArrayList<FeedEntryModel>();
    for (Object o : feed.getEntries()) {
      SyndEntryImpl entry = (SyndEntryImpl) o;
      FeedEntryModel model = new FeedEntryModel();
      model.repository = repository;
      model.branch = branch;
      model.title = entry.getTitle();
      model.author = entry.getAuthor();
      model.published = entry.getPublishedDate();
      model.link = entry.getLink();
      model.content = entry.getDescription().getValue();
      model.contentType = entry.getDescription().getType();
      if (entry.getCategories() != null && entry.getCategories().size() > 0) {
        List<String> tags = new ArrayList<String>();
        for (Object p : entry.getCategories()) {
          SyndCategory cat = (SyndCategory) p;
          tags.add(cat.getName());
        }
        model.tags = tags;
      }
View Full Code Here

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

                    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

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

    }
   
    String entryDateWithLoggerName = logEntryLines.remove(0),
      entryLevelWithCustomPrefix = logEntryLines.remove(0);
   
    SyndEntry entry = new SyndEntryImpl();
    SyndContent  description = new SyndContentImpl();
   
    try {
      entry.setPublishedDate(parseLogEntryDate(entryDateWithLoggerName));
      entry.setTitle(parseLogEntryTitle(entryLevelWithCustomPrefix));   
     
      logEntryLines.add(0, parseLogMessage(entryLevelWithCustomPrefix));
     
          description.setType(ENTRY_FORMAT);
          description.setValue(StringUtils.join(logEntryLines, '\n'));
         
          entry.setDescription(description);
         
          entries.add(entry);         
    } catch (ParseException e) {
      logger.warning("Unable to parse existing log entry, invalid date format: " + formattedLogEntry);
    }
View Full Code Here

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

        feed.setLanguage("en-us");
        feed.setEncoding("utf-8");
        feed.setCopyright(new Date().toString());

        ArrayList entries = new ArrayList();
        SyndEntryImpl entry = new SyndEntryImpl();
        entry.setPublishedDate(new Date());
        entry.setAuthor("Bob Newhart");
        entry.setLink("http://bobnewhart.com");
        entries.add(entry);

        SyndContentImpl description = new SyndContentImpl();
        description.setType("text/html");
        description.setValue("Remember Those Famous People On the Phone Skits?");
        entry.setDescription(description);

        ArrayList contents = new ArrayList();
        SyndContentImpl content = new SyndContentImpl();
        content.setType("text/xhtml");
        content.setValue("<div><str>Larry, Darrel, and Darrel</str><br/>Where are they now?</div>");
        contents.add(content);
        SyndContentImpl content2 = new SyndContentImpl();
        content2.setType("text/html");
        content2.setValue("<b>News</b><p> Bob wasn't funny on " + new Date());
        contents.add(content2);
        entry.setContents(contents);

        feed.setEntries(entries);

        return feed;
    }
View Full Code Here

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

        }
        return syndEntries;
    }

    protected SyndEntry createSyndEntry(Feed feed, Entry entry) {
        SyndEntry syndEntry = new SyndEntryImpl();
        syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));

        syndEntry.setTitle(entry.getTitle());

        String id = entry.getId();
        if (id!=null) {
            syndEntry.setUri(entry.getId());
        }
        else {
            syndEntry.setUri(syndEntry.getLink());
        }

        List contents = entry.getContents();
        if (contents != null && contents.size() > 0) {
            List sContents = new ArrayList();
            for (Iterator iter=contents.iterator(); iter.hasNext();) {
                Content content = (Content)iter.next();
                sContents.add(createSyndContent(content));
            }
            syndEntry.setContents(sContents);
        }

        Content summary = entry.getSummary();
        if (summary!=null) {
            syndEntry.setDescription(createSyndContent(entry.getSummary()));
        }

        List authors = entry.getAuthors();
        if (authors!=null && authors.size() > 0) {
            syndEntry.setAuthors(ConverterForAtom03.createSyndPersons(authors));
        }

        Date date = entry.getPublished();
        if (date!=null) {
            syndEntry.setPublishedDate(date);
        }

        date = entry.getUpdated();
        if (date!=null) {
            syndEntry.setUpdatedDate(date);
        }
       
        List categories = entry.getCategories();
        if (categories!=null) {
            List syndCategories = new ArrayList();
            for (Iterator iter=categories.iterator(); iter.hasNext();) {
                Category c = (Category)iter.next();
                SyndCategory syndCategory = new SyndCategoryImpl();
                syndCategory.setName(c.getTerm());
                syndCategory.setTaxonomyUri(c.getScheme());
                // TODO: categories MAY have labels
                //       syndCategory.setLabel(c.getLabel());
                syndCategories.add(syndCategory);
            }
            syndEntry.setCategories(syndCategories);
        }
               
        // if there is exactly one alternate link, use that as THE link
        if (entry.getAlternateLinks() != null
                && entry.getAlternateLinks().size() == 1) {
            Link theLink = (Link)entry.getAlternateLinks().get(0);
            syndEntry.setLink(theLink.getHref());
        }

        // lump alternate and other links together
        List syndLinks = new ArrayList();
        if (entry.getAlternateLinks() != null
                && entry.getAlternateLinks().size() > 0) {
            syndLinks.add(createSyndLinks(entry.getAlternateLinks()));
        }
        if (entry.getOtherLinks() != null
                && entry.getOtherLinks().size() > 0) {
            syndLinks.add(createSyndLinks(entry.getOtherLinks()));
        }
        syndEntry.setLinks(syndLinks);

        return syndEntry;
    }
View Full Code Here

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

        }
        return syndEntries;
    }

    protected SyndEntry createSyndEntry(Entry entry) {
        SyndEntry syndEntry = new SyndEntryImpl();
        syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));

        syndEntry.setTitle(entry.getTitle());

        String linkHref = null;
        if (entry.getAlternateLinks().size() > 0) {
            linkHref = ((Link) entry.getAlternateLinks().get(0)).getHref();
        }
        syndEntry.setLink(linkHref);


        String id = entry.getId();
        if (id!=null) {
            syndEntry.setUri(entry.getId());
        }
        else {
            syndEntry.setUri(syndEntry.getLink());
        }

        Content content = entry.getSummary();
        if (content==null) {
            List contents = entry.getContents();
            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);
        }

        List authors = entry.getAuthors();
        if (authors!=null && authors.size() > 0) {
            syndEntry.setAuthors(createSyndPersons(authors));
        }

        Date date = entry.getModified();
        if (date==null) {
            date = entry.getIssued();
            if (date==null) {
                date = entry.getCreated();
            }
        }
        if (date!=null) {
            syndEntry.setPublishedDate(date);
        }

        return syndEntry;
    }
View Full Code Here

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

        feed.setLanguage("en-us");
        feed.setEncoding("utf-8");
        feed.setCopyright(new Date().toString());

        ArrayList entries = new ArrayList();
        SyndEntryImpl entry = new SyndEntryImpl();
        entry.setPublishedDate(new Date());
        entry.setAuthor("Marcus Aqueductum");
        entry.setLink("http://wiki.java.net/bin/view/Javawsxml/RomeAqueduct");
        entries.add(entry);

        ArrayList contents = new ArrayList();
        SyndContentImpl content = new SyndContentImpl();
        content.setType("text/xhtml");
        content.setValue("<div><b>Aqueduct + Prevayler</b><br/>Fast and furious.</div>");
        contents.add(content);
        SyndContentImpl content2 = new SyndContentImpl();
        content2.setType("text/html");
        content2.setValue("<b>Really fast to implement.");
        contents.add(content2);
        entry.setContents(contents);

        feed.setEntries(entries);

        return feed;
    }
View Full Code Here

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

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

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

    image.setLink(hostUrl);
    feed.setImage(image);

    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    for (FeedEntryModel entryModel : entryModels) {
      SyndEntry entry = new SyndEntryImpl();
      entry.setTitle(entryModel.title);
      entry.setAuthor(entryModel.author);
      entry.setLink(entryModel.link);
      entry.setPublishedDate(entryModel.published);

      if (entryModel.tags != null && entryModel.tags.size() > 0) {
        List<SyndCategory> tags = new ArrayList<SyndCategory>();
        for (String tag : entryModel.tags) {
          SyndCategoryImpl cat = new SyndCategoryImpl();
          cat.setName(tag);
          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);
    }
    feed.setEntries(entries);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.