Home

 

Filtering lists returned by commands

Use the FilesListService commands to filter lists of maps returned by browse commands.

Browse commands, such as FilesLibraryService.browsePersonal and FilesPolicyService.browse, 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 FilesLibraryService.browsePersonal command returns a list of personal 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.

  1. Open a command window and start the wsadmin command line tool as described in the topic, Starting the wsadmin client.

  2. Start the Files script with the following command:

  3. Network deployment:

      execfile("profile_root/config/bin_lc_admin/ filesAdmin.py")
      

  4. Run the following commands to filter a list of library maps:


    FilesListService administrative commands

    Command Description

    FilesListService.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 FilesLibraryService.browsePersonal and FilesPolicyService.browse.

    A map is a list of key/value pairs, for example the FilesLibraryService.browsePersonal command returns a list of personal 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

      FilesLibraryService.browsePersonal(<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.

    FilesListService.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 FilesLibraryService.browsePersonal and FilesPolicyService.browse.

    A map is a list of key/value pairs, for example the FilesLibraryService.browsePersonal command returns a list of personal 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

      FilesLibraryService.browsePersonal(<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.

    FilesListService.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 FilesLibraryService.browsePersonal and FilesPolicyService.browse.

    A map is a list of key/value pairs, for example the FilesLibraryService.browsePersonal command returns a list of personal 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

      FilesLibraryService.browsePersonal(<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.


Administer Files

 

Related tasks

Start the wsadmin client


+

Search Tips   |   Advanced Search