}
LdifEntry otherEntry = ( LdifEntry ) o;
// Check the Dn
Dn thisDn = entryDn;
Dn dnEntry = otherEntry.getDn();
if ( !thisDn.equals( dnEntry ) )
{
return false;
}
// Check the changeType
if ( changeType != otherEntry.changeType )
{
return false;
}
// Check each different cases
switch ( changeType )
{
case Add:
// Checks the attributes
if ( entry.size() != otherEntry.entry.size() )
{
return false;
}
if ( !entry.equals( otherEntry.entry ) )
{
return false;
}
break;
case Delete:
// Nothing to do, if the DNs are equals
break;
case Modify:
// Check the modificationItems list
// First, deal with special cases
if ( modificationList == null )
{
if ( otherEntry.modificationList != null )
{
return false;
}
else
{
break;
}
}
if ( otherEntry.modificationList == null )
{
return false;
}
if ( modificationList.size() != otherEntry.modificationList.size() )
{
return false;
}
// Now, compares the contents
int i = 0;
for ( Modification modification : modificationList )
{
if ( !modification.equals( otherEntry.modificationList.get( i ) ) )
{
return false;
}
i++;
}
break;
case ModDn:
case ModRdn:
// Check the deleteOldRdn flag
if ( deleteOldRdn != otherEntry.deleteOldRdn )
{
return false;
}
// Check the newRdn value
try
{
Rdn thisNewRdn = new Rdn( newRdn );
Rdn entryNewRdn = new Rdn( otherEntry.newRdn );
if ( !thisNewRdn.equals( entryNewRdn ) )
{
return false;
}
}
catch ( LdapInvalidDnException ine )
{
return false;
}
// Check the newSuperior value
try
{
Dn thisNewSuperior = new Dn( newSuperior );
Dn entryNewSuperior = new Dn( otherEntry.newSuperior );
if ( !thisNewSuperior.equals( entryNewSuperior ) )
{
return false;
}