/** * Return true if the feed contains any next, previous, first or last paging link relations * * @param feed The feed to check */ public static boolean isPaged(Source feed) { return feed.getLink("next") != null || feed.getLink("previous") != null || feed.getLink("first") != null || feed.getLink("last") != null; }
/** * Returns the IRI of the prev-archive link relation */ public static IRI getPreviousArchive(Source feed) { Link link = feed.getLink("prev-archive"); if (link == null) { // try the full IANA URI version link = feed.getLink(Link.IANA_BASE + "prev-archive"); } return (link != null) ? link.getResolvedHref() : null; }
/** * Returns the IRI of the next-archive link relation */ public static IRI getNextArchive(Source feed) { Link link = feed.getLink("next-archive"); if (link == null) { // try the full IANA URI version link = feed.getLink(Link.IANA_BASE + "next-archive"); } return (link != null) ? link.getResolvedHref() : null; }
/** * Returns the IRI of the last link relation */ public static IRI getLast(Source feed) { Link link = feed.getLink("last"); return (link != null) ? link.getResolvedHref() : null; }
/** * Returns the IRI of the previous link relation */ public static IRI getPrevious(Source feed) { Link link = feed.getLink("previous"); return (link != null) ? link.getResolvedHref() : null; }
/** * Returns the IRI of the next link relation */ public static IRI getNext(Source feed) { Link link = feed.getLink("next"); return (link != null) ? link.getResolvedHref() : null; }
/** * Returns the IRI of the first link relation */ public static IRI getFirst(Source feed) { Link link = feed.getLink("first"); return (link != null) ? link.getResolvedHref() : null; }
/** * Adds a next-archive link relation to the feed * * @param feed The feed * @param iri The IRI of the next archive feed document * @return The newly created Link */ public static Link setNextArchive(Source feed, String iri) { Link link = feed.getLink("next-archive"); if (link == null) { // try the full IANA URI version link = feed.getLink(Link.IANA_BASE + "next-archive"); } if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "next-archive"); } return link; }
/** * Adds a prev-archive link relation to the feed * * @param feed The feed * @param iri The IRI of the previous archive feed document * @return The newly created Link */ public static Link setPreviousArchive(Source feed, String iri) { Link link = feed.getLink("prev-archive"); if (link == null) { // try the full IANA URI version link = feed.getLink(Link.IANA_BASE + "prev-archive"); } if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "prev-archive"); } return link; }
/** * Adds a current link relation to the feed * * @param feed The feed * @param iri The IRI of the current feed document * @return The newly created Link */ public static Link setCurrent(Source feed, String iri) { Link link = feed.getLink("current"); if (link == null) { // try the full IANA URI version link = feed.getLink(Link.IANA_BASE + "current"); } if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "current"); } return link; }
/** * Adds a last link relation to the feed * * @param feed The feed * @param iri The IRI of the last feed document * @return The newly created Link */ public static Link setLast(Source feed, String iri) { Link link = feed.getLink("last"); if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "last"); } return link; }
/** * Adds a next link relation to the feed * * @param feed The feed * @param iri The IRI of the next feed document * @return The newly created Link */ public static Link setNext(Source feed, String iri) { Link link = feed.getLink("next"); if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "next"); } return link; }
/** * Adds a previous link relation to the feed * * @param feed The feed * @param iri The IRI of the previous feed document * @return The newly created Link */ public static Link setPrevious(Source feed, String iri) { Link link = feed.getLink("previous"); if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "previous"); } return link; }
/** * Adds a first link relation to the feed * * @param feed The feed * @param iri The IRI of the first feed document * @return The newly created Link */ public static Link setFirst(Source feed, String iri) { Link link = feed.getLink("first"); if (link != null) { link.setHref(iri); } else { link = feed.addLink(iri, "first"); } return link; }