Package org.dspace.app.util
Class CollectionDropDown
- java.lang.Object
-
- org.dspace.app.util.CollectionDropDown
-
public class CollectionDropDown extends Object
Utility class for lists of collections.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCollectionDropDown.CollectionPathEntryA helper class to hold (collection, full path) pairs.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CollectionDropDown.CollectionPathEntry[]annotateWithPaths(Context context, List<Collection> collections)Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class).static StringcollectionPath(Context context, Collection col)Get full path starting from a top-level community via subcommunities down to a collection.static StringcollectionPath(Context context, Collection col, int maxchars)Get full path starting from a top-level community via subcommunities down to a collection.
-
-
-
Method Detail
-
collectionPath
public static String collectionPath(Context context, Collection col) throws SQLException
Get full path starting from a top-level community via subcommunities down to a collection. The full path will not be truncated.- Parameters:
context- The relevant DSpace Context.col- Get full path for this collection- Returns:
- Full path to the collection
- Throws:
SQLException- if database error
-
collectionPath
public static String collectionPath(Context context, Collection col, int maxchars) throws SQLException
Get full path starting from a top-level community via subcommunities down to a collection. The full cat will be truncated to the specified number of characters and prepended with an ellipsis.- Parameters:
context- The relevant DSpace Context.col- Get full path for this collectionmaxchars- Truncate the full path to maxchar characters. 0 means do not truncate.- Returns:
- Full path to the collection (truncated)
- Throws:
SQLException- if database error
-
annotateWithPaths
public static CollectionDropDown.CollectionPathEntry[] annotateWithPaths(Context context, List<Collection> collections) throws SQLException
Annotates an array of collections with their respective full paths (@see #collectionPath() method in this class).- Parameters:
context- The relevant DSpace Context.collections- An array of collections to annotate with their hierarchical paths. The array and all its entries must be non-null.- Returns:
- A sorted array of collection path entries (essentially collection/path pairs).
- Throws:
SQLException- In case there are problems annotating a collection with its path.
-
-