* Returns LDIF string of {@link Attributes} object.
*/
public String getAsText()
{
LdifComposer composer = new LdifComposerImpl();
MultiMap map = new MultiMap()
{
// FIXME Stop forking commons-collections.
private final MultiHashMap map = new MultiHashMap();
public Object remove( Object arg0, Object arg1 )
{
return map.remove( arg0, arg1 );
}
public int size()
{
return map.size();
}
public Object get( Object arg0 )
{
return map.get( arg0 );
}
public boolean containsValue( Object arg0 )
{
return map.containsValue( arg0 );
}
public Object put( Object arg0, Object arg1 )
{
return map.put( arg0, arg1 );
}
public Object remove( Object arg0 )
{
return map.remove( arg0 );
}
public Collection values()
{
return map.values();
}
public boolean isEmpty()
{
return map.isEmpty();
}
public boolean containsKey( Object key )
{
return map.containsKey( key );
}
public void putAll( Map arg0 )
{
map.putAll( arg0 );
}
public void clear()
{
map.clear();
}
public Set keySet()
{
return map.keySet();
}
public Set entrySet()
{
return map.entrySet();
}
};
Attributes attrs = ( Attributes ) getValue();
try
{
NamingEnumeration e = attrs.getAll();
while( e.hasMore() )
{
Attribute attr = ( Attribute ) e.next();
NamingEnumeration e2 = attr.getAll();
while( e2.hasMoreElements() )
{
Object value = e2.next();
map.put( attr.getID(), value );
}
}
return composer.compose( map );
}