Class ModifyRequestDecorator
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.api.MessageDecorator<M>
-
- org.apache.directory.api.ldap.codec.decorators.RequestDecorator<M>
-
- org.apache.directory.api.ldap.codec.decorators.ResultResponseRequestDecorator<M>
-
- org.apache.directory.api.ldap.codec.decorators.SingleReplyRequestDecorator<ModifyRequest>
-
- org.apache.directory.api.ldap.codec.decorators.ModifyRequestDecorator
-
- All Implemented Interfaces:
Asn1Object
,Decorator<ModifyRequest>
,AbandonableRequest
,Message
,ModifyRequest
,Request
,ResultResponseRequest
,SingleReplyRequest
public class ModifyRequestDecorator extends SingleReplyRequestDecorator<ModifyRequest> implements ModifyRequest
A decorator for the ModifyRequest message- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description ModifyRequestDecorator(LdapApiService codec, ModifyRequest decoratedMessage)
Makes a ModifyRequest encodable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModifyRequest
add(String attributeName, byte[]... attributeValue)
ModifyRequest
add(String attributeName, String... attributeValue)
marks a given attribute for addition in the target entry with the given values.ModifyRequest
add(Attribute attr)
marks a given attribute for addition in the target entry.ModifyRequest
addAllControls(Control[] controls)
Adds an array of controls to this Message.void
addAttributeTypeAndValues(String type)
Add a new attributeTypeAndValuevoid
addAttributeValue(byte[] value)
Add a new value to the current attributevoid
addAttributeValue(String value)
Add a new value to the current attributeModifyRequest
addControl(Control control)
Adds a control to this Message.ModifyRequest
addModification(Attribute attr, ModificationOperation modOp)
Add a modificationModifyRequest
addModification(Modification mod)
Adds a ModificationItem to the set of modifications composing this modify request.int
computeLength()
Compute the ModifyRequest length
ModifyRequest :ByteBuffer
encode(ByteBuffer buffer)
Encode the ModifyRequest message to a PDU.String
getCurrentAttributeType()
Collection<Modification>
getModifications()
Gets an immutable Collection of modification items representing the atomic changes to perform on the candidate entry to modify.Dn
getName()
Gets the distinguished name of the entry to be modified by this request.ModifyRequest
remove(String attributeName)
marks a given attribute name for removal from the target entry.ModifyRequest
remove(String attributeName, byte[]... attributeValue)
ModifyRequest
remove(String attributeName, String... attributeValue)
marks a given attribute for removal with the given values from the target entry.ModifyRequest
remove(Attribute attr)
marks a given attribute for removal from the target entry.ModifyRequest
removeControl(Control control)
Deletes a control removing it from this Message.ModifyRequest
removeModification(Modification mod)
Removes a ModificationItem to the set of modifications composing this modify request.ModifyRequest
replace(String attributeName)
ModifyRequest
replace(String attributeName, byte[]... attributeValue)
ModifyRequest
replace(String attributeName, String... attributeValue)
marks a given attribute for replacement with the given values in the target entry.ModifyRequest
replace(Attribute attr)
marks a given attribute for replacement in the target entry.void
setCurrentOperation(int currentOperation)
Store the current operationModifyRequest
setMessageId(int messageId)
Sets the Message ID for this requestModifyRequest
setName(Dn name)
Sets the distinguished name of the entry to be modified by this request.-
Methods inherited from class org.apache.directory.api.ldap.codec.decorators.SingleReplyRequestDecorator
abandon, addAbandonListener, getResponseType, isAbandoned
-
Methods inherited from class org.apache.directory.api.ldap.codec.decorators.ResultResponseRequestDecorator
getResultResponse, hasResponse
-
Methods inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
get, getCodecService, getControl, getControls, getControlsLength, getCurrentControl, getDecorated, getDecorator, getMessageId, getMessageLength, getType, hasControl, put, setControlsLength, setMessageLength, toString
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.AbandonableRequest
abandon, addAbandonListener, isAbandoned
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Message
get, getControl, getControls, getMessageId, getType, hasControl, put
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Request
hasResponse
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.ResultResponseRequest
getResultResponse
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.SingleReplyRequest
getResponseType
-
-
-
-
Constructor Detail
-
ModifyRequestDecorator
public ModifyRequestDecorator(LdapApiService codec, ModifyRequest decoratedMessage)
Makes a ModifyRequest encodable.- Parameters:
codec
- The LDAP service instancedecoratedMessage
- the decorated ModifyRequest
-
-
Method Detail
-
setCurrentOperation
public void setCurrentOperation(int currentOperation)
Store the current operation- Parameters:
currentOperation
- The currentOperation to set.
-
addAttributeTypeAndValues
public void addAttributeTypeAndValues(String type)
Add a new attributeTypeAndValue- Parameters:
type
- The attribute's name
-
getCurrentAttributeType
public String getCurrentAttributeType()
- Returns:
- the current attribute's type
-
addAttributeValue
public void addAttributeValue(byte[] value) throws LdapException
Add a new value to the current attribute- Parameters:
value
- The value to add- Throws:
LdapException
- If teh value is invalid
-
addAttributeValue
public void addAttributeValue(String value) throws LdapException
Add a new value to the current attribute- Parameters:
value
- The value to add- Throws:
LdapException
- If teh value is invalid
-
getName
public Dn getName()
Gets the distinguished name of the entry to be modified by this request. This property represents the PDU's object field.- Specified by:
getName
in interfaceModifyRequest
- Returns:
- the Dn of the modified entry.
-
setName
public ModifyRequest setName(Dn name)
Sets the distinguished name of the entry to be modified by this request. This property represents the PDU's object field.- Specified by:
setName
in interfaceModifyRequest
- Parameters:
name
- the Dn of the modified entry.- Returns:
- The ModifyRequest instance
-
getModifications
public Collection<Modification> getModifications()
Gets an immutable Collection of modification items representing the atomic changes to perform on the candidate entry to modify.- Specified by:
getModifications
in interfaceModifyRequest
- Returns:
- an immutable Collection of Modification instances.
-
addModification
public ModifyRequest addModification(Modification mod)
Adds a ModificationItem to the set of modifications composing this modify request.- Specified by:
addModification
in interfaceModifyRequest
- Parameters:
mod
- a Modification to add.- Returns:
- The ModifyRequest instance
-
removeModification
public ModifyRequest removeModification(Modification mod)
Removes a ModificationItem to the set of modifications composing this modify request.- Specified by:
removeModification
in interfaceModifyRequest
- Parameters:
mod
- a Modification to remove.- Returns:
- The ModifyRequest instance
-
remove
public ModifyRequest remove(String attributeName, String... attributeValue)
marks a given attribute for removal with the given values from the target entry.- Specified by:
remove
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be removedattributeValue
- values of the attribute- Returns:
- The ModifyRequest instance
-
remove
public ModifyRequest remove(String attributeName, byte[]... attributeValue)
- Specified by:
remove
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be addedattributeValue
- values of the attribute- Returns:
- The ModifyRequest instance
- See Also:
ModifyRequest.remove(String, String...)
-
remove
public ModifyRequest remove(Attribute attr)
marks a given attribute for removal from the target entry.- Specified by:
remove
in interfaceModifyRequest
- Parameters:
attr
- the attribute to be removed- Returns:
- The ModifyRequest instance
-
remove
public ModifyRequest remove(String attributeName)
marks a given attribute name for removal from the target entry.- Specified by:
remove
in interfaceModifyRequest
- Parameters:
attributeName
- the attribute to be removed- Returns:
- The ModifyRequest instance
-
addModification
public ModifyRequest addModification(Attribute attr, ModificationOperation modOp)
Add a modification- Specified by:
addModification
in interfaceModifyRequest
- Parameters:
attr
- The attribute to be modifiedmodOp
- The operation- Returns:
- The ModifyRequest instance
-
add
public ModifyRequest add(String attributeName, String... attributeValue)
marks a given attribute for addition in the target entry with the given values.- Specified by:
add
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be addedattributeValue
- values of the attribute- Returns:
- The ModifyRequest instance
-
add
public ModifyRequest add(String attributeName, byte[]... attributeValue)
- Specified by:
add
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be addedattributeValue
- values of the attribute- Returns:
- The ModifyRequest instance
- See Also:
ModifyRequest.add(String, String...)
-
add
public ModifyRequest add(Attribute attr)
marks a given attribute for addition in the target entry.- Specified by:
add
in interfaceModifyRequest
- Parameters:
attr
- the attribute to be added- Returns:
- The ModifyRequest instance
-
replace
public ModifyRequest replace(String attributeName)
- Specified by:
replace
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be added- Returns:
- The ModifyRequest instance
- See Also:
ModifyRequest.replace(String, String...)
-
replace
public ModifyRequest replace(String attributeName, String... attributeValue)
marks a given attribute for replacement with the given values in the target entry.- Specified by:
replace
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be addedattributeValue
- values of the attribute- Returns:
- The ModifyRequest instance
-
replace
public ModifyRequest replace(String attributeName, byte[]... attributeValue)
- Specified by:
replace
in interfaceModifyRequest
- Parameters:
attributeName
- name of the attribute to be addedattributeValue
- values of the attribute- Returns:
- The ModifyRequest instance
- See Also:
ModifyRequest.replace(String, String...)
-
replace
public ModifyRequest replace(Attribute attr)
marks a given attribute for replacement in the target entry.- Specified by:
replace
in interfaceModifyRequest
- Parameters:
attr
- the attribute to be added- Returns:
- The ModifyRequest instance
-
setMessageId
public ModifyRequest setMessageId(int messageId)
Sets the Message ID for this request- Specified by:
setMessageId
in interfaceMessage
- Specified by:
setMessageId
in interfaceModifyRequest
- Overrides:
setMessageId
in classMessageDecorator<ModifyRequest>
- Parameters:
messageId
- The message Id- Returns:
- A Message reference
-
addControl
public ModifyRequest addControl(Control control)
Adds a control to this Message.- Specified by:
addControl
in interfaceMessage
- Specified by:
addControl
in interfaceModifyRequest
- Overrides:
addControl
in classMessageDecorator<ModifyRequest>
- Parameters:
control
- the control to add.- Returns:
- A Message reference
-
addAllControls
public ModifyRequest addAllControls(Control[] controls)
Adds an array of controls to this Message.- Specified by:
addAllControls
in interfaceMessage
- Specified by:
addAllControls
in interfaceModifyRequest
- Overrides:
addAllControls
in classMessageDecorator<ModifyRequest>
- Parameters:
controls
- the controls to add.- Returns:
- A Message reference
-
removeControl
public ModifyRequest removeControl(Control control)
Deletes a control removing it from this Message.- Specified by:
removeControl
in interfaceMessage
- Specified by:
removeControl
in interfaceModifyRequest
- Overrides:
removeControl
in classMessageDecorator<ModifyRequest>
- Parameters:
control
- the control to remove.- Returns:
- A Message reference
-
computeLength
public int computeLength()
Compute the ModifyRequest length
ModifyRequest :0x66 L1 | +--> 0x04 L2 object +--> 0x30 L3 modifications | +--> 0x30 L4-1 modification sequence | | | +--> 0x0A 0x01 (0..2) operation | +--> 0x30 L5-1 modification | | | +--> 0x04 L6-1 type | +--> 0x31 L7-1 vals | | | +--> 0x04 L8-1-1 attributeValue | +--> 0x04 L8-1-2 attributeValue | +--> ... | +--> 0x04 L8-1-i attributeValue | +--> ... | +--> 0x04 L8-1-n attributeValue | +--> 0x30 L4-2 modification sequence . | . +--> 0x0A 0x01 (0..2) operation . +--> 0x30 L5-2 modification | +--> 0x04 L6-2 type +--> 0x31 L7-2 vals | +--> 0x04 L8-2-1 attributeValue +--> 0x04 L8-2-2 attributeValue +--> ... +--> 0x04 L8-2-i attributeValue +--> ... +--> 0x04 L8-2-n attributeValue
- Specified by:
computeLength
in interfaceAsn1Object
- Returns:
- The object's computed length
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encode the ModifyRequest message to a PDU.
ModifyRequest :0x66 LL 0x04 LL object 0x30 LL modifiations 0x30 LL modification sequence 0x0A 0x01 operation 0x30 LL modification 0x04 LL type 0x31 LL vals 0x04 LL attributeValue ... 0x04 LL attributeValue ... 0x30 LL modification sequence 0x0A 0x01 operation 0x30 LL modification 0x04 LL type 0x31 LL vals 0x04 LL attributeValue ... 0x04 LL attributeValue
- Specified by:
encode
in interfaceAsn1Object
- Parameters:
buffer
- The buffer where to put the PDU- Returns:
- The PDU.
- Throws:
EncoderException
- if the buffer can't be encoded
-
-