/** * {@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 ); } }
/** * {@inheritDoc} */ @Override public void rename( RenameOperationContext renameContext ) throws LdapException { Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry(); entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() ); entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); Entry modifiedEntry = renameContext.getOriginalEntry().clone(); modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() ); modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); Attribute csnAt = new DefaultAttribute( directoryService.getAtProvider().getEntryCSN(), directoryService .getCSN().toString() ); modifiedEntry.put( csnAt ); renameContext.setModifiedEntry( modifiedEntry ); next( renameContext ); }