/** * update the children's Dn based on the new parent Dn created * after a rename or move operation * * @param newParentDn The new parent's Dn * @throws LdapInvalidDnException The parent DN is invalid */ private synchronized void updateAfterModDn( Dn newParentDn ) throws LdapInvalidDnException { if ( children != null ) { for ( DnNode<N> child : children.values() ) { child.nodeDn = newParentDn.add( child.nodeRdn ); child.updateAfterModDn( child.nodeDn ); } } }
/** * update the children's Dn based on the new parent Dn created * after a rename or move operation * * @param newParentDn The new parent's Dn * @throws LdapInvalidDnException The parent DN is invalid */ private synchronized void updateAfterModDn( Dn newParentDn ) throws LdapInvalidDnException { if ( children != null ) { for ( DnNode<N> child : children.values() ) { child.nodeDn = newParentDn.add( child.nodeRdn ); child.updateAfterModDn( child.nodeDn ); } } }
/** * rename the DnNode's Dn * * @param newRdn the new Rdn of this node * @throws LdapException If the rename failed */ public synchronized void rename( Rdn newRdn ) throws LdapException { Dn temp = nodeDn.getParent(); temp = temp.add( newRdn ); Rdn oldRdn = nodeRdn; nodeRdn = temp.getRdn(); nodeDn = temp; if ( parent != null ) { parent.children.remove( oldRdn.getNormName() ); parent.children.put( nodeRdn.getNormName(), this ); } updateAfterModDn( nodeDn ); }
/** * rename the DnNode's Dn * * @param newRdn the new Rdn of this node * @throws LdapException If the rename failed */ public synchronized void rename( Rdn newRdn ) throws LdapException { Dn temp = nodeDn.getParent(); temp = temp.add( newRdn ); Rdn oldRdn = nodeRdn; nodeRdn = temp.getRdn(); nodeDn = temp; if ( parent != null ) { parent.children.remove( oldRdn.getNormName() ); parent.children.put( nodeRdn.getNormName(), this ); } updateAfterModDn( nodeDn ); }
/** * Creates a new instance of MoveAndRenameOperationContext. * * @param session The session to use * @param oldDn the original source entry Dn to be moved and renamed * @param newSuperiorDn the new entry superior of the target after the move * @param newRdn the new rdn to use for the target once renamed * @param delOldRdn true if the old rdn value is deleted, false otherwise */ public MoveAndRenameOperationContext( CoreSession session, Dn oldDn, Dn newSuperiorDn, Rdn newRdn, boolean delOldRdn ) { super( session, oldDn, newRdn, delOldRdn ); this.newSuperiorDn = newSuperiorDn; if ( session != null ) { setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.MOVE_AND_RENAME ) ); } try { newDn = newSuperiorDn.add( newRdn ); } catch ( LdapInvalidDnException lide ) { throw new IllegalArgumentException( lide.getMessage(), lide ); } }
target = target.add( relativeName );
/** * Creates a new instance of MoveOperationContext. * * @param session The session to use * @param oldDn the original source entry Dn to be moved and renamed * @param newSuperior the new entry superior of the target after the move */ public MoveOperationContext( CoreSession session, Dn oldDn, Dn newSuperior ) { super( session, oldDn ); this.newSuperior = newSuperior; oldSuperior = oldDn.getParent(); rdn = oldDn.getRdn().clone(); if ( session != null ) { setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.MOVE ) ); } try { newDn = newSuperior.add( rdn ); } catch ( LdapInvalidDnException lide ) { throw new IllegalArgumentException( lide.getMessage(), lide ); } }
newDn = newDn.add( modifiedDn.getRdn() );
/** * {@inheritDoc} */ public void rename( RenameOperationContext renameContext ) throws LdapException { PartitionTxn partitionTxn = renameContext.getTransaction(); Dn oldDn = renameContext.getDn(); String entryId = getEntryId( partitionTxn, oldDn ); // Create the new entry super.rename( renameContext ); // Get the modified entry and store it in the context for post usage Dn newDn = oldDn.getParent().add( renameContext.getNewRdn() ); Entry modifiedEntry = fetch( renameContext.getTransaction(), entryId, newDn ); renameContext.setModifiedEntry( modifiedEntry ); // Now move the potential children for the old entry // and remove the old entry try { entryMoved( partitionTxn, oldDn, modifiedEntry, entryId ); } catch ( Exception e ) { throw new LdapOperationErrorException( e.getMessage(), e ); } }
return JndiUtils.toName( JndiUtils.fromName( prefix ).add( fqn ) );
Dn oldDn = name; Dn newDn = name; newDn = newDn.add( newRdn );
Dn restoredDn = newSuperior.add( newRdn ); reverted.setDn( restoredDn );
Dn restoredDn = newSuperior.add( newRdn ); reverted.setDn( restoredDn );
Dn restoredDn = newSuperior.add( newRdn ); reverted.setDn( restoredDn );
baseDn = baseDn.add( removedSubentry.getSubtreeSpecification().getBase() );
/** * {@inheritDoc} */ @Override public void rename( Entry entry, Rdn newRdn, boolean cascade ) throws LdapException { String oldOid = getOid( entry ); String schemaName = getSchemaName( entry.getDn() ); if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_367, oldOid ) ); } String newOid = newRdn.getValue(); checkOidIsUniqueForNormalizer( newOid ); if ( isSchemaEnabled( schemaName ) ) { // Inject the new OID Entry targetEntry = entry.clone(); targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid ); // Inject the new Dn Dn newDn = targetEntry.getDn().getParent(); newDn = newDn.add( newRdn ); targetEntry.setDn( newDn ); Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName ); schemaManager.unregisterNormalizer( oldOid ); schemaManager.add( normalizer ); } }
Dn userDN = usersDN.add("uid=" + user); Entry userEntry = service.newEntry(userDN); if (kerberos && principal != null) {
newDn = newDn.add( newRdn ); targetEntry.setDn( newDn );
newDn = newDn.add( newRdn );
newDn = newDn.add( newRdn ); targetEntry.setDn( newDn );