Search in sources :

Example 16 with SearchControl

use of com.iplanet.ums.SearchControl in project OpenAM by OpenRock.

the class AMRoleImpl method searchUsers.

/**
     * Searches for users in this role using wildcards and attribute values.
     * Wildcards can be specified such as a*, *, *a. To further refine the
     * search, attribute-value pairs can be specifed so that DNs of users with
     * matching attribute-value pairs will be returned.
     * 
     * @param wildcard
     *            wildcard pattern to be used in the search
     * @param avPairs
     *            attribute-value pairs to match when searching users
     * @param searchControl
     *            specifies the search scope to be used, VLV ranges etc.,
     * 
     * @return AMSearchResults which contains a Set DNs of Users matching the
     *         search
     * 
     * @throws AMException
     *             if there is an internal error in the AM Store
     * @throws SSOException
     *             if the sign on is no longer valid
     */
public AMSearchResults searchUsers(AMSearchControl searchControl, String avFilter) throws AMException, SSOException {
    int level = searchControl.getSearchScope();
    if ((level != AMConstants.SCOPE_ONE) && (level != AMConstants.SCOPE_SUB))
        throw new AMException(AMSDKBundle.getString("123", super.locale), "123");
    String filter = "(&" + getSearchFilter(AMObject.USER) + "(" + roleDNsAN + "=" + super.entryDN + ")" + avFilter + ")";
    if (debug.messageEnabled()) {
        debug.message("AMRoleImpl.searchUsers: " + filter);
    }
    searchControl.setSearchScope(AMConstants.SCOPE_SUB);
    SearchControl sc = searchControl.getSearchControl();
    String[] returnAttrs = searchControl.getReturnAttributes();
    return dsServices.search(super.token, getOrganizationDN(), filter, sc, returnAttrs);
}
Also used : SearchControl(com.iplanet.ums.SearchControl)

Aggregations

SearchControl (com.iplanet.ums.SearchControl)16 AMSearchResults (com.iplanet.am.sdk.AMSearchResults)5 AMException (com.iplanet.am.sdk.AMException)4 Guid (com.iplanet.ums.Guid)4 PersistentObject (com.iplanet.ums.PersistentObject)4 SearchResults (com.iplanet.ums.SearchResults)4 UMSException (com.iplanet.ums.UMSException)4 Set (java.util.Set)4 SortKey (com.iplanet.ums.SortKey)3 HashSet (java.util.HashSet)3 Iterator (java.util.Iterator)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)2 AMPreCallBackException (com.iplanet.am.sdk.AMPreCallBackException)1 Attr (com.iplanet.services.ldap.Attr)1 AttrSet (com.iplanet.services.ldap.AttrSet)1 AccessRightsException (com.iplanet.ums.AccessRightsException)1 EntryNotFoundException (com.iplanet.ums.EntryNotFoundException)1