/** * 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; }
@Override public boolean equals(Object o) { return o != null && o instanceof CollectionPathEntry && this.compareTo((CollectionPathEntry) o) == 0; }