Package com.rometools.rome.feed.synd

Examples of com.rometools.rome.feed.synd.SyndEntry


      new ClassPathXmlApplicationContext("META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml");
    PollableChannel feedChannel = ac.getBean("feedChannel", PollableChannel.class);
    for (int i = 0; i < 10; i++) {
      Message<SyndEntry> message = (Message<SyndEntry>) feedChannel.receive(1000);
      if (message != null){
        SyndEntry entry = message.getPayload();
        System.out.println(entry.getPublishedDate() + " - " + entry.getTitle());
      }
      else {
        break;
      }
    }
View Full Code Here


    return entry;
  }

  public SyndEntry asRss() {
    SyndEntry entry = new SyndEntryImpl();

    entry.setUri(getGuid());
    entry.setTitle(getTitle());

    SyndContentImpl content = new SyndContentImpl();
    content.setValue(getContent());
    entry.setContents(Arrays.<SyndContent> asList(content));
    entry.setLink(getUrl());
    entry.setPublishedDate(getDate());
    return entry;
  }
View Full Code Here

*/
public class RSS090DescriptionConverter extends ConverterForRSS090 {

  @Override
  protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
    SyndEntry entry = super.createSyndEntry(item, preserveWireItem);
    Description desc = item.getDescription();
    if (desc != null) {
      SyndContentImpl syndDesc = new SyndContentImpl();
      syndDesc.setValue(desc.getValue());
      entry.setDescription(syndDesc);
    }
    return entry;
  }
View Full Code Here

    @Override
    protected void testItem(final int i) throws Exception {
        super.testItem(i);
        final List<SyndEntry> items = this.getCachedSyndFeed().getEntries();
        final SyndEntry entry = items.get(i);
        assertProperty(entry.getDescription().getValue(), "item[" + i + "].description");
        assertProperty(entry.getContents().get(0).getValue(), "item[" + i + "].content");
    }
View Full Code Here

    }

    @Override
    protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

        final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

        // adding native feed author to DC creators list
        final String author = item.getAuthor();
        if (author != null) {
            final List<String> creators = ((DCModule) syndEntry.getModule(DCModule.URI)).getCreators();
            if (!creators.contains(author)) {

                // using a set to remove duplicates
                final Set<String> s = new LinkedHashSet<String>();

                // DC creators
                s.addAll(creators);

                // feed native author
                s.add(author);

                creators.clear();
                creators.addAll(s);
            }
        }

        final Guid guid = item.getGuid();
        final String itemLink = item.getLink();
        if (guid != null) {
            final String guidValue = guid.getValue();
            syndEntry.setUri(guidValue);
            if (itemLink == null && guid.isPermaLink()) {
                syndEntry.setLink(guidValue);
            }
        } else {
            syndEntry.setUri(itemLink);
        }

        if (item.getComments() != null) {
            final SyndLinkImpl comments = new SyndLinkImpl();
            comments.setRel("comments");
View Full Code Here

    // rss.description -> synd.description

    @Override
    protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

        final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

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

        final Content cont = item.getContent();
        if (cont != null) {

            final SyndContent contContent = new SyndContentImpl();
            contContent.setType(cont.getType());
            contContent.setValue(cont.getValue());

            final List<SyndContent> contents = new ArrayList<SyndContent>();
            contents.add(contContent);
            syndEntry.setContents(contents);

        }

        return syndEntry;
View Full Code Here

    }

    @Override
    protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

        final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

        final Date pubDate = item.getPubDate();
        final Date publishedDate = syndEntry.getPublishedDate();
        if (pubDate != null && publishedDate == null) {
            syndEntry.setPublishedDate(pubDate); // c
        }

        return syndEntry;
    }
View Full Code Here

    }

    @Override
    protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

        final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

        final List<Category> cats = item.getCategories();

        if (!cats.isEmpty()) {

            // using a set to remove duplicates and use a LinkedHashSet to try to retain the
            // document order
            final Set<SyndCategory> s = new LinkedHashSet<SyndCategory>();

            // feed native categories (as syndcat)
            s.addAll(createSyndCategories(cats));

            // DC subjects (as syndcat)
            s.addAll(syndEntry.getCategories());

            syndEntry.setCategories(new ArrayList<SyndCategory>(s)); // c
        }

        final List<Enclosure> enclosures = item.getEnclosures();
        if (!enclosures.isEmpty()) {
            syndEntry.setEnclosures(createSyndEnclosures(enclosures));
        }

        return syndEntry;

    }
View Full Code Here

    // rss.content -> synd.content
    // rss.description -> synd.description
    @Override
    protected SyndEntry createSyndEntry(final Item item, final boolean preserveWireItem) {

        final SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);

        final Description desc = item.getDescription();

        syndEntry.setComments(item.getComments());

        if (desc != null) {
            final SyndContent descContent = new SyndContentImpl();
            descContent.setType(desc.getType());
            descContent.setValue(desc.getValue());
            syndEntry.setDescription(descContent);
        }

        final Content cont = item.getContent();

        if (cont != null) {
            final SyndContent content = new SyndContentImpl();
            content.setType(cont.getType());
            content.setValue(cont.getValue());

            final List<SyndContent> syndContents = new ArrayList<SyndContent>();
            syndContents.add(content);
            syndEntry.setContents(syndContents);
        }

        return syndEntry;
    }
View Full Code Here

        testItemDCModule(1);
    }

    protected void testItemDCModule(final int i) throws Exception {
        final List<SyndEntry> entries = this.getCachedSyndFeed().getEntries();
        final SyndEntry entry = entries.get(i);
        final DCModule dc = (DCModule) entry.getModule(DCModule.URI);
        testDCModule(dc, "item[" + i + "].");
    }
View Full Code Here

TOP

Related Classes of com.rometools.rome.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.