Home
Filtering library lists
Use the WikisListService commands to filter lists of library maps returned by the WikisLibraryService.browseWiki command. You can filter a list of library maps by a certain string value, a certain date value, or a certain number value.
Browse commands, such as WikisLibraryService.browseWiki, return List<Map> java objects. A List<Map> object is a list of Map java objects. Maps are lists of key/value pairs. For example the WikisLibraryService.browseWiki command returns a list of libraries. Each library in the list is a map with a set of keys, and each key is paired with a value. Every library has the same set of keys, but unique values. Values are information about the library, such as its title and creation date.
You filter a list by specifying that it should only return maps that have a specified key with a specified string value, date value, or number value.
- Open a command window and start the wsadmin command line tool as described in the topic, Starting the wsadmin client.
- Start the Wikis script with the following command:
- Stand-alone deployment:
execfile("wikisAdmin.py")
- Network deployment:
execfile("profile_root/config/bin_lc_admin/ wikisAdmin.py")
- Run the following commands to filter a list of library maps:
WikisListService administrative commands
Command Description WikisListService.filterBystring(List listOfMaps, string filterKey, string regexstringCriteria)
Returns items from a specified list that have a specified key matching a specified regular expression. Use this command to filter List<Map> java objects that are returned by any of the browse commands, such as WikisLibraryService.browseWiki.
A map is a list of key/value pairs, for example the WikisLibraryService.browseWiki command returns a list of libraries. Each library in the list is a map with a set of keys, and each key is paired with a value. Every library has the same set of keys, but unique values. Values contain information about the library, such as its title and creation date. Parameters:
- listOfMaps
- A list of maps, for example the result of
WikisLibraryService.browseWiki(<parameters>)- filterKey
- A key in each map in the list, whose value is compared against the filter criteria.
- regexstringCriteria
- A regular expression represented as a string to match against the filterKey value. For example, "[0-9]+" to match only >= 1 numbers in a row.
The command returns maps from the listOfMaps whose filterKey is the regexstringCriteria value.
WikisListService.filterByDate(List listOfMaps, string filterKey, expression)
Returns items from a specified list that have a specified key with a specified date. Use this command to filter List<Map> java objects that are returned by any of the browse commands, such as WikisLibraryService.browseWiki.
A map is a list of key/value pairs, for example the WikisLibraryService.browseWiki command returns a list of libraries. Each library is a map with a set of keys, and each key is paired with a value. Every library has the same set of keys, but unique values. Values contain information about the library, such as its title and creation date. Parameters:
- listOfMaps
- A list of maps, for example the result of
WikisLibraryService.browseWiki(<parameters>)- filterKey
- A key in each map in the list, whose value is compared against the filter criteria.
- expression
- A string of the form <operator> <date> where <date> is in yyyy-MM-dd format and <operator> is one of the following: > >= == <= <
The command returns maps from the listOfMaps value whose filterKey value is the expression value. For example, a filterKey value of creatDate and an expression of <= 2009-01-01 filters the map to only include items created before January 1, 2009.
WikisListService.filterByNumber(List listOfMaps, string filterKey, expression)
Returns items from a specified list that have a specified key with a specified number. Use this command to filter List<Map> java objects that are returned by any of the browse commands, such as WikisLibraryService.browseWiki.
A map is a list of key/value pairs, for example the WikisLibraryService.browseWiki command returns a list of libraries. Each library is a map with a set of keys, and each key is paired with a value. Every library has the same set of keys, but unique values. Values contain information about the library, such as its title and creation date. Parameters:
- listOfMaps
- A list of maps, for example the result of
WikisLibraryService.browseWiki(<parameters>)- filterKey
- A key in each map in the list, whose value is compared against the filter criteria.
- expression
- A string of the form <operator> <int> where <int> is an integer and <operator> is one of the following: > >= == <= <
The command returns maps from the listOfMaps value whose filterKey value is the expression value. For example, a filterKey value of percentUsed and an expression value of ==20 filters the map to only include items whose filterKey value is 20.
Related tasks