@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class ModifyDNRequest extends UpdatableLDAPRequest implements ReadOnlyModifyDNRequest, ProtocolOp
ModifyDNRequest
objects are mutable and therefore can be altered and
re-used for multiple requests. Note, however, that ModifyDNRequest
objects are not threadsafe and therefore a single ModifyDNRequest
object instance should not be used to process multiple requests at the same
time.
ModifyDNRequest modifyDNRequest = new ModifyDNRequest("ou=People,dc=example,dc=com", "ou=Users", true); LDAPResult modifyDNResult; try { modifyDNResult = connection.modifyDN(modifyDNRequest); // If we get here, the delete was successful. } catch (LDAPException le) { // The modify DN operation failed. modifyDNResult = le.toLDAPResult(); ResultCode resultCode = le.getResultCode(); String errorMessageFromServer = le.getDiagnosticMessage(); }
Constructor and Description |
---|
ModifyDNRequest(DN dn,
RDN newRDN,
boolean deleteOldRDN)
Creates a new modify DN request that will rename the entry but will not
move it below a new entry.
|
ModifyDNRequest(DN dn,
RDN newRDN,
boolean deleteOldRDN,
Control[] controls)
Creates a new modify DN request that will rename the entry but will not
move it below a new entry.
|
ModifyDNRequest(DN dn,
RDN newRDN,
boolean deleteOldRDN,
DN newSuperiorDN)
Creates a new modify DN request that will rename the entry and will
optionally move it below a new entry.
|
ModifyDNRequest(DN dn,
RDN newRDN,
boolean deleteOldRDN,
DN newSuperiorDN,
Control[] controls)
Creates a new modify DN request that will rename the entry and will
optionally move it below a new entry.
|
ModifyDNRequest(java.lang.String dn,
java.lang.String newRDN,
boolean deleteOldRDN)
Creates a new modify DN request that will rename the entry but will not
move it below a new entry.
|
ModifyDNRequest(java.lang.String dn,
java.lang.String newRDN,
boolean deleteOldRDN,
Control[] controls)
Creates a new modify DN request that will rename the entry but will not
move it below a new entry.
|
ModifyDNRequest(java.lang.String dn,
java.lang.String newRDN,
boolean deleteOldRDN,
java.lang.String newSuperiorDN)
Creates a new modify DN request that will rename the entry and will
optionally move it below a new entry.
|
ModifyDNRequest(java.lang.String dn,
java.lang.String newRDN,
boolean deleteOldRDN,
java.lang.String newSuperiorDN,
Control[] controls)
Creates a new modify DN request that will rename the entry and will
optionally move it below a new entry.
|
Modifier and Type | Method and Description |
---|---|
boolean |
deleteOldRDN()
Indicates whether the current RDN value should be removed from the entry.
|
ModifyDNRequest |
duplicate()
Creates a new instance of this LDAP request that may be modified without
impacting this request.
|
ModifyDNRequest |
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without
impacting this request.
|
ASN1Element |
encodeProtocolOp()
Encodes the modify DN request protocol op to an ASN.1 element.
|
java.lang.String |
getDN()
Retrieves the current DN of the entry to move/rename.
|
int |
getLastMessageID()
Retrieves the message ID for the last LDAP message sent using this request.
|
java.lang.String |
getNewRDN()
Retrieves the new RDN for the entry.
|
java.lang.String |
getNewSuperiorDN()
Retrieves the new superior DN for the entry.
|
OperationType |
getOperationType()
Retrieves the type of operation that is represented by this request.
|
byte |
getProtocolOpType()
Retrieves the BER type for this protocol op.
|
protected LDAPResult |
process(LDAPConnection connection,
int depth)
Sends this modify DN request to the directory server over the provided
connection and returns the associated response.
|
void |
responseReceived(LDAPResponse response)
Indicates that the provided LDAP response has been received by from the
server.
|
void |
setDeleteOldRDN(boolean deleteOldRDN)
Specifies whether the current RDN value should be removed from the entry.
|
void |
setDN(DN dn)
Specifies the current DN of the entry to move/rename.
|
void |
setDN(java.lang.String dn)
Specifies the current DN of the entry to move/rename.
|
void |
setNewRDN(RDN newRDN)
Specifies the new RDN for the entry.
|
void |
setNewRDN(java.lang.String newRDN)
Specifies the new RDN for the entry.
|
void |
setNewSuperiorDN(DN newSuperiorDN)
Specifies the new superior DN for the entry.
|
void |
setNewSuperiorDN(java.lang.String newSuperiorDN)
Specifies the new superior DN for the entry.
|
void |
toCode(java.util.List<java.lang.String> lineList,
java.lang.String requestID,
int indentSpaces,
boolean includeProcessing)
Appends a number of lines comprising the Java source code that can be used
to recreate this request to the given list.
|
java.lang.String[] |
toLDIF()
Retrieves a string array whose lines contain an LDIF representation of the
corresponding modify DN change record.
|
LDIFModifyDNChangeRecord |
toLDIFChangeRecord()
Retrieves an LDIF modify DN change record with the contents of this modify
DN request.
|
java.lang.String |
toLDIFString()
Retrieves an LDIF string representation of this modify DN request.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this request to the provided buffer.
|
void |
writeTo(ASN1Buffer writer)
Writes an ASN.1-encoded representation of this LDAP protocol op to the
provided ASN.1 buffer.
|
addControl, addControls, clearControls, removeControl, removeControl, replaceControl, replaceControl, setControls, setControls
followReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getReferralConnector, getReferralConnectorInternal, getReferralDepth, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setReferralDepth, setResponseTimeoutMillis, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
followReferrals, getControl, getControlList, getControls, getReferralConnector, getResponseTimeoutMillis, hasControl, hasControl, toString
public ModifyDNRequest(@NotNull java.lang.String dn, @NotNull java.lang.String newRDN, boolean deleteOldRDN)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.public ModifyDNRequest(@NotNull DN dn, @NotNull RDN newRDN, boolean deleteOldRDN)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.public ModifyDNRequest(@NotNull java.lang.String dn, @NotNull java.lang.String newRDN, boolean deleteOldRDN, @Nullable java.lang.String newSuperiorDN)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.newSuperiorDN
- The new superior DN for the entry. It may be
null
if the entry is not to be moved below a
new parent.public ModifyDNRequest(@NotNull DN dn, @NotNull RDN newRDN, boolean deleteOldRDN, @Nullable DN newSuperiorDN)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.newSuperiorDN
- The new superior DN for the entry. It may be
null
if the entry is not to be moved below a
new parent.public ModifyDNRequest(@NotNull java.lang.String dn, @NotNull java.lang.String newRDN, boolean deleteOldRDN, @Nullable Control[] controls)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.controls
- The set of controls to include in the request.public ModifyDNRequest(@NotNull DN dn, @NotNull RDN newRDN, boolean deleteOldRDN, @Nullable Control[] controls)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.controls
- The set of controls to include in the request.public ModifyDNRequest(@NotNull java.lang.String dn, @NotNull java.lang.String newRDN, boolean deleteOldRDN, @Nullable java.lang.String newSuperiorDN, @Nullable Control[] controls)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.newSuperiorDN
- The new superior DN for the entry. It may be
null
if the entry is not to be moved below a
new parent.controls
- The set of controls to include in the request.public ModifyDNRequest(@NotNull DN dn, @NotNull RDN newRDN, boolean deleteOldRDN, @Nullable DN newSuperiorDN, @Nullable Control[] controls)
dn
- The current DN for the entry to rename. It must not
be null
.newRDN
- The new RDN for the target entry. It must not be
null
.deleteOldRDN
- Indicates whether to delete the current RDN value
from the target entry.newSuperiorDN
- The new superior DN for the entry. It may be
null
if the entry is not to be moved below a
new parent.controls
- The set of controls to include in the request.@NotNull public java.lang.String getDN()
getDN
in interface ReadOnlyModifyDNRequest
public void setDN(@NotNull java.lang.String dn)
dn
- The current DN of the entry to move/rename. It must not be
null
.public void setDN(@NotNull DN dn)
dn
- The current DN of the entry to move/rename. It must not be
null
.@NotNull public java.lang.String getNewRDN()
getNewRDN
in interface ReadOnlyModifyDNRequest
public void setNewRDN(@NotNull java.lang.String newRDN)
newRDN
- The new RDN for the entry. It must not be null
.public void setNewRDN(@NotNull RDN newRDN)
newRDN
- The new RDN for the entry. It must not be null
.public boolean deleteOldRDN()
deleteOldRDN
in interface ReadOnlyModifyDNRequest
true
if the current RDN value should be removed from the
entry, or false
if not.public void setDeleteOldRDN(boolean deleteOldRDN)
deleteOldRDN
- Specifies whether the current RDN value should be
removed from the entry.@Nullable public java.lang.String getNewSuperiorDN()
getNewSuperiorDN
in interface ReadOnlyModifyDNRequest
null
if the entry is
not to be moved below a new parent.public void setNewSuperiorDN(@Nullable java.lang.String newSuperiorDN)
newSuperiorDN
- The new superior DN for the entry. It may be
null
if the entry is not to be removed below
a new parent.public void setNewSuperiorDN(@Nullable DN newSuperiorDN)
newSuperiorDN
- The new superior DN for the entry. It may be
null
if the entry is not to be removed below
a new parent.public byte getProtocolOpType()
getProtocolOpType
in interface ProtocolOp
public void writeTo(@NotNull ASN1Buffer writer)
writeTo
in interface ProtocolOp
writer
- The ASN.1 buffer to which the encoded representation should
be written.@NotNull public ASN1Element encodeProtocolOp()
encodeProtocolOp
in interface ProtocolOp
@NotNull protected LDAPResult process(@NotNull LDAPConnection connection, int depth) throws LDAPException
process
in class LDAPRequest
connection
- The connection to use to communicate with the directory
server.depth
- The current referral depth for this request. It should
always be one for the initial request, and should only
be incremented when following referrals.LDAPException
- If a problem occurs while sending the request or
reading the response.@InternalUseOnly public void responseReceived(@NotNull LDAPResponse response) throws LDAPException
response
- The LDAP response that has been received from the server.
It may be null
if the connection has been closed
without having received any response.LDAPException
- If a problem occurs while handling the response.public int getLastMessageID()
getLastMessageID
in class LDAPRequest
@NotNull public OperationType getOperationType()
getOperationType
in class LDAPRequest
@NotNull public ModifyDNRequest duplicate()
duplicate
in interface ReadOnlyLDAPRequest
duplicate
in interface ReadOnlyModifyDNRequest
@NotNull public ModifyDNRequest duplicate(@NotNull Control[] controls)
duplicate
in interface ReadOnlyLDAPRequest
duplicate
in interface ReadOnlyModifyDNRequest
controls
- The set of controls to include in the duplicate request.@NotNull public LDIFModifyDNChangeRecord toLDIFChangeRecord()
toLDIFChangeRecord
in interface ReadOnlyModifyDNRequest
@NotNull public java.lang.String[] toLDIF()
toLDIF
in interface ReadOnlyModifyDNRequest
@NotNull public java.lang.String toLDIFString()
toLDIFString
in interface ReadOnlyModifyDNRequest
public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in interface ProtocolOp
toString
in interface ReadOnlyLDAPRequest
toString
in class LDAPRequest
buffer
- The buffer to which to append a string representation of
this request.public void toCode(@NotNull java.util.List<java.lang.String> lineList, @NotNull java.lang.String requestID, int indentSpaces, boolean includeProcessing)
toCode
in interface ReadOnlyLDAPRequest
lineList
- The list to which the source code lines should
be added.requestID
- The name that should be used as an identifier
for the request. If this is null
or
empty, then a generic ID will be used.indentSpaces
- The number of spaces that should be used to
indent the generated code. It must not be
negative.includeProcessing
- Indicates whether the generated code should
include code required to actually process the
request and handle the result (if true
),
or just to generate the request (if
false
).