/** * Does this connection have a previous page of data? * * @return {@code true} if there is a previous page of data for this * connection, {@code false} otherwise. */ public boolean hasPrevious() { return !isBlank(getPreviousPageUrl()); }
/** * Does this connection have a previous page of data? * * @return {@code true} if there is a previous page of data for this connection, {@code false} otherwise. */ public boolean hasPrevious() { return !isBlank(getPreviousPageUrl()) && !isSameCursor(); }
/** * @see com.restfb.FacebookClient#fetchConnection(java.lang.String, java.lang.Class, com.restfb.Parameter[]) */ @Override public <T> Connection<T> fetchConnection(String connection, Class<T> connectionType, Parameter... parameters) { verifyParameterPresence("connection", connection); verifyParameterPresence("connectionType", connectionType); Connection<T> conn = new Connection<>(this, makeRequest(connection, parameters), connectionType); if (conn.getNextPageUrl() == null && conn.getAfterCursor() != null) { String fullUrl = createEndpointForApiCall(connection, false); String paramString = toParameterString(parameters); fullUrl = UrlUtils.replaceOrAddQueryParameter(fullUrl + "?" + paramString, "after", conn.getAfterCursor()); conn.setNextPageUrl(fullUrl); } if (conn.getPreviousPageUrl() == null && conn.getBeforeCursor() != null) { String fullUrl = createEndpointForApiCall(connection, false); String paramString = toParameterString(parameters); fullUrl = UrlUtils.replaceOrAddQueryParameter(fullUrl + "?" + paramString, "before", conn.getBeforeCursor()); conn.setPreviousPageUrl(fullUrl); } return conn; }
if (conn.getPreviousPageUrl() == null && conn.getBeforeCursor() != null) { String fullUrl = UrlUtils.removeQueryParameter(connectionPageUrl, "after"); fullUrl = UrlUtils.replaceOrAddQueryParameter(fullUrl, "before", conn.getBeforeCursor());