/** * Get full path starting from a top-level community via subcommunities down to a collection. * The full path will not be truncated. * * @param context The relevant DSpace Context. * @param col Get full path for this collection * @return Full path to the collection * @throws SQLException if database error */ public static String collectionPath(Context context, Collection col) throws SQLException { return CollectionDropDown.collectionPath(context, col, 0); }
/** * Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class). * * @param context The relevant DSpace Context. * @param collections An array of collections to annotate with their hierarchical paths. * The array and all its entries must be non-null. * @return A sorted array of collection path entries (essentially collection/path pairs). * @throws SQLException In case there are problems annotating a collection with its path. */ public static CollectionPathEntry[] annotateWithPaths(Context context, List<Collection> collections) throws SQLException { CollectionPathEntry[] result = new CollectionPathEntry[collections.size()]; for (int i = 0; i < collections.size(); i++) { Collection collection = collections.get(i); CollectionPathEntry entry = new CollectionPathEntry(collection, collectionPath(context, collection)); result[i] = entry; } Arrays.sort(result); return result; }
Collection col = row.getKey(); ret.append(String.format( "\t%s: %s\n", CollectionDropDown.collectionPath(context, col), FileUtils.byteCountToDisplaySize((long) size)));