boolean hasManageDsaItControl = req.getControls().containsKey( ManageDsaIT.OID );
if ( ( ref != null ) && !hasManageDsaItControl )
{
// The entry is a referral.
SearchResultReference respRef;
respRef = new SearchResultReferenceImpl( req.getMessageId() );
respRef.setReferral( new ReferralImpl() );
for ( Value<?> val : ref )
{
String url = val.getString();
if ( !url.startsWith( "ldap" ) )
{
respRef.getReferral().addLdapUrl( url );
}
LdapUrl ldapUrl = null;
try
{
ldapUrl = new LdapUrl( url );
ldapUrl.setForceScopeRendering( true );
}
catch ( LdapURLEncodingException e )
{
PROVIDER_LOG.error( I18n.err( I18n.ERR_165, url, entry ) );
}
switch ( req.getScope() )
{
case SUBTREE:
ldapUrl.setScope( SearchScope.SUBTREE.getScope() );
break;
case ONELEVEL: // one level here is object level on remote server
ldapUrl.setScope( SearchScope.OBJECT.getScope() );
break;
default:
throw new IllegalStateException( I18n.err( I18n.ERR_686 ) );
}
respRef.getReferral().addLdapUrl( ldapUrl.toString() );
}
return respRef;
}
else