Package com.sun.syndication.feed.synd

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


        }
        return syndEntries;
    }

    protected SyndEntryI createSyndEntry(Entry entry) {
        SyndEntryI syndEntry = new SyndEntry();

        syndEntry.setTitle(entry.getTitle());

        Link link = (Link) entry.getAlternateLinks().get(0);
        syndEntry.setLink(link.getHref());

        Content content = entry.getSummary();
        if (content==null) {
            List contents = entry.getContents();
            if (contents!=null && contents.size()>0) {
                content = (Content) contents.get(0);
            }
        }

        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);
                SyndContentI sContent = new SyndContent();
                sContent.setType(content.getType());
                sContent.setValue(content.getValue());
                sContents.add(sContent);
            }
            syndEntry.setContents(sContents);
        }

        syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));

        // Core Atom author/modified elements have precedence
        // over DC equivalent info.

        Person author = entry.getAuthor();
        if (author!=null && author.getName()!=null) {
            syndEntry.setAuthor(author.getName());
        }

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


        return syndEntry;
    }
View Full Code Here


        }
        return syndEntries;
    }

    protected SyndEntryI createSyndEntry(Item item) {
        SyndEntryI syndEntry = new SyndEntry();
        syndEntry.setTitle(item.getTitle());
        syndEntry.setLink(item.getLink());
        return syndEntry;
    }
View Full Code Here

        syndFeed.setModules(ModuleUtils.cloneModules(channel.getModules()));

    }

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

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

            // contents[0] and description then reference the same content
            //
            List contents = new ArrayList();
            contents.add(content);
            syndEntry.setContents(contents);

        }

        syndEntry.setModules(ModuleUtils.cloneModules(item.getModules()));


        return syndEntry;
    }
View Full Code Here

        super("channel.item[0]");
    }

    protected DCModuleI getDCModule() throws Exception {
        List entryList = getCachedSyndFeed().getEntries();
        SyndEntryI entry = (SyndEntryI) entryList.get(0);
        return (DCModuleI) entry.getModule(DCModuleI.URI);
    }
View Full Code Here

        super("channel");
    }

    protected DCModuleI getDCModule() throws Exception {
        List entryList = getCachedSyndFeed().getEntries();
        SyndEntryI entry = (SyndEntryI) entryList.get(0);
        return (DCModuleI) entry.getModule(DCModuleI.URI);
    }
View Full Code Here

    assertEqualsStr("channel.item[0].title", getEntryTitle(getCachedSyndFeed().getEntries().get(0)));
    assertEqualsStr("channel.item[1].title", getEntryTitle(getCachedSyndFeed().getEntries().get(1)));
  }

  public String getEntryTitle(Object o) throws Exception {
    SyndEntryI e = (SyndEntryI) o;
    return e.getTitle();
  }
View Full Code Here

    assertEqualsStr("channel.item[0].description", getEntryDescription(getCachedSyndFeed().getEntries().get(0)));
    assertEqualsStr("channel.item[1].description", getEntryDescription(getCachedSyndFeed().getEntries().get(1)));
  }

  public String getEntryDescription(Object o) throws Exception {
    SyndEntryI e = (SyndEntryI) o;
    return e.getDescription().getValue();
  }
View Full Code Here

    assertEqualsStr("channel.item[0].link", getEntryLink(getCachedSyndFeed().getEntries().get(0)));
    assertEqualsStr("channel.item[1].link", getEntryLink(getCachedSyndFeed().getEntries().get(1)));
  }

  public String getEntryLink(Object o) {
    SyndEntryI e = (SyndEntryI) o;
    return e.getLink();
  }
View Full Code Here

    assertEquals(DateParser.parseRFC822("Mon, 01 Jan 2001 00:00:00 GMT"), getEntryPublishedDate(getCachedSyndFeed().getEntries().get(0)));
    assertEquals(DateParser.parseRFC822("Mon, 01 Jan 2001 00:00:00 GMT"), getEntryPublishedDate(getCachedSyndFeed().getEntries().get(1)));
  }

  public Date getEntryPublishedDate(Object o) {
    SyndEntryI e = (SyndEntryI) o;
    return e.getPublishedDate();
  }
View Full Code Here

    SyndEntryI e = (SyndEntryI) o;
    return e.getPublishedDate();
  }

  public void testEntryCategories() throws Exception {
    SyndEntryI e = (SyndEntryI)getCachedSyndFeed().getEntries().get(0);
    List catlist = e.getCategories();
    //don't understand why this one fails
    assertEquals(2, catlist.size());
    SyndCategoryI cat = (SyndCategoryI)catlist.get(0);
    assertEqualsStr("channel.item[0].category[0]", cat.getName());
    assertEqualsStr("channel.item[0].category[0]^domain", cat.getTaxonomyUri());
View Full Code Here

TOP

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

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.