Ejemplo n.º 1
0
  private String getPreviousPageURL(Request request) {
    // If our offset should be 0 then we shouldn't be able to view a previous page url
    if (0 == queryArgs.getFacetOffset()) {
      return null;
    }

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
    if (queryArgs.getFacetOffset() != -1) {
      parameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() - DEFAULT_PAGE_SIZE));
    }

    // Add the filter queries
    String url = generateURL("browse-discovery", parameters);
    String[] fqs = getParameterFacetQueries();
    if (fqs != null) {
      StringBuilder urlBuilder = new StringBuilder(url);
      for (String fq : fqs) {
        urlBuilder.append("&fq=").append(fq);
      }

      url = urlBuilder.toString();
    }

    return url;
  }
Ejemplo n.º 2
0
 /**
  * Returns canonical link to a bitstream in the item.
  *
  * @param item The DSpace Item that the bitstream is part of
  * @param bitstream The bitstream to link to
  * @returns a String link to the bitstream
  */
 private String makeBitstreamLink(Item item, Bitstream bitstream) {
   String name = bitstream.getName();
   StringBuilder result = new StringBuilder(contextPath);
   result.append("/bitstream/item/").append(String.valueOf(item.getID()));
   // append name although it isn't strictly necessary
   try {
     if (name != null) {
       result.append("/").append(Util.encodeBitstreamName(name, "UTF-8"));
     }
   } catch (UnsupportedEncodingException uee) {
     // just ignore it, we don't have to have a pretty
     // name on the end of the url because the sequence id will
     // locate it. However it means that links in this file might
     // not work....
   }
   result.append("?sequence=").append(String.valueOf(bitstream.getSequenceID()));
   return result.toString();
 }
Ejemplo n.º 3
0
  private String getNextPageURL(Request request) {
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(FACET_FIELD, request.getParameter(FACET_FIELD));
    if (queryArgs.getFacetOffset() != -1) {
      parameters.put(OFFSET, String.valueOf(queryArgs.getFacetOffset() + DEFAULT_PAGE_SIZE));
    }

    // Add the filter queries
    String url = generateURL("browse-discovery", parameters);
    String[] fqs = getParameterFacetQueries();
    if (fqs != null) {
      StringBuilder urlBuilder = new StringBuilder(url);
      for (String fq : fqs) {
        urlBuilder.append("&fq=").append(fq);
      }

      url = urlBuilder.toString();
    }

    return url;
  }