| | |
| | | public AddEntryTransaction(Entry entry) |
| | | { |
| | | this.entry = entry; |
| | | this.parentDN = entry.getDN().getParent(); |
| | | this.parentDN = getParentWithinBase(entry.getDN()); |
| | | } |
| | | |
| | | /** |
| | |
| | | id2subtree.insertID(txn, parentID.getDatabaseEntry(), entryID); |
| | | |
| | | // Iterate up through the superior entries, starting above the parent. |
| | | for (DN dn = parentDN.getParent(); dn != null; dn = dn.getParent()) |
| | | for (DN dn = getParentWithinBase(parentDN); dn != null; |
| | | dn = getParentWithinBase(dn)) |
| | | { |
| | | // Read the ID from dn2id. |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | |
| | | |
| | | // Iterate up through the superior entries. |
| | | boolean isParent = true; |
| | | for (DN dn = leafDN.getParent(); dn != null; dn = dn.getParent()) |
| | | for (DN dn = getParentWithinBase(leafDN); dn != null; |
| | | dn = getParentWithinBase(dn)) |
| | | { |
| | | // Read the ID from dn2id. |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | |
| | | |
| | | // Iterate up through the superior entries. |
| | | boolean isParent = true; |
| | | for (DN dn = leafDN.getParent(); dn != null; dn = dn.getParent()) |
| | | for (DN dn = getParentWithinBase(leafDN); dn != null; |
| | | dn = getParentWithinBase(dn)) |
| | | { |
| | | // Read the ID from dn2id. |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | |
| | | ModifyDNOperation modifyDNOperation) |
| | | { |
| | | this.oldApexDN = currentDN; |
| | | this.oldSuperiorDN = currentDN.getParent(); |
| | | this.newSuperiorDN = entry.getDN().getParent(); |
| | | this.oldSuperiorDN = getParentWithinBase(currentDN); |
| | | this.newSuperiorDN = getParentWithinBase(entry.getDN()); |
| | | this.newApexEntry = entry; |
| | | this.modifyDNOperation = modifyDNOperation; |
| | | } |
| | |
| | | { |
| | | DN oldDN = oldEntry.getDN(); |
| | | DN newDN = newEntry.getDN(); |
| | | DN newParentDN = newDN.getParent(); |
| | | DN newParentDN = getParentWithinBase(newDN); |
| | | |
| | | // Remove the old DN from dn2id. |
| | | dn2id.remove(txn, oldDN); |
| | |
| | | id2entry.put(txn, newID, newEntry); |
| | | |
| | | // Remove the old parentID:ID from id2children. |
| | | DN oldParentDN = oldDN.getParent(); |
| | | DN oldParentDN = getParentWithinBase(oldDN); |
| | | if (oldParentDN != null) |
| | | { |
| | | EntryID currentParentID = dn2id.get(txn, oldParentDN); |
| | |
| | | |
| | | |
| | | // Remove the old nodeID:ID from id2subtree. |
| | | for (DN dn = oldDN.getParent(); dn != null; dn = dn.getParent()) |
| | | for (DN dn = getParentWithinBase(oldDN); dn != null; |
| | | dn = getParentWithinBase(dn)) |
| | | { |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | | id2sBuffered.removeID(nodeID.getDatabaseEntry().getData(), oldID); |
| | | } |
| | | |
| | | // Put the new nodeID:ID in id2subtree. |
| | | for (DN dn = newParentDN; dn != null; dn = dn.getParent()) |
| | | for (DN dn = newParentDN; dn != null; dn = getParentWithinBase(dn)) |
| | | { |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | | id2sBuffered.insertID(config.getBackendIndexEntryLimit(), |
| | |
| | | throws JebException, DirectoryException, DatabaseException |
| | | { |
| | | DN oldDN = oldEntry.getDN(); |
| | | DN newParentDN = newDN.getParent(); |
| | | DN newParentDN = getParentWithinBase(newDN); |
| | | |
| | | // Remove the old DN from dn2id. |
| | | dn2id.remove(txn, oldDN); |
| | |
| | | } |
| | | |
| | | // Remove the old nodeID:ID from id2subtree |
| | | for (DN dn = oldSuperiorDN; dn != null; dn = dn.getParent()) |
| | | for (DN dn = oldSuperiorDN; dn != null; dn = getParentWithinBase(dn)) |
| | | { |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | | id2sBuffered.removeID(nodeID.getDatabaseEntry().getData(), |
| | |
| | | } |
| | | |
| | | // Put the new nodeID:ID in id2subtree. |
| | | for (DN dn = newParentDN; dn != null; dn = dn.getParent()) |
| | | for (DN dn = newParentDN; dn != null; dn = getParentWithinBase(dn)) |
| | | { |
| | | if (!newID.equals(oldID) || dn.isAncestorOf(newSuperiorDN)) |
| | | { |
| | |
| | | { |
| | | return baseDN; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get the parent of a DN in the scope of the base DN. |
| | | * |
| | | * @param dn A DN which is in the scope of the base DN. |
| | | * @return The parent DN, or null if the given DN is the base DN. |
| | | */ |
| | | public DN getParentWithinBase(DN dn) |
| | | { |
| | | if (dn.equals(baseDN)) |
| | | { |
| | | return null; |
| | | } |
| | | return dn.getParent(); |
| | | } |
| | | |
| | | } |