private List < LdapEntry > deleteAll ( LdapEntry ldapEntry , boolean delDescendant ) throws WIMException { String dn = ldapEntry . getDN ( ) ; List < LdapEntry > delEntries = new ArrayList < LdapEntry > ( ) ; List < LdapEntry > descs = getDescendants ( dn , SearchControls . ONELEVEL_SCOPE ) ; if ( descs . size ( ) > 0 ) { if ( delDescendant ) { for ( int i = 0 ; i < descs . size ( ) ; i ++ ) { LdapEntry descEntry = descs . get ( i ) ; delEntries . addAll ( deleteAll ( descEntry , true ) ) ; } } else { throw new EntityHasDescendantsException ( WIMMessageKey . ENTITY_HAS_DESCENDENTS , Tr . formatMessage ( tc , WIMMessageKey . ENTITY_HAS_DESCENDENTS , WIMMessageHelper . generateMsgParms ( dn ) ) ) ; } } /* Call the preexit function */ deletePreExit ( dn ) ; List < String > grpList = getGroups ( dn ) ; iLdapConn . getContextManager ( ) . destroySubcontext ( dn ) ; delEntries . add ( ldapEntry ) ; for ( int i = 0 ; i < grpList . size ( ) ; i ++ ) { String grpDN = grpList . get ( i ) ; iLdapConn . invalidateAttributes ( grpDN , null , null ) ; } return delEntries ; }
Delete the descendants of the specified ldap entry .