@Override public void copyFrom(CopyFrom obj) { AtomLinkModule other = (AtomLinkModule) obj; List<Link> links = other.getLinks(); for (Link link : links) { Link l = new Link(); l.setHref(link.getHref()); l.setType(link.getType()); l.setRel(link.getRel()); l.setHreflang(link.getHreflang()); l.setTitle(link.getTitle()); l.setLength(link.getLength()); this.links.add(l); } }
public SyndLink createSyndLink(final Link link) { final SyndLink syndLink = new SyndLinkImpl(); syndLink.setRel(link.getRel()); syndLink.setType(link.getType()); syndLink.setHref(link.getHrefResolved()); syndLink.setHreflang(link.getHreflang()); syndLink.setLength(link.getLength()); syndLink.setTitle(link.getTitle()); return syndLink; }
public Link createAtomLink(final SyndLink syndLink) { final Link link = new Link(); link.setRel(syndLink.getRel()); link.setType(syndLink.getType()); link.setHref(syndLink.getHref()); link.setHreflang(syndLink.getHreflang()); link.setLength(syndLink.getLength()); link.setTitle(syndLink.getTitle()); return link; }
if (altLinks != null) { for (final Link link : altLinks) { if (link.getRel() == null || "alternate".equals(link.getRel())) { altLink = link; break; altLink = new Link(); altLinks.add(altLink); altLink.setRel("alternate"); altLink.setHref(getEntryViewURI(fsid)); if (otherLinks != null) { for (final Link link : otherLinks) { if ("edit".equals(link.getRel())) { editLink = link; break; editLink = new Link(); otherLinks.add(editLink); editLink.setRel("edit"); editLink.setHref(getEntryEditURI(fsid, relativeURIs, singleEntry));
private void updateMediaEntryAppLinks(final Entry entry, final String fileName, final boolean singleEntry) { // TODO: figure out why PNG is missing from Java MIME types final FileTypeMap map = FileTypeMap.getDefaultFileTypeMap(); if (map instanceof MimetypesFileTypeMap) { try { ((MimetypesFileTypeMap) map).addMimeTypes("image/png png PNG"); } catch (final Exception ignored) { } } entry.setId(getEntryMediaViewURI(fileName)); entry.setTitle(fileName); entry.setUpdated(new Date()); final List<Link> otherlinks = new ArrayList<Link>(); entry.setOtherLinks(otherlinks); final Link editlink = new Link(); editlink.setRel("edit"); editlink.setHref(getEntryEditURI(fileName, relativeURIs, singleEntry)); otherlinks.add(editlink); final Link editMedialink = new Link(); editMedialink.setRel("edit-media"); editMedialink.setHref(getEntryMediaEditURI(fileName, relativeURIs, singleEntry)); otherlinks.add(editMedialink); final Content content = entry.getContents().get(0); content.setSrc(getEntryMediaViewURI(fileName)); final List<Content> contents = new ArrayList<Content>(); contents.add(content); entry.setContents(contents); }
private Element generateLink(Link link) { Element linkElement = new Element("link", NS); if (link.getHref() != null) { Attribute href = new Attribute(AtomLinkAttribute.HREF, link.getHref()); linkElement.setAttribute(href); } if (link.getType() != null) { Attribute type = new Attribute(AtomLinkAttribute.TYPE, link.getType()); linkElement.setAttribute(type); } if (link.getRel() != null) { Attribute rel = new Attribute(AtomLinkAttribute.REL, link.getRel()); linkElement.setAttribute(rel); } if (link.getHreflang() != null) { final Attribute hreflangAttribute = new Attribute(AtomLinkAttribute.HREF_LANG, link.getHreflang()); linkElement.setAttribute(hreflangAttribute); } if (link.getTitle() != null) { final Attribute title = new Attribute(AtomLinkAttribute.TITLE, link.getTitle()); linkElement.setAttribute(title); } if (link.getLength() != 0) { final Attribute length = new Attribute(AtomLinkAttribute.LENGTH, Long.toString(link.getLength())); linkElement.setAttribute(length); } return linkElement; }
protected Element generateLinkElement(final Link link) { final Element linkElement = new Element("link", OS_NS); if (link.getRel() != null) { final Attribute relAttribute = new Attribute("rel", "search"); linkElement.setAttribute(relAttribute); } if (link.getType() != null) { final Attribute typeAttribute = new Attribute("type", link.getType()); linkElement.setAttribute(typeAttribute); } if (link.getHref() != null) { final Attribute hrefAttribute = new Attribute("href", link.getHref()); linkElement.setAttribute(hrefAttribute); } if (link.getHreflang() != null) { final Attribute hreflangAttribute = new Attribute("hreflang", link.getHreflang()); linkElement.setAttribute(hreflangAttribute); } return linkElement; }
/** * Get the URI that can be used to edit the entry via HTTP PUT or DELETE. */ public String getEditURI() { for (int i = 0; i < getOtherLinks().size(); i++) { final Link link = getOtherLinks().get(i); if (link.getRel() != null && link.getRel().equals("edit")) { return link.getHrefResolved(); } } return null; }
public SyndLink createSyndLink(final Link link) { final SyndLink syndLink = new SyndLinkImpl(); syndLink.setRel(link.getRel()); syndLink.setType(link.getType()); syndLink.setHref(link.getHrefResolved()); syndLink.setTitle(link.getTitle()); return syndLink; }
protected Element generateLinkElement(final Link link) { final Element linkElement = new Element("link", getFeedNamespace()); final String rel = link.getRel(); if (rel != null) { final Attribute relAttribute = new Attribute("rel", rel); linkElement.setAttribute(relAttribute); } final String type = link.getType(); if (type != null) { final Attribute typeAttribute = new Attribute("type", type); linkElement.setAttribute(typeAttribute); } final String href = link.getHref(); if (href != null) { final Attribute hrefAttribute = new Attribute("href", href); linkElement.setAttribute(hrefAttribute); } return linkElement; }
/** * Set the value of thumbnail * * @param newthumbnail new value of thumbnail */ public void setThumbnail(final Link newthumbnail) { Link old = null; for (final Link l : getOtherLinks()) { if ("thumbnail".equals(l.getRel())) { old = l; break; } } if (old != null) { getOtherLinks().remove(old); newthumbnail.setRel("thumbnail"); } getOtherLinks().add(newthumbnail); }
public SyndEnclosure createSyndEnclosure(final Entry entry, final Link link) { final SyndEnclosure syndEncl = new SyndEnclosureImpl(); syndEncl.setUrl(link.getHrefResolved()); syndEncl.setType(link.getType()); syndEncl.setLength(link.getLength()); return syndEncl; }
public Link findRelatedLink(final String relation) { for (final Link link : otherLinks) { if (relation.equals(link.getRel())) { return link; } } return null; }
private void getNextEntries() throws ProponoException { if (nextURI == null) { return; } final GetMethod colGet = new GetMethod(collection.getHrefResolved(nextURI)); collection.addAuthentication(colGet); try { collection.getHttpClient().executeMethod(colGet); final SAXBuilder builder = new SAXBuilder(); final Document doc = builder.build(colGet.getResponseBodyAsStream()); final WireFeedInput feedInput = new WireFeedInput(); col = (Feed) feedInput.build(doc); } catch (final Exception e) { throw new ProponoException("ERROR: fetching or parsing next entries, HTTP code: " + (colGet != null ? colGet.getStatusCode() : -1), e); } finally { colGet.releaseConnection(); } members = col.getEntries().iterator(); col.getEntries().size(); nextURI = null; final List<Link> altLinks = col.getOtherLinks(); if (altLinks != null) { for (final Link link : altLinks) { if ("next".equals(link.getRel())) { nextURI = link.getHref(); } } } }
/** * Set the value of avatar * * @param newavatar new value of avatar */ public void setAvatar(final Link newavatar) { final Link old = getAvatar(); if (old != null) { getOtherLinks().remove(old); } newavatar.setRel("avatar"); getOtherLinks().add(newavatar); }
feed.setTitle(atomFeed.getTitle()); for (Link link : (List<Link>)atomFeed.getAlternateLinks()) { if ("text/html".equals(link.getType())) feed.setLink(link.getHref()); String href = ""; for (Link link : (List<Link>)entry.getAlternateLinks()) { if ("text/html".equals(link.getType())) href = link.getHref();
if (Lists.isNotEmpty(alternateLinks)) { final Link link = alternateLinks.get(0); syndFeed.setLink(link.getHrefResolved());
public Link createAtomLink(final SyndLink syndLink) { final Link link = new Link(); link.setRel(syndLink.getRel()); link.setType(syndLink.getType()); link.setHref(syndLink.getHref()); link.setHreflang(syndLink.getHreflang()); link.setLength(syndLink.getLength()); link.setTitle(syndLink.getTitle()); return link; }