if ( !cursor.next() ) // if this is a leaf entry's DN
{
LOG.debug( "deleting {}", dn.getName() );
cursorMap.remove( dn );
cursor.close();
delResponse = delete( new DeleteRequest( dn ) );
}
else
{
do
{
SearchResponse searchResp = cursor.get();
if ( searchResp instanceof SearchResultEntry )
{
SearchResultEntry searchResult = ( SearchResultEntry ) searchResp;
deleteRecursive( searchResult.getEntry().getDn(), cursorMap, listener );
}
}
while ( cursor.next() );
cursorMap.remove( dn );
cursor.close();
LOG.debug( "deleting {}", dn.getName() );
delResponse = delete( new DeleteRequest( dn ) );
}
}
catch ( Exception e )
{
String msg = "Failed to delete child entries under the DN " + dn.getName();