Package org.ametys.plugins.core.search
Class UserAndGroupSearchManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.core.search.UserAndGroupSearchManager
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class UserAndGroupSearchManager extends AbstractLogEnabled implements Component, Serviceable
Common helper for user and group searches
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
UserAndGroupSearchManager.DirectorySearchDataResult
private static class
UserAndGroupSearchManager.PopulationSearchDataResult
private static interface
UserAndGroupSearchManager.SearchDataResult
-
Field Summary
Fields Modifier and Type Field Description private static int
_DEFAULT_COUNT_VALUE
private static int
_DEFAULT_OFFSET_VALUE
private GroupDirectoryContextHelper
_directoryContextHelper
private GroupDirectoryDAO
_groupDirectoryDAO
private GroupHelper
_groupHelper
private PopulationContextHelper
_populationContextHelper
private UserHelper
_userHelper
private UserManager
_userManager
private UserPopulationDAO
_userPopulationDAO
static String
ROLE
The avalon role
-
Constructor Summary
Constructors Constructor Description UserAndGroupSearchManager()
-
Method Summary
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_DEFAULT_OFFSET_VALUE
private static final int _DEFAULT_OFFSET_VALUE
- See Also:
- Constant Field Values
-
_DEFAULT_COUNT_VALUE
private static final int _DEFAULT_COUNT_VALUE
- See Also:
- Constant Field Values
-
_userManager
private UserManager _userManager
-
_userHelper
private UserHelper _userHelper
-
_groupDirectoryDAO
private GroupDirectoryDAO _groupDirectoryDAO
-
_directoryContextHelper
private GroupDirectoryContextHelper _directoryContextHelper
-
_populationContextHelper
private PopulationContextHelper _populationContextHelper
-
_userPopulationDAO
private UserPopulationDAO _userPopulationDAO
-
_groupHelper
private GroupHelper _groupHelper
-
-
Constructor Detail
-
UserAndGroupSearchManager
public UserAndGroupSearchManager()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
searchUsersAndGroupByContext
public Map<String,Object> searchUsersAndGroupByContext(Set<String> contexts, int limit, Map<String,Object> searchData, Map<String,Object> params)
Mixed users and groups sorted search, with multiple offsets- Parameters:
contexts
- The context of the searchlimit
- The maximum number of results per group directory and populationsearchData
- The search data to fetch the next batch of the search. Must be null on the first search.params
- The parameters to pass to the group directories and user populations when retrieving their contents- Returns:
- An object with the list of results, sorted, and the search data required to fetch the following batch
-
searchUsersAndGroup
public Map<String,Object> searchUsersAndGroup(Set<String> availablePopulations, Set<String> availableDirectories, int limit, Map<String,Object> searchData, Map<String,Object> params)
Mixed users and groups sorted search, with multiple offsets- Parameters:
availablePopulations
- The populations of users available for search. On first search, all populations will be usedavailableDirectories
- The directories of groups available for search. On first search, all directories will be usedlimit
- The maximum number of results per group directory and populationsearchData
- The search data to fetch the next batch of the search. Must be null on the first search.params
- The parameters to pass to the group directories and user populations when retrieving their contents- Returns:
- An object with the list of results, sorted, and the search data required to fetch the following batch
-
_getFromSearchData
private Map<String,Integer> _getFromSearchData(String property, Map<String,Object> searchData)
-
_searchUsers
private UserAndGroupSearchManager.SearchDataResult _searchUsers(UserPopulation population, int limit, int offset, Map<String,Object> params)
-
_searchGroups
private UserAndGroupSearchManager.SearchDataResult _searchGroups(GroupDirectory directory, int limit, int offset, Map<String,Object> params)
-
_formatSearchResults
private Map<String,Object> _formatSearchResults(List<Map<String,Object>> results, List<UserAndGroupSearchManager.SearchDataResult> searchDataResults)
-
_mergeSearchResults
private List<Map<String,Object>> _mergeSearchResults(List<UserAndGroupSearchManager.SearchDataResult> searchDataResults)
-
_getSortableName
protected static String _getSortableName(Map<String,Object> o)
Get the sortable name for the json object- Parameters:
o
- The object- Returns:
- The sortable name, or an empty string if no name was found
-
-