public void widgetSelected( SelectionEvent e ) { if ( !Dn.isNullOrEmpty( dn ) ) { dn = dn.getParent(); dnChanged(); internalSetEnabled(); notifyListeners(); } } } );
/** * 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 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 ); } }
private void checkPartition(LdifEntry ldifEntry) throws Exception { Dn dn = ldifEntry.getDn(); Dn parent = dn.getParent(); try { directoryService.getAdminSession().exists(parent); } catch (Exception e) { System.out.println("Creating new partition for DN=" + dn + "\n"); AvlPartition partition = new AvlPartition(directoryService.getSchemaManager()); partition.setId(dn.getName()); partition.setSuffixDn(dn); directoryService.addPartition(partition); } }
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ protected Control createDialogArea( Composite parent ) { Composite composite = ( Composite ) super.createDialogArea( parent ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 3 / 2; composite.setLayoutData( gd ); BaseWidgetUtils.createLabel( composite, Messages.getString( "MoveEntriesDialog.MoveEntriesDescription" ), 1 ); //$NON-NLS-1$ dnBuilderWidget = new DnBuilderWidget( false, true ); dnBuilderWidget.addWidgetModifyListener( this ); dnBuilderWidget.createContents( composite ); dnBuilderWidget .setInput( entries[0].getBrowserConnection(), null, null, entries[0].getDn().getParent() ); applyDialogFont( composite ); return composite; }
modifyDnRequest.setNewSuperior( newDn.getParent() ); modifyDnRequest.setDeleteOldRdn( deleteOldRdn );
Dn newName = new Dn( newDn ); request.setNewRdn( newName.getRdn() ); request.setNewSuperior( newName.getParent() ); request.addAllControls( convertControls( controls ) );
currentParent = currentParent.getParent();
/** * {@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 ); } }
Dn parentDn = dn.getParent();
Dn parentDn = dn.getParent();
Dn parentDn = dn.getParent();
Dn parentDn = dn.getParent();
oldSuperior = oldSuperior.getParent(); reverted.setNewSuperior( oldSuperior.getName() );
/** * {@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 ); } }
@Override public Response<Void> modifyDn(final ModifyDnRequest request) throws LdapException { Response<Void> response = null; try { final Dn dn = new Dn(request.getDn()); final Dn newDn = new Dn(request.getNewDn()); final ModifyDnRequestImpl mdri = new ModifyDnRequestImpl(); if (request.getControls() != null) { mdri.addAllControls(config.getControlProcessor().processRequestControls(request.getControls())); } mdri.setName(dn); mdri.setNewRdn(newDn.getRdn()); mdri.setNewSuperior(newDn.getParent()); mdri.setDeleteOldRdn(request.getDeleteOldRDn()); final ModifyDnResponse mdr = connection.modifyDn(mdri); throwOperationException(request, mdr); response = createResponse(request, null, mdr); } catch (LdapOperationException e) { processLdapOperationException(e); } catch (org.apache.directory.api.ldap.model.exception.LdapException e) { processLdapException(e); } return response; }
/** * {@inheritDoc} */ public void logChangetypeModDn( Connection connection, final String oldDn, final String newDn, final boolean deleteOldRdn, final Control[] controls, NamingException ex ) { if ( !isModificationLogEnabled() ) { return; } try { Dn dn = new Dn( newDn ); Rdn newrdn = dn.getRdn(); Dn newsuperior = dn.getParent(); LdifChangeModDnRecord record = new LdifChangeModDnRecord( LdifDnLine.create( oldDn ) ); addControlLines( record, controls ); record.setChangeType( LdifChangeTypeLine.createModDn() ); record.setNewrdn( LdifNewrdnLine.create( newrdn.getName() ) ); record.setDeloldrdn( deleteOldRdn ? LdifDeloldrdnLine.create1() : LdifDeloldrdnLine.create0() ); record.setNewsuperior( LdifNewsuperiorLine.create( newsuperior.getName() ) ); record.finish( LdifSepLine.create() ); String formattedString = record.toFormattedString( LdifFormatParameters.DEFAULT ); log( formattedString, ex, connection ); } catch ( LdapInvalidDnException e ) { } }
Dn newDn = targetEntry.getDn().getParent(); newDn = newDn.add( newRdn ); targetEntry.setDn( newDn );
Dn newDn = targetEntry.getDn().getParent(); newDn = newDn.add( newRdn );