// check if RDN attributes ar present
RDN newRdn = newEntry.getRdn();
RDNPart[] oldRdnParts = rdn.getParts();
for ( int i = 0; i < oldRdnParts.length; i++ )
{
RDNPart part = oldRdnParts[i];
IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
if ( rdnAttribute != null )
{
IValue[] values = rdnAttribute.getValues();
for ( int ii = 0; ii < values.length; ii++ )
{
if ( part.getUnencodedValue().equals( values[ii].getRawValue() ) )
{
rdnAttribute.deleteValue( values[ii] );
}
if ( rdnAttribute.getValueSize() == 0 )
{
newEntry.deleteAttribute( rdnAttribute );
}
}
}
}
RDNPart[] newRdnParts = newRdn.getParts();
for ( int i = 0; i < newRdnParts.length; i++ )
{
RDNPart part = newRdnParts[i];
IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
if ( rdnAttribute == null )
{
rdnAttribute = new Attribute( newEntry, part.getType() );
newEntry.addAttribute( rdnAttribute );
rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
}
else
{
boolean mustAdd = true;
IValue[] values = rdnAttribute.getValues();
for ( int ii = 0; ii < values.length; ii++ )
{
if ( part.getUnencodedValue().equals( values[ii].getStringValue() ) )
{
mustAdd = false;
break;
}
}
if ( mustAdd )
{
rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
}
}
}
newEntry.getBrowserConnection().create( newEntry, monitor );