for ( int i = 0; i < attributes.length; i++ )
{
IValue[] values = attributes[i].getValues();
for ( int ii = 0; ii < values.length; ii++ )
{
IValue value = values[ii];
if ( value.getRawValue() instanceof LdifPart )
{
mustCreateChangeTypeLine = false;
}
}
}
// LdifChangeAddRecord record =
// LdifChangeAddRecord.create(entry.getDn().toString());
LdifChangeAddRecord record = new LdifChangeAddRecord( LdifDnLine.create( entry.getDn().getUpName() ) );
if ( mustCreateChangeTypeLine )
{
addControls( record, entry );
record.setChangeType( LdifChangeTypeLine.createAdd() );
}
for ( int i = 0; i < attributes.length; i++ )
{
String name = attributes[i].getDescription();
IValue[] values = attributes[i].getValues();
for ( int ii = 0; ii < values.length; ii++ )
{
IValue value = values[ii];
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() );