Package com.sun.syndication.feed.atom

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


    OpenSearchModule osm = new OpenSearchModuleImpl();
    osm.setItemsPerPage(itemsPerPage);
    osm.setStartIndex(startIdx);
    osm.setTotalResults(totalResult);
    if(searchDescriptionUrl != null){
      Link link = new Link();
      link.setHref(searchDescriptionUrl);
      link.setType("application/opensearchdescription+xml");
      osm.setLink(link);
    }
    mods.add(osm);
    feed.setModules(mods);
    return feed;
View Full Code Here


    public Entry post(Entry entry) {
        System.out.println("post" + entry);
        String id = "cart-" + UUID.randomUUID().toString();
        entry.setId(id);

        Link link = new Link();
        link.setRel("edit");
        link.setHref(id);
        entry.getOtherLinks().add(link);
        link = new Link();
        link.setRel("alternate");
        link.setHref(id);
        entry.getAlternateLinks().add(link);

        entry.setCreated(new Date());

        cart.put(id, entry);
View Full Code Here

    public Entry post(Entry entry) {
        System.out.println("post" + entry);
        String id = "cart-" + UUID.randomUUID().toString();
        entry.setId(id);

        Link link = new Link();
        link.setRel("edit");
        link.setHref(id);
        entry.getOtherLinks().add(link);
        link = new Link();
        link.setRel("alternate");
        link.setHref(id);
        entry.getAlternateLinks().add(link);

        entry.setCreated(new Date());

        cart.put(id, entry);
View Full Code Here

            content.setValue("Jane Doe_" + String.valueOf(i));
            content.setType(Content.TEXT);
            entry.setContents(Collections.singletonList(content));

            List<Link> links = new ArrayList<Link>();
            Link link = new Link();
            link.setRel("edit");
            link.setHref("" + id);
            links.add(link);
            entry.setOtherLinks(links);

            links = new ArrayList<Link>();
            link = new Link();
            link.setRel("alternate");
            link.setHref("" + id);
            links.add(link);
            entry.setAlternateLinks(links);

            entry.setCreated(new Date());
View Full Code Here

        String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
        entry.setId(id);

        List<Link> links = new ArrayList<Link>();
        Link link = new Link();
        link.setRel("edit");
        link.setHref("" + id);
        links.add(link);
        entry.setOtherLinks(links);

        links = new ArrayList<Link>();
        link = new Link();
        link.setRel("alternate");
        link.setHref("" + id);
        links.add(link);
        entry.setAlternateLinks(links);

        entry.setCreated(new Date());
View Full Code Here

   
            String href = item.getLink();
            if (href == null) {
                href = key.toString();
            }
            Link link = new Link();
            link.setRel("edit");
            link.setHref(href);
            feedEntry.getOtherLinks().add(link);
            link = new Link();
            link.setRel("alternate");
            link.setHref(href);
            feedEntry.getAlternateLinks().add(link);
   
            Date date = item.getDate();
            if (date == null) {
                date = new Date();
            }
            feedEntry.setCreated(date);
            return feedEntry;
           
        } else if (data != null) {
            Entry feedEntry = new Entry();
            feedEntry.setId(key.toString());
            feedEntry.setTitle("item");
   
            // Convert the item to XML
            String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
           
            Content content = new Content();
            content.setType("text/xml");
            content.setValue(value);
            List<Content> contents = new ArrayList<Content>();
            contents.add(content);
            feedEntry.setContents(contents);
   
            Link link = new Link();
            link.setRel("edit");
            link.setHref(key.toString());
            feedEntry.getOtherLinks().add(link);
            link = new Link();
            link.setRel("alternate");
            link.setHref(key.toString());
            feedEntry.getAlternateLinks().add(link);
   
            feedEntry.setCreated(new Date());
            return feedEntry;
        } else {
View Full Code Here

                    String value = content.getValue();
                    item.setContents(value);
                }
               
                for (Object l : feedEntry.getOtherLinks()) {
                    Link link = (Link)l;
                    if (link.getRel() == null || "edit".equals(link.getRel())) {
                        String href = link.getHref();
                        if (href.startsWith("null/")) {
                            href = href.substring(5);
                        }
                        item.setLink(href);
                        break;
View Full Code Here

            // A new entry was created successfully
            if (createdFeedEntry != null) {

                // Set location of the created entry in the Location header
                for (Object l : createdFeedEntry.getOtherLinks()) {
                    Link link = (Link)l;
                    if (link.getRel() == null || "edit".equals(link.getRel())) {
                        response.addHeader("Location", link.getHref());
                        break;
                    }
                }

                // Write the created Atom entry
View Full Code Here

    return links;
  }

  private static void buildStaticLink(FedoraURI fedoraURI, List<Link> links) {
    if(fedoraURI.getDsid() != null){
      Link link = new Link();
      URI staticUri = StaticURI.toStaticHttpUri(fedoraURI);
      link.setRel("enclosure");
      link.setHref(staticUri.toString());
      links.add(link);
    }
  }
View Full Code Here

      links.add(link);
    }
  }

  private static void buildNativeLink(FedoraURI fedoraURI, List<Link> links) {
    Link link = new Link();
    if (fedoraURI.getSerialNumber() == null) {
      link.setRel("enclosure");
      link.setHref("./" + fedoraURI.getDsid().toLowerCase());
    } else {
      link.setHref("./" + fedoraURI.getDsid().toLowerCase() + "/"
          + fedoraURI.getSerialNumber());
    }
    link.setType(ConverterManager.getMimeType(fedoraURI.getDsid()));
    links.add(link);
  }
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.