SearchOperationContext searchOperationContext = new SearchOperationContext(
moveAndRenameContext.getSession(), baseDn,
filter, controls );
searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES );
EntryFilteringCursor subentries = nexus.search( searchOperationContext );
try
{
while ( subentries.next() )
{
Entry candidate = subentries.get();
Dn dn = candidate.getDn();
dn.apply( schemaManager );
if ( directoryService.getEvaluator().evaluate( ss, apName, dn, candidate ) )
{
nexus.modify( new ModifyOperationContext( moveAndRenameContext.getSession(), dn,
getOperationalModsForReplace(
oldDn, newName, subentry, candidate ) ) );
}
}
}
catch ( Exception e )
{
throw new LdapOperationException( e.getMessage(), e );
}
finally
{
try
{
subentries.close();
}
catch ( Exception e )
{
LOG.error( I18n.err( I18n.ERR_168 ), e );
}