// need to remove references to the subentry
if ( isOldEntrySelected && !isNewEntrySelected )
{
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
EntryAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS );
if ( opAttr != null )
{
opAttr = ( ServerAttribute ) opAttr.clone();
opAttr.remove( subentryDn );
if ( opAttr.size() < 1 )
{
op = ModificationOperation.REMOVE_ATTRIBUTE;
}
modList.add( new ServerModification( op, opAttr ) );
}
}
}
// need to add references to the subentry
else if ( isNewEntrySelected && !isOldEntrySelected )
{
for ( String attribute : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
AttributeType type = atRegistry.lookup( attribute );
ServerAttribute opAttr = new DefaultServerAttribute( attribute, type );
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
}