new Dn( searchResult.getNameInNamespace() ) );
if ( isReferral( entry ) )
{
// The search result is a referral
SearchResultReferenceDsml srr = new SearchResultReferenceDsml( codec );
// Getting the 'ref' attribute
Attribute refAttribute = entry.get( ExportDsmlRunnable.REF_ATTRIBUTETYPE_NAME );
if ( refAttribute == null )
{
// If we did not get it by its name, let's get it by its OID
refAttribute = entry.get( ExportDsmlRunnable.REF_ATTRIBUTETYPE_OID );
}
// Adding references
if ( refAttribute != null )
{
for ( Iterator<Value<?>> iterator = refAttribute.iterator(); iterator.hasNext(); )
{
Value<?> value = ( Value<?> ) iterator.next();
srr.addSearchResultReference( new LdapUrl( ( String ) value.getValue() ) );
}
}
return srr;
}