/** * @return true if ascending, false if not - or not set */ public boolean isAscending() { if (SortOption.ASCENDING.equalsIgnoreCase(order)) { return true; } if (SortOption.DESCENDING.equalsIgnoreCase(order)) { return false; } BrowseIndex bi = getBrowseIndex(); if (bi != null && SortOption.DESCENDING.equalsIgnoreCase(bi.getDefaultOrder())) { return false; } return true; }
/** * @return Returns the order. */ public String getOrder() { if (order != null) { return order; } BrowseIndex bi = getBrowseIndex(); if (bi != null) { return bi.getDefaultOrder(); } return SortOption.ASCENDING; }
Map<String, String> getCommonParameters() throws UIException { Map<String, String> paramMap = new HashMap<String, String>(); paramMap.put(BrowseParams.TYPE, scope.getBrowseIndex().getName()); if (scope.getFilterValue() != null) { paramMap.put(scope.getAuthorityValue() != null? BrowseParams.FILTER_VALUE[1]:BrowseParams.FILTER_VALUE[0], scope.getFilterValue()); } if (scope.getFilterValueLang() != null) { paramMap.put(BrowseParams.FILTER_VALUE_LANG, scope.getFilterValueLang()); } return paramMap; }
/** * Do the usual DSpace GET method. You will notice that browse does not currently * respond to POST requests. */ protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { // all browse requests currently come to GET. BrowserScope scope = getBrowserScopeForRequest(context, request, response); if (scope.getBrowseIndex() == null) { throw new ServletException("There is no browse index for the request"); } // Is this a request to export the metadata, or a normal browse request? if ("submit_export_metadata".equals(UIUtil.getSubmitButton(request, "submit"))) { exportMetadata(context, request, response, scope); } else { // execute browse request processBrowse(context, scope, request, response); } }
if (scope.getBrowseIndex() == null || scope.getBrowseIndex().isItemIndex())
/** * Perform a standard browse, which will return a BrowseInfo * object that represents the results for the current page, the * total number of results, the range, and information to construct * previous and next links on any web page * * @param bs the scope of the browse * @return the results of the browse * @throws BrowseException if browse error */ public BrowseInfo browse(BrowserScope bs) throws BrowseException { log.debug(LogManager.getHeader(context, "browse", "")); // first, load the browse scope into the object this.scope = bs; // since we use it so much, get the browse index out of the // scope and store as a member browseIndex = scope.getBrowseIndex(); // now make the decision as to how to browse if (browseIndex.isMetadataIndex() && !scope.isSecondLevel()) { // this is a single value browse type that has not gone to // the second level (i.e. authors, not items by a given author) return browseByValue(scope); } else { // this is the full browse type or a browse that has gone to // the second level return browseByItem(scope); } }
/** * Return a normalized focus value. If there is no normalization that can be performed, * return the focus value that is passed in. * * @param value a focus value to normalize * @return the normalized focus value * @throws BrowseException if browse error */ private String normalizeJumpToValue(String value) throws BrowseException { // If the scope has a focus value (focus by value) if (scope.hasJumpToValue()) { // Normalize it based on the specified language as appropriate for this index return OrderFormat.makeSortString(scope.getJumpToValue(), scope.getJumpToValueLang(), scope.getBrowseIndex().getDataType()); } else if (scope.hasStartsWith()) { // Scope has a starts with, so normalize that instead return OrderFormat.makeSortString(scope.getStartsWith(), null, scope.getBrowseIndex().getDataType()); } // No focus value on the scope (ie. focus by id), so just return the passed focus value // This is useful in cases where we have pulled a focus value from the index // which will already be normalized, and avoids another DB lookup return value; }
BrowseIndex bi = scope.getBrowseIndex();
String getKey() { try { String key = ""; key += "-" + scope.getBrowseIndex().getName(); key += "-" + scope.getBrowseLevel(); key += "-" + scope.getStartsWith(); key += "-" + scope.getResultsPerPage(); key += "-" + scope.getSortBy(); key += "-" + scope.getSortOption().getNumber(); key += "-" + scope.getOrder(); key += "-" + scope.getOffset(); key += "-" + scope.getJumpToItem(); key += "-" + scope.getFilterValue(); key += "-" + scope.getFilterValueLang(); key += "-" + scope.getJumpToValue(); key += "-" + scope.getJumpToValueLang(); key += "-" + etAl; return key; } catch (BrowseException e) { return null; // ignore exception and return no key } } };
key += "-" + scope.getBrowseIndex().getName(); key += "-" + scope.getBrowseLevel(); key += "-" + scope.getStartsWith();
browseIndex = scope.getBrowseIndex();
scope.getBrowseIndex().getDataType());