Search in sources :

Example 6 with CachedSubEntries

use of com.sun.identity.sm.CachedSubEntries in project OpenAM by OpenRock.

the class ImportServiceConfiguration method deleteOuServicesDescendents.

private void deleteOuServicesDescendents(SSOToken ssoToken, String ouServices) throws SSOException, SMSException {
    CachedSubEntries smsEntry = CachedSubEntries.getInstance(ssoToken, ouServices);
    Set children = smsEntry.searchSubOrgNames(ssoToken, "*", false);
    for (Iterator i = children.iterator(); i.hasNext(); ) {
        String child = (String) i.next();
        child = "o=" + child + "," + ouServices;
        SMSEntry s = new SMSEntry(ssoToken, child);
        s.delete();
    }
    {
        // hardcoding hidden realm, cannot find a better option.
        SMSEntry s = new SMSEntry(ssoToken, "o=sunamhiddenrealmdelegationservicepermissions," + ouServices);
        s.delete();
    }
    children = smsEntry.getSubEntries(ssoToken, "*");
    for (Iterator i = children.iterator(); i.hasNext(); ) {
        String child = (String) i.next();
        child = "ou=" + child + "," + ouServices;
        SMSEntry s = new SMSEntry(ssoToken, child);
        s.delete();
    }
    ServiceManager mgr = new ServiceManager(ssoToken);
    mgr.clearCache();
    AMIdentityRepository.clearCache();
}
Also used : CachedSubEntries(com.sun.identity.sm.CachedSubEntries) Set(java.util.Set) ServiceManager(com.sun.identity.sm.ServiceManager) Iterator(java.util.Iterator) SMSEntry(com.sun.identity.sm.SMSEntry)

Aggregations

CachedSubEntries (com.sun.identity.sm.CachedSubEntries)6 Set (java.util.Set)2 SMSEntry (com.sun.identity.sm.SMSEntry)1 ServiceManager (com.sun.identity.sm.ServiceManager)1 Iterator (java.util.Iterator)1