// Check whether the renamed entry already exists.
if (dn2id.getID(txn, newApexEntry.getDN(),
NdbOperation.LockMode.LM_Exclusive) != 0)
{
Message message = ERR_NDB_MODIFYDN_ALREADY_EXISTS.get(
newApexEntry.getDN().toString());
throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
message);
}
Entry oldApexEntry = dn2id.get(txn, oldApexDN,
NdbOperation.LockMode.LM_Exclusive);
if (oldApexEntry == null)
{
// Check for referral entries above the target entry.
targetEntryReferrals(txn, oldApexDN, null);
Message message =
ERR_NDB_MODIFYDN_NO_SUCH_OBJECT.get(oldApexDN.toString());
DN matchedDN = getMatchedDN(txn, baseDN);
throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
message, matchedDN, null);
}
if (!isManageDsaITOperation(modifyDNOperation))
{
checkTargetForReferral(oldApexEntry, null);
}
long oldApexID = (Long) oldApexEntry.getAttachment();
long newApexID = oldApexID;
if (newSuperiorDN != null)
{
long newSuperiorID = dn2id.getID(txn, newSuperiorDN,
NdbOperation.LockMode.LM_Exclusive);
if (newSuperiorID == 0)
{
Message msg =
ERR_NDB_NEW_SUPERIOR_NO_SUCH_OBJECT.get(
newSuperiorDN.toString());
DN matchedDN = getMatchedDN(txn, baseDN);
throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
msg, matchedDN, null);