Search in sources :

Example 26 with AMHashMap

use of com.iplanet.am.sdk.AMHashMap in project OpenAM by OpenRock.

the class OpenAMScopeValidator method getTimestamps.

private AMHashMap getTimestamps(String username, String realm, String modifyTimestamp, String createTimestamp) throws IdRepoException, SSOException {
    final SSOToken token = AccessController.doPrivileged(AdminTokenAction.getInstance());
    final AMIdentityRepository amIdRepo = new AMIdentityRepository(token, realm);
    final IdSearchControl searchConfig = new IdSearchControl();
    searchConfig.setReturnAttributes(new HashSet<String>(Arrays.asList(modifyTimestamp, createTimestamp)));
    searchConfig.setMaxResults(0);
    final IdSearchResults searchResults = amIdRepo.searchIdentities(IdType.USER, username, searchConfig);
    final Iterator searchResultsItr = searchResults.getResultAttributes().values().iterator();
    if (searchResultsItr.hasNext()) {
        return (AMHashMap) searchResultsItr.next();
    } else {
        logger.warning("Error retrieving timestamps from datastore");
        throw new IdRepoException();
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) AMHashMap(com.iplanet.am.sdk.AMHashMap) IdSearchResults(com.sun.identity.idm.IdSearchResults) AMIdentityRepository(com.sun.identity.idm.AMIdentityRepository) IdSearchControl(com.sun.identity.idm.IdSearchControl) Iterator(java.util.Iterator) IdRepoException(com.sun.identity.idm.IdRepoException)

Aggregations

AMHashMap (com.iplanet.am.sdk.AMHashMap)26 Map (java.util.Map)16 Set (java.util.Set)10 HashSet (java.util.HashSet)9 AMException (com.iplanet.am.sdk.AMException)6 SSOException (com.iplanet.sso.SSOException)6 HashMap (java.util.HashMap)6 RemoteException (java.rmi.RemoteException)5 Iterator (java.util.Iterator)5 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)4 AMEventManagerException (com.iplanet.am.sdk.AMEventManagerException)4 CacheBlock (com.iplanet.am.sdk.common.CacheBlock)4 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)4 AMIdentity (com.sun.identity.idm.AMIdentity)4 IdCacheBlock (com.sun.identity.idm.common.IdCacheBlock)4 Attr (com.iplanet.services.ldap.Attr)3 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)3 IdRepoException (com.sun.identity.idm.IdRepoException)3 AttrSet (com.iplanet.services.ldap.AttrSet)2 Guid (com.iplanet.ums.Guid)2