mustCreateChangeTypeLine = false;
}
}
}
LdifChangeAddRecord record = new LdifChangeAddRecord( LdifDnLine.create( entry.getDn().getUpName() ) );
if ( mustCreateChangeTypeLine )
{
addControls( record, entry );
record.setChangeType( LdifChangeTypeLine.createAdd() );
}
for ( IAttribute attribute : entry.getAttributes() )
{
String name = attribute.getDescription();
for ( IValue value : attribute.getValues() )
{
if ( !value.isEmpty() )
{
if ( value.getRawValue() instanceof LdifPart )
{
LdifPart part = ( LdifPart ) value.getRawValue();
if ( part instanceof LdifChangeTypeLine )
{
record.setChangeType( ( LdifChangeTypeLine ) part );
}
else if ( part instanceof LdifCommentLine )
{
record.addComment( ( LdifCommentLine ) part );
}
else if ( part instanceof LdifControlLine )
{
record.addControl( ( LdifControlLine ) part );
}
}
else if ( value.isString() )
{
record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
}
else
{
record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
}
}
}
}
record.finish( LdifSepLine.create() );
return record;
}