Filtering community lists
Use the CommunitiesListService commands to filter the information in community lists and to generate smaller lists containing more specific information.
To filter community lists.
- Start the Communities Jython script interpreter
cd app_server_root/profiles/Dmgr01/bin
./wsadmin.sh -lang jython
execfile("communitiesAdmin.py")
- Filter the information in community lists and generate new lists.
The commands can also be used on application lists.
- CommunitiesListService.filterListByApp(List list, String filter)
- Return a new list containing only the communities where the application type matches the regular expression filter. Examples of applications include IBM Lotus Quickrâ„¢ Wiki, and Lotus Quickr Teamspace.
Depending on how the list is returned, we can filter an application from:
- A specific community, using CommunitiesService.fetchCommByName.
- The communities a specific user is a member or owner of, when using CommunitiesService.fetchCommByMember.
The following example gets a list of all the communities the specified user is a member or owner of. The filter command then filters that list by the application name specified. A list of communities associated with the specified application is returned.
wsadmin>bymember=CommunitiesService.fetchCommByMember("users_email_address") wsadmin>CommunitiesListService.filterListByApp(links,"application_name")
- CommunitiesListService.filterListByName(List list, String filter)
- Return a new list containing only the communities and subcommunities whose names match the regular expression filter.
For example:
wsadmin>allComm=CommunitiesService.fetchAllComm() wsadmin>CommunitiesListService.filterListByName(allComm,"My Community Name")This example returns a list of all communities and subcommunities using the fetchAllComm command (command is set to a variable that will be used in the next command) and then filters the results to get the information for a particular community or subcommunity.
- CommunitiesListService.filterListByType(List list, String filter)
- Return a new list containing only the communities and subcommunities whose type (private, public, or publicInviteOnly) matches the regular expression filter.
For example:
wsadmin>commByMember=CommunitiesService.fetchCommByMember("jane_smith@company.com") wsadmin>CommunitiesListService.filterListByType(commByMember,"publicInviteOnly")This example retrieves a list of all the communities and subcommunities for a particular user (in this case Jane Smith) and then filters that list to display all the user's communities and subcommunities that are publicInviteOnly. The fetch command is set to a variable that will be used in the listService command.
- CommunitiesListService.filterListById(List list, String filter)
- Return a new list containing only the communities and subcommunities whose ID matches the regular expression filter.
For example:
wwsadmin>all=CommunitiesService.fetchAllComm() wsadmin>CommunitiesListService.filterListById(all, "c6a2c680-5933-4efa-9a14-be1723445d30")This example returns a list of all the communities and subcommunities and then filters the results by ID to list only the communities and subcommunities where the ID matches the one specified.
Parent topic:
Administer Communities