if ( studioSearchResult != null )
{
String dn = studioSearchResult.getNameInNamespace();
Attributes attributes = studioSearchResult.getAttributes();
LdifContentRecord record = new LdifContentRecord( LdifDnLine.create( dn ) );
NamingEnumeration<? extends Attribute> attributeEnumeration = attributes.getAll();
while ( attributeEnumeration.hasMore() )
{
Attribute attribute = attributeEnumeration.next();
String attributeName = attribute.getID();
NamingEnumeration<?> valueEnumeration = attribute.getAll();
while ( valueEnumeration.hasMore() )
{
Object o = valueEnumeration.next();
if ( o instanceof String )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, ( String ) o ) );
}
if ( o instanceof byte[] )
{
record.addAttrVal( LdifAttrValLine.create( attributeName, ( byte[] ) o ) );
}
}
}
record.finish( LdifSepLine.create() );
formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT );
}
else
{
formattedString = LdifFormatParameters.DEFAULT.getLineSeparator();
}