Package com.sun.syndication.feed.synd

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


            feedEntry.setUri(key.toString());
            feedEntry.setTitle(item.getTitle());
   
            String value = item.getContents();
            if (value != null) {
                SyndContent content = new SyndContentImpl();
                content.setType("text/xml");
                content.setValue(value);
                List<SyndContent> contents = new ArrayList<SyndContent>();
                contents.add(content);
                feedEntry.setContents(contents);
            }
   
            String href = item.getLink();
            if (href == null) {
                href = key.toString();
            }
            SyndLink link = new SyndLinkImpl();
            link.setRel("edit");
            link.setHref(href);
            feedEntry.getLinks().add(link);
            link = new SyndLinkImpl();
            link.setRel("alternate");
            link.setHref(href);
            feedEntry.getLinks().add(link);
            feedEntry.setLink(href);
   
            Date date = item.getDate();
            if (date == null) {
                date = new Date();
            }
            feedEntry.setPublishedDate(date);
            return feedEntry;
           
        } else if (data != null) {
            SyndEntry feedEntry = new SyndEntryImpl();
            feedEntry.setUri(key.toString());
            feedEntry.setTitle("item");
   
            // Convert the item to XML
            String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
           
            SyndContent content = new SyndContentImpl();
            content.setType("text/xml");
            content.setValue(value);
            List<SyndContent> contents = new ArrayList<SyndContent>();
            contents.add(content);
            feedEntry.setContents(contents);
   
            SyndLink link = new SyndLinkImpl();
View Full Code Here


    Collections.sort(updates, BaseContentItem.REVERSE_COMPARATOR);
   
    SyndFeed feed = new SyndFeedImpl();
    feed.setTitle(livingStory.getTitle());
    feed.setLink(createLspUrl(req));
    SyndContent feedDescription = new SyndContentImpl();
    feedDescription.setType("text/html");
    feedDescription.setValue(StringUtil.stripForExternalSites(livingStory.getSummary()));
    feed.setDescriptionEx(feedDescription);
   
    List<SyndEntry> items = Lists.newArrayList();
    for (BaseContentItem update : updates) {
      SyndContent title = new SyndContentImpl();
      SyndContent content = new SyndContentImpl();
      if (update.getContentItemType() == ContentItemType.EVENT) {
        EventContentItem event = (EventContentItem) update;
        title.setType("text/html");
        title.setValue(event.getEventUpdate());
        content.setType("text/html");
        content.setValue(StringUtil.stripForExternalSites(event.getEventSummary()));
      } else if (update.getContentItemType() == ContentItemType.NARRATIVE) {
        NarrativeContentItem narrative = (NarrativeContentItem) update;
        title.setType("text/html");
        title.setValue(narrative.getHeadline() + "&nbsp;-&nbsp;"
            + narrative.getNarrativeType().toString());
        content.setType("text/html");
        String narrativeSummary = StringUtil.stripForExternalSites(
            narrative.getNarrativeSummary());
        if (GlobalUtil.isContentEmpty(narrativeSummary)) {
          content.setValue(SnippetUtil.createSnippet(
              JavaNodeAdapter.fromHtml(narrative.getContent()), MAXIMUM_SNIPPET_LENGTH));
        } else {
          content.setValue(narrativeSummary);
        }
      }
      SyndEntry entry = new SyndEntryImpl();
      entry.setLink(createContentItemUrl(req, update.getId()));
      entry.setPublishedDate(update.getDateSortKey());
View Full Code Here

      String link = this.createLink(content, feedLink);
      entry.setLink(link);
      entry.setPublishedDate(contentVO.getModify());
      ITextAttribute descrAttr = (ITextAttribute) content.getAttribute(mapping.getDescriptionAttributeName());
      if (null != descrAttr) {
        SyndContent description = new SyndContentImpl();
        description.setType(JpRssSystemConstants.SYNDCONTENT_TYPE_TEXTHTML);
        String inLang = descrAttr.getTextForLang(langCode);
        //TODO Ottimizzare!
        RequestContext requestContext = new RequestContext();
        requestContext.setRequest(req);
        requestContext.setResponse(resp);
        if (null != inLang && inLang.length() >0) {
          String textValue = this.getLinkResolver().resolveLinks(inLang, requestContext);
          if (null != textValue && textValue.trim().length()>0) {
            description.setValue(textValue);
          } else {
            description.setValue(descrAttr.getText());
          }
        } else {
          String textValue =  this.getLinkResolver().resolveLinks(descrAttr.getText(), requestContext);
          description.setValue(textValue);
        }
        entry.setDescription(description);
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "createEntry");
View Full Code Here

                        db.append("\n");
                    }
                }
                if (db.length() > 0)
                {
                    SyndContent desc = new SyndContentImpl();
                    desc.setType("text/plain");
                    desc.setValue(db.toString());
                    entry.setDescription(desc);
                }

                // This gets the authors into an ATOM feed
                Metadatum authors[] = item.getMetadataByMetadataString(authorField);
View Full Code Here

        return entries;
    }

    private static SyndContent getSyndContent( final Release release )
    {
        final SyndContent syndContent = new SyndContentImpl();
        syndContent.setType( "text/html" );

        final StringBuilder sb = new StringBuilder( 512 );

        final String description = release.getDescription();

        if ( description != null && description.trim().length() > 0 )
        {
            sb.append( "<p>" ).append( description ).append( "</p>" );
        }

        // TODO: localize?
        sb.append( "<p>Version " )
            .append( release.getVersion() ).append( " is available with " )
            .append( release.getActions().size() ).append( " fixed issues.</p>" );

        syndContent.setValue( sb.toString() );

        return syndContent;
    }
View Full Code Here

          SyndEntry entry = new SyndEntryImpl();
          entry.setTitle(title);
          entry.setLink(link);
          entry.setPublishedDate(publishedDate);

          SyndContent syndContent = new SyndContentImpl();
          syndContent.setType(descriptionContentType);
          syndContent.setValue(description);
      
          entry.setDescription(syndContent);
         
          entry.setCategories(categories);
View Full Code Here

        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(title);
        entry.setLink(link);
        entry.setPublishedDate(publishedDate);
       
        SyndContent syndContent = new SyndContentImpl();
        syndContent.setType(descriptionContentType);
        syndContent.setValue(description);
       
        entry.setDescription(syndContent);
       
        feed.getEntries().add(entry);
    }
View Full Code Here

   */
  public int doEndTag() throws JspException
    {
      try
      {           
        SyndContent content = new SyndContentImpl();
        if(this.mode != null)
          content.setMode(this.mode);
        if(this.type != null)
          content.setType(this.type);
       
        content.setValue(this.value);
       
        addContent(content);
      }
      catch(Exception e)
      {
View Full Code Here

        for (Article article : articles) {
            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle(article.getTitle());
            entry.setLink("http://localhost:8080/article/" + article.getSlug()); // TODO: Make me configurable
            entry.setPublishedDate(article.getDateCreated());
            SyndContent description = new SyndContentImpl();
            description.setType("text/html");
            description.setValue(article.getText());
            entry.setDescription(description);
            entries.add(entry);
        }

        feed.setEntries(entries);
View Full Code Here

     */
    @Test
    public void getBaseObjectWithContent()
    {
        final SyndEntryImpl entry = context.mock(SyndEntryImpl.class);
        final SyndContentImpl content = context.mock(SyndContentImpl.class);

        final List<SyndContentImpl> myContents = new LinkedList<SyndContentImpl>();
        myContents.add(content);

        context.checking(new Expectations()
View Full Code Here

TOP

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

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.