@Mutable @ThreadSafety(level=NOT_THREADSAFE) public final class ModifyRequest extends UpdatableLDAPRequest implements ReadOnlyModifyRequest, ProtocolOp
Modification class for more
information about the types of modifications that may be processed.
ModifyRequest modifyRequest = new ModifyRequest(
"dn: dc=example,dc=com",
"changetype: modify",
"replace: description",
"description: This is the new description.");
ModifyRequest objects are mutable and therefore can be altered and
re-used for multiple requests. Note, however, that ModifyRequest
objects are not threadsafe and therefore a single ModifyRequest
object instance should not be used to process multiple requests at the same
time.| Constructor and Description |
|---|
ModifyRequest(DN dn,
java.util.List<Modification> mods)
Creates a new modify request with the provided information.
|
ModifyRequest(DN dn,
java.util.List<Modification> mods,
Control[] controls)
Creates a new modify request with the provided information.
|
ModifyRequest(DN dn,
Modification... mods)
Creates a new modify request with the provided information.
|
ModifyRequest(DN dn,
Modification mod)
Creates a new modify request with the provided information.
|
ModifyRequest(DN dn,
Modification[] mods,
Control[] controls)
Creates a new modify request with the provided information.
|
ModifyRequest(DN dn,
Modification mod,
Control[] controls)
Creates a new modify request with the provided information.
|
ModifyRequest(java.lang.String... ldifModificationLines)
Creates a new modify request from the provided LDIF representation of the
changes.
|
ModifyRequest(java.lang.String dn,
java.util.List<Modification> mods)
Creates a new modify request with the provided information.
|
ModifyRequest(java.lang.String dn,
java.util.List<Modification> mods,
Control[] controls)
Creates a new modify request with the provided information.
|
ModifyRequest(java.lang.String dn,
Modification... mods)
Creates a new modify request with the provided information.
|
ModifyRequest(java.lang.String dn,
Modification mod)
Creates a new modify request with the provided information.
|
ModifyRequest(java.lang.String dn,
Modification[] mods,
Control[] controls)
Creates a new modify request with the provided information.
|
ModifyRequest(java.lang.String dn,
Modification mod,
Control[] controls)
Creates a new modify request with the provided information.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addModification(Modification mod)
Adds the provided modification to the set of modifications for this modify
request.
|
ModifyRequest |
duplicate()
Creates a new instance of this LDAP request that may be modified without
impacting this request.
|
ModifyRequest |
duplicate(Control[] controls)
Creates a new instance of this LDAP request that may be modified without
impacting this request.
|
ASN1Element |
encodeProtocolOp()
Encodes the modify request protocol op to an ASN.1 element.
|
java.lang.String |
getDN()
Retrieves the DN of the entry to modify.
|
int |
getLastMessageID()
Retrieves the message ID for the last LDAP message sent using this request.
|
java.util.List<Modification> |
getModifications()
Retrieves the set of modifications for this modify request.
|
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 request to the directory server over the provided
connection and returns the associated response.
|
boolean |
removeModification(Modification mod)
Removes the provided modification from the set of modifications for this
modify request.
|
void |
responseReceived(LDAPResponse response)
Indicates that the provided LDAP response has been received by from the
server.
|
void |
setDN(DN dn)
Specifies the DN of the entry to modify.
|
void |
setDN(java.lang.String dn)
Specifies the DN of the entry to modify.
|
void |
setModifications(java.util.List<Modification> mods)
Replaces the existing set of modifications for this modify request with the
provided modifications.
|
void |
setModifications(Modification mod)
Replaces the existing set of modifications for this modify request with the
provided modification.
|
void |
setModifications(Modification[] mods)
Replaces the existing set of modifications for this modify request with the
provided modifications.
|
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 change record.
|
LDIFModifyChangeRecord |
toLDIFChangeRecord()
Retrieves an LDIF modify change record with the contents of this modify
request.
|
java.lang.String |
toLDIFString()
Retrieves an LDIF string representation of this modify 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, setControlsfollowReferrals, getControl, getControlList, getControls, getIntermediateResponseListener, getReferralConnector, getReferralConnectorInternal, getReferralDepth, getResponseTimeoutMillis, hasControl, hasControl, setFollowReferrals, setIntermediateResponseListener, setReferralConnector, setReferralDepth, setResponseTimeoutMillis, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfollowReferrals, getControl, getControlList, getControls, getReferralConnector, getResponseTimeoutMillis, hasControl, hasControl, toStringpublic ModifyRequest(@NotNull java.lang.String dn, @NotNull Modification mod)
dn - The DN of the entry to modify. It must not be null.mod - The modification to apply to the entry. It must not be
null.public ModifyRequest(@NotNull java.lang.String dn, @NotNull Modification... mods)
dn - The DN of the entry to modify. It must not be null.mods - The set of modifications to apply to the entry. It must not
be null or empty.public ModifyRequest(@NotNull java.lang.String dn, @NotNull java.util.List<Modification> mods)
dn - The DN of the entry to modify. It must not be null.mods - The set of modifications to apply to the entry. It must not
be null or empty.public ModifyRequest(@NotNull DN dn, @NotNull Modification mod)
dn - The DN of the entry to modify. It must not be null.mod - The modification to apply to the entry. It must not be
null.public ModifyRequest(@NotNull DN dn, @NotNull Modification... mods)
dn - The DN of the entry to modify. It must not be null.mods - The set of modifications to apply to the entry. It must not
be null or empty.public ModifyRequest(@NotNull DN dn, @NotNull java.util.List<Modification> mods)
dn - The DN of the entry to modify. It must not be null.mods - The set of modifications to apply to the entry. It must not
be null or empty.public ModifyRequest(@NotNull java.lang.String dn, @NotNull Modification mod, @Nullable Control[] controls)
dn - The DN of the entry to modify. It must not be
null.mod - The modification to apply to the entry. It must not be
null.controls - The set of controls to include in the request.public ModifyRequest(@NotNull java.lang.String dn, @NotNull Modification[] mods, @Nullable Control[] controls)
dn - The DN of the entry to modify. It must not be
null.mods - The set of modifications to apply to the entry. It must
not be null or empty.controls - The set of controls to include in the request.public ModifyRequest(@NotNull java.lang.String dn, @NotNull java.util.List<Modification> mods, @Nullable Control[] controls)
dn - The DN of the entry to modify. It must not be
null.mods - The set of modifications to apply to the entry. It must
not be null or empty.controls - The set of controls to include in the request.public ModifyRequest(@NotNull DN dn, @NotNull Modification mod, @Nullable Control[] controls)
dn - The DN of the entry to modify. It must not be
null.mod - The modification to apply to the entry. It must not be
null.controls - The set of controls to include in the request.public ModifyRequest(@NotNull DN dn, @NotNull Modification[] mods, @Nullable Control[] controls)
dn - The DN of the entry to modify. It must not be
null.mods - The set of modifications to apply to the entry. It must
not be null or empty.controls - The set of controls to include in the request.public ModifyRequest(@NotNull DN dn, @NotNull java.util.List<Modification> mods, @Nullable Control[] controls)
dn - The DN of the entry to modify. It must not be
null.mods - The set of modifications to apply to the entry. It must
not be null or empty.controls - The set of controls to include in the request.public ModifyRequest(@NotNull java.lang.String... ldifModificationLines) throws LDIFException
ldifModificationLines - The lines that comprise an LDIF
representation of a modify change record.
It must not be null or empty.LDIFException - If the provided set of lines cannot be parsed as an
LDIF modify change record.@NotNull public java.lang.String getDN()
getDN in interface ReadOnlyModifyRequestpublic void setDN(@NotNull java.lang.String dn)
dn - The DN of the entry to modify. It must not be null.public void setDN(@NotNull DN dn)
dn - The DN of the entry to modify. It must not be null.@NotNull public java.util.List<Modification> getModifications()
getModifications in interface ReadOnlyModifyRequestpublic void addModification(@NotNull Modification mod)
mod - The modification to be added. It must not be null.public boolean removeModification(@NotNull Modification mod)
mod - The modification to be removed. It must not be null.true if the specified modification was found and removed,
or false if not.public void setModifications(@NotNull Modification mod)
mod - The modification to use for this modify request. It must not
be null.public void setModifications(@NotNull Modification[] mods)
mods - The set of modification to use for this modify request. It
must not be null or empty.public void setModifications(@NotNull java.util.List<Modification> mods)
mods - The set of modification to use for this modify request. It
must not be null or empty.public byte getProtocolOpType()
getProtocolOpType in interface ProtocolOppublic void writeTo(@NotNull ASN1Buffer writer)
writeTo in interface ProtocolOpwriter - 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 LDAPRequestconnection - 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 ModifyRequest duplicate()
duplicate in interface ReadOnlyLDAPRequestduplicate in interface ReadOnlyModifyRequest@NotNull public ModifyRequest duplicate(@Nullable Control[] controls)
duplicate in interface ReadOnlyLDAPRequestduplicate in interface ReadOnlyModifyRequestcontrols - The set of controls to include in the duplicate request.@NotNull public LDIFModifyChangeRecord toLDIFChangeRecord()
toLDIFChangeRecord in interface ReadOnlyModifyRequest@NotNull public java.lang.String[] toLDIF()
toLDIF in interface ReadOnlyModifyRequest@NotNull public java.lang.String toLDIFString()
toLDIFString in interface ReadOnlyModifyRequestpublic void toString(@NotNull java.lang.StringBuilder buffer)
toString in interface ProtocolOptoString in interface ReadOnlyLDAPRequesttoString in class LDAPRequestbuffer - 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 ReadOnlyLDAPRequestlineList - 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).