/** * Utility method for obtaining a string representation of the browse. This is useful only for * debug */ public String toString() { try { StringBuffer sb = new StringBuffer(); // calculate the range for display String from = Integer.toString(overallPosition + 1); String to = Integer.toString(overallPosition + results.size()); String of = Integer.toString(total); // report on the positional information of the browse sb.append("BrowseInfo String Representation: "); sb.append("Browsing " + from + " to " + to + " of " + of + " "); // insert the information about which index sb.append( "in index: " + browseIndex.getName() + " (data type: " + browseIndex.getDataType() + ", display type: " + browseIndex.getDisplayType() + ") "); sb.append("||"); // report on the browse scope container String container = "all of DSpace"; DSpaceObject theContainer = null; if (inCollection()) { container = "collection"; theContainer = this.collection; } else if (inCommunity()) { container = "community"; theContainer = this.community; } String containerID = "no id available/necessary"; if (theContainer != null) { containerID = Integer.toString(theContainer.getID()) + " (" + theContainer.getHandle() + ")"; } sb.append("Browsing in " + container + ": " + containerID); sb.append("||"); // load the item list display configuration ItemListConfig config = new ItemListConfig(); // some information about the columns to be displayed if (browseIndex.isItemIndex()) { sb.append("Listing over " + Integer.toString(config.numCols()) + " columns: "); for (int k = 1; k <= config.numCols(); k++) { if (k > 1) { sb.append(","); } String[] meta = config.getMetadata(k); sb.append(meta[0] + "." + meta[1] + "." + meta[2]); } if (value != null) { sb.append(" on value: ").append(value); } if (isStartsWith()) { sb.append(" sort column starting with: ").append(focus); } else if (hasFocus()) { sb.append(" sort column focus: ").append(focus); } } else if (browseIndex.isMetadataIndex()) { sb.append("Listing single column: ").append(browseIndex.getMetadata()); if (isStartsWith()) { sb.append(" sort column starting with: ").append(focus); } else if (hasFocus()) { sb.append(" sort column focus: ").append(focus); } } sb.append("||"); // some information about how the data is sorted String direction = (ascending ? "ASC" : "DESC"); sb.append( "Sorting by: " + sortOption.getMetadata() + " " + direction + " (option " + Integer.toString(sortOption.getNumber()) + ")"); sb.append("||"); // output the results if (browseIndex.isMetadataIndex() && !isSecondLevel()) { sb.append(valueListingString()); } else if (browseIndex.isItemIndex() || isSecondLevel()) { sb.append(fullListingString(config)); } sb.append("||"); // tell us what the next and previous values are going to be sb.append("Top of next page: "); if (hasNextPage()) { sb.append("offset: ").append(Integer.toString(this.nextOffset)); } else { sb.append("n/a"); } sb.append(";"); sb.append("Top of previous page: "); if (hasPrevPage()) { sb.append("offset: ").append(Integer.toString(this.prevOffset)); } else { sb.append("n/a"); } sb.append("||"); return sb.toString(); } catch (SQLException e) { return e.getMessage(); } catch (BrowseException e) { return e.getMessage(); } }