Interface ModifyRequest
- All Superinterfaces:
AbandonableRequest, Message, Request, ResultResponseRequest, SingleReplyRequest
- All Known Implementing Classes:
ModifyRequestImpl
Modify request protocol message used to alter the attributes and values of an
existing entry. Here's what RFC 2255 says about it:
4.6. Modify Operation
The Modify Operation allows a client to request that a modification
of an entry be performed on its behalf by a server. The Modify
Request is defined as follows:
ModifyRequest ::= [APPLICATION 6] SEQUENCE {
object LDAPDN,
modification SEQUENCE OF SEQUENCE {
operation ENUMERATED {
add (0),
delete (1),
replace (2),
... },
modification AttributeTypeAndValues } }
AttributeTypeAndValues ::= SEQUENCE {
type AttributeDescription,
vals SET OF AttributeValue }
Parameters of the Modify Request are:
- object: The object to be modified. The value of this field contains
the Dn of the entry to be modified. The server will not perform
any alias dereferencing in determining the object to be modified.
- modification: A list of modifications to be performed on the entry.
The entire list of entry modifications MUST be performed
in the order they are listed, as a single atomic operation. While
individual modifications may violate the directory schema, the
resulting entry after the entire list of modifications is performed
MUST conform to the requirements of the directory schema. The
values that may be taken on by the 'operation' field in each
modification construct have the following semantics respectively:
add: add values listed to the given attribute, creating
the attribute if necessary;
delete: delete values listed from the given attribute,
removing the entire attribute if no values are listed, or
if all current values of the attribute are listed for
deletion;
replace: replace all existing values of the given attribute
with the new values listed, creating the attribute if it
did not already exist. A replace with no value will delete
the entire attribute if it exists, and is ignored if the
attribute does not exist.
Notice that we tried to leverage as much as we already can from the JNDI.
Both the Names and ModificationItems are used here to make the API as easy
as possible to understand. We do not attempt here to write a JNDI provider
which losses the explicit request type usage that we are looking for. Also
note that this library is both for the client side as well as the server side
unlike the JNDI which is strictly for the client side. From the JNDI we
borrow good ideas and familiar signatures, interfaces and classes where we
can.
RFC 4525 suggest to add an operation in the enumeration:
ModifyRequest ::= [APPLICATION 6] SEQUENCE {
object LDAPDN,
modification SEQUENCE OF SEQUENCE {
operation ENUMERATED {
add (0),
delete (1),
replace (2),
increment (3),
... },
- Author:
- Apache Directory Project
-
Method Summary
Modifier and TypeMethodDescriptionmarks a given attribute for addition in the target entry with the given values.marks a given attribute for addition in the target entry.addAllControls(Control[] controls) Adds an array of controls to this Message.addControl(Control control) Adds a control to this Message.addModification(Attribute attr, ModificationOperation modOp) Add a modificationAdds a ModificationItem to the set of modifications composing this modify request.Gets an immutable Collection of modification items representing the atomic changes to perform on the candidate entry to modify.getName()Gets the distinguished name of the entry to be modified by this request.marks a given attribute for increment by 1 in the target entry.marks a given attribute for increment in the target entry.marks a given attribute for increment by 1 in the target entry.marks a given attribute for increment in the target entry.marks a given attribute name for removal from the target entry.marks a given attribute for removal with the given values from the target entry.marks a given attribute for removal from the target entry.removeControl(Control control) Deletes a control removing it from this Message.Removes a ModificationItem to the set of modifications composing this modify request.marks a given attribute for replacement with the given values in the target entry.marks a given attribute for replacement in the target entry.setMessageId(int messageId) Sets the Message ID for this requestSets the distinguished name of the entry to be modified by this request.Methods inherited from interface AbandonableRequest
abandon, addAbandonListener, isAbandonedMethods inherited from interface Message
get, getControl, getControls, getMessageId, getType, hasControl, putMethods inherited from interface Request
hasResponseMethods inherited from interface ResultResponseRequest
getResultResponseMethods inherited from interface SingleReplyRequest
getResponseType
-
Method Details
-
getName
Dn getName()Gets the distinguished name of the entry to be modified by this request. This property represents the PDU's object field.- Returns:
- the Dn of the modified entry.
-
setName
Sets the distinguished name of the entry to be modified by this request. This property represents the PDU's object field.- Parameters:
name- the Dn of the modified entry.- Returns:
- The ModifyRequest instance
-
getModifications
Collection<Modification> getModifications()Gets an immutable Collection of modification items representing the atomic changes to perform on the candidate entry to modify.- Returns:
- an immutable Collection of Modification instances.
-
addModification
Adds a ModificationItem to the set of modifications composing this modify request.- Parameters:
mod- a Modification to add.- Returns:
- The ModifyRequest instance
-
removeModification
Removes a ModificationItem to the set of modifications composing this modify request.- Parameters:
mod- a Modification to remove.- Returns:
- The ModifyRequest instance
-
remove
marks a given attribute for removal with the given values from the target entry.- Parameters:
attributeName- name of the attribute to be removedattributeValue- values of the attribute- Returns:
- The ModifyRequest instance
-
remove
- Parameters:
attributeName- name of the attribute to be addedattributeValue- values of the attribute- Returns:
- The ModifyRequest instance
- See Also:
-
remove
marks a given attribute for removal from the target entry.- Parameters:
attr- the attribute to be removed- Returns:
- The ModifyRequest instance
-
remove
marks a given attribute name for removal from the target entry.- Parameters:
attributeName- the attribute to be removed- Returns:
- The ModifyRequest instance
-
addModification
Add a modification- Parameters:
attr- The attribute to be modifiedmodOp- The operation- Returns:
- The ModifyRequest instance
-
add
marks a given attribute for addition in the target entry with the given values.- Parameters:
attributeName- name of the attribute to be addedattributeValue- values of the attribute- Returns:
- The ModifyRequest instance
-
add
- Parameters:
attributeName- name of the attribute to be addedattributeValue- values of the attribute- Returns:
- The ModifyRequest instance
- See Also:
-
add
marks a given attribute for addition in the target entry.- Parameters:
attr- the attribute to be added- Returns:
- The ModifyRequest instance
-
replace
- Parameters:
attributeName- name of the attribute to be added- Returns:
- The ModifyRequest instance
- See Also:
-
replace
marks a given attribute for replacement with the given values in the target entry.- Parameters:
attributeName- name of the attribute to be addedattributeValue- values of the attribute- Returns:
- The ModifyRequest instance
-
replace
- Parameters:
attributeName- name of the attribute to be addedattributeValue- values of the attribute- Returns:
- The ModifyRequest instance
- See Also:
-
replace
marks a given attribute for replacement in the target entry.- Parameters:
attr- the attribute to be added- Returns:
- The ModifyRequest instance
-
increment
marks a given attribute for increment by 1 in the target entry.- Parameters:
attributeName- the attribute to be incremented- Returns:
- The ModifyRequest instance
-
increment
marks a given attribute for increment in the target entry.- Parameters:
attributeName- the attribute to be incrementedincrement- The increment value (>=1)- Returns:
- The ModifyRequest instance
-
increment
marks a given attribute for increment by 1 in the target entry.- Parameters:
attr- the attribute to be incremented- Returns:
- The ModifyRequest instance
-
increment
marks a given attribute for increment in the target entry.- Parameters:
attr- the attribute to be incrementedincrement- The increment value (>=1)- Returns:
- The ModifyRequest instance
-
setMessageId
Sets the Message ID for this request- Specified by:
setMessageIdin interfaceMessage- Parameters:
messageId- The message Id- Returns:
- A Message reference
-
addControl
Adds a control to this Message.- Specified by:
addControlin interfaceMessage- Parameters:
control- the control to add.- Returns:
- A Message reference
-
addAllControls
Adds an array of controls to this Message.- Specified by:
addAllControlsin interfaceMessage- Parameters:
controls- the controls to add.- Returns:
- A Message reference
-
removeControl
Deletes a control removing it from this Message.- Specified by:
removeControlin interfaceMessage- Parameters:
control- the control to remove.- Returns:
- A Message reference
-