// need to remove references to the subentry
if ( isOldNameSelected && !isNewNameSelected )
{
for ( AttributeType operationalAttribute : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
Attribute opAttr = entry.get( operationalAttribute );
if ( opAttr != null )
{
opAttr = opAttr.clone();
opAttr.remove( subentryDn.getNormName() );
if ( opAttr.size() < 1 )
{
op = ModificationOperation.REMOVE_ATTRIBUTE;
}
modifications.add( new DefaultModification( op, opAttr ) );
}
}
}
// need to add references to the subentry
else if ( isNewNameSelected && !isOldNameSelected )
{
for ( AttributeType operationalAttribute : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
Attribute opAttr = new DefaultAttribute( operationalAttribute );
opAttr.add( subentryDn.getNormName() );
modifications.add( new DefaultModification( op, opAttr ) );
}
}