/** * {@inheritDoc} */ @Override public void rename( ModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException { RenameOperationContext renameContext = new RenameOperationContext( this, modifyDnRequest ); renameContext.setLogChange( log ); OperationManager operationManager = directoryService.getOperationManager(); try { operationManager.rename( renameContext ); } catch ( LdapException e ) { modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() ); throw e; } modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() ); }
/** * Used to encapsulate [de]marshalling of controls before and after rename operations. * * @param oldDn The old Dn * @param newRdn The new Rdn * @param delOldRdn If we should delete the old Rdn * @throws Exception If the rename failed */ protected void doRename( Dn oldDn, Rdn newRdn, boolean delOldRdn ) throws Exception { // setup the op context and populate with request controls RenameOperationContext renameContext = new RenameOperationContext( session, oldDn, newRdn, delOldRdn ); renameContext.addRequestControls( convertControls( true, requestControls ) ); // Inject the referral handling into the operation context injectReferralControl( renameContext ); // execute rename operation OperationManager operationManager = service.getOperationManager(); operationManager.rename( renameContext ); // clear the request controls and set the response controls requestControls = EMPTY_CONTROLS; responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(), renameContext.getResponseControls() ); }