Package com.sun.syndication.feed.atom

Examples of com.sun.syndication.feed.atom.Link


        SyndEntry syndEntry = new SyndEntryImpl();
        syndEntry.setModules(ModuleUtils.cloneModules(entry.getModules()));

        syndEntry.setTitle(entry.getTitle());

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

        String id = entry.getId();
        if (id!=null) {
            syndEntry.setUri(entry.getId());
        }
View Full Code Here


        aFeed.setTitle(syndFeed.getTitle());

        String sLink = syndFeed.getLink();
        if (sLink!=null) {
            Link link = new Link();
            link.setRel(Link.ALTERNATE);
            link.setHref(sLink);
            List list = new ArrayList();
            list.add(link);
            aFeed.setAlternateLinks(list);
        }
View Full Code Here

        aEntry.setTitle(sEntry.getTitle());

        String sLink = sEntry.getLink();
        if (sLink!=null) {
            Link link = new Link();
            link.setRel(Link.ALTERNATE);
            link.setHref(sLink);
            List list = new ArrayList();
            list.add(link);
            aEntry.setAlternateLinks(list);
        }
View Full Code Here

        return feed;
    }

    private Link parseLink(Feed feedbaseURI , Entry entry, URL baseURI, Element eLink) {
        Link link = new Link();
        String att = eLink.getAttributeValue("rel");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            link.setRel(att);
        }
        att = eLink.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            link.setType(att);
        }
        att = eLink.getAttributeValue("href");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            if(ROME.isRelativeURI(att))
            {
                // TODO: @FID37 Improper relative link resolution in Atom10Parser
                ROME.failed(Failure.ROME37);
            }
            link.setHref(resolveURI(baseURI, eLink, att));
        }
       
        // TODO: @FID38 ATOM 1.0 Entry links parsing
        if(ROME.hasAtomLinkTitle(eLink))
            ROME.failed(Failure.ROME38);
       
        att = eLink.getAttributeValue("hreflang");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            link.setHreflang(att);
        }
        att = eLink.getAttributeValue("length");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (att!=null) {
            link.setLength(Long.parseLong(att));
        }
        return link;
    }
View Full Code Here

    // List(Elements) -> List(Link)
    private List parseAlternateLinks(Feed feed, Entry entry, URL baseURI, List eLinks) {
        List links = new ArrayList();
        for (int i=0;i<eLinks.size();i++) {
            Element eLink = (Element) eLinks.get(i);
            Link link = parseLink(feed, entry, baseURI, eLink);
            if (link.getRel() == null
                    || "".equals(link.getRel().trim())
                    || "alternate".equals(link.getRel())) {
                links.add(link);
            }
        }
        return (links.size()>0) ? links : null;
    }
View Full Code Here

    private List parseOtherLinks(Feed feed, Entry entry, URL baseURI, List eLinks) {
        List links = new ArrayList();
        for (int i=0;i<eLinks.size();i++) {
            Element eLink = (Element) eLinks.get(i);
            Link link = parseLink(feed, entry, baseURI, eLink);
            if (!"alternate".equals(link.getRel())) {
                links.add(link);
            }
        }
        return (links.size()>0) ? links : null;
    }
View Full Code Here

    }
    return feed;
  }

  private Link parseLink(Element eLink) {
    Link link = new Link();
    String att = getAttributeValue(eLink, "rel");
    if (att != null) {
      link.setRel(att);
    }
    att = getAttributeValue(eLink, "type");
    if (att != null) {
      link.setType(att);
    }
    att = getAttributeValue(eLink, "href");
    if (att != null) {
      link.setHref(att);
    }
    return link;
  }
View Full Code Here

       
        return null;       
    }
   
    static void addLink(Entry e, String rel, URI uri) {
        Link l = new Link();
        l.setRel(rel);
        l.setHref(uri.toString());
        e.getOtherLinks().add(l);
    }   
View Full Code Here

    }   
   
    static String getLink(Entry e, String rel) {
        List links = e.getOtherLinks();
       
        Link l = null;
        for (Object o : links) {
            l = (Link)o;
            if (l.getRel().equals(rel)) {
                return l.getHref();
            }
        }
        return null;
    }   
View Full Code Here

    }   
   
    static void updateLink(Entry e, String rel, URI uri) {
        List links = e.getOtherLinks();
       
        Link l = null;
        for (Object o : links) {
            l = (Link)o;
            if (l.getRel().equals(rel)) {
                links.remove(l);
                break;
            }
        }
       
        l = new Link();
        l.setRel(rel);
        l.setHref(uri.toString());
        links.add(l);
    }   
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.atom.Link

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.