org.apache.directory.shared.ldap.codec.modify
Class ModifyRequest

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.LdapMessage
          extended by org.apache.directory.shared.ldap.codec.modify.ModifyRequest
All Implemented Interfaces:
Asn1Object

public class ModifyRequest
extends LdapMessage

A ModifyRequest Message. Its syntax is : 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 } AttributeValue ::= OCTET STRING

Version:
$Rev: 691847 $, $Date: 2008-09-04 03:23:12 +0200 (Do, 04 Sep 2008) $,
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
ModifyRequest()
          Creates a new ModifyRequest object.
 
Method Summary
 void addAttributeTypeAndValues(java.lang.String type)
          Add a new attributeTypeAndValue
 void addAttributeValue(byte[] value)
          Add a new value to the current attribute
 void addAttributeValue(java.lang.String value)
          Add a new value to the current attribute
 void addAttributeValue(Value<?> value)
          Add a new value to the current attribute
 void addModification(int operation)
          Add a new modification to the list
 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 | +--> ...
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the ModifyRequest message to a PDU.
 java.lang.String getCurrentAttributeType()
          Return the current attribute's type
 int getCurrentOperation()
          Get the current operation
 int getMessageType()
          Get the message type
 java.util.List<Modification> getModifications()
          Get the entry's attributes
 LdapDN getObject()
          Get the modification's DN
 void initModifications()
          Initialize the ArrayList for modifications.
 void setCurrentOperation(int currentOperation)
          Store the current operation
 void setCurrentOperation(ModificationOperation currentOperation)
          Store the current operation
 void setObject(LdapDN object)
          Set the modification DN.
 java.lang.String toString()
          Get a String representation of a ModifyRequest
 
Methods inherited from class org.apache.directory.shared.ldap.codec.LdapMessage
addControl, getAbandonRequest, getAddRequest, getAddResponse, getBindRequest, getBindResponse, getCompareRequest, getCompareResponse, getControls, getControls, getCurrentControl, getDelRequest, getDelResponse, getExtendedRequest, getExtendedResponse, getLdapResponse, getMessageId, getMessageTypeName, getModifyDNRequest, getModifyDNResponse, getModifyRequest, getModifyResponse, getSearchRequest, getSearchResultDone, getSearchResultEntry, getSearchResultReference, getUnBindRequest, initControls, setMessageId, setProtocolOP
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModifyRequest

public ModifyRequest()
Creates a new ModifyRequest object.

Method Detail

getMessageType

public int getMessageType()
Get the message type

Overrides:
getMessageType in class LdapMessage
Returns:
Returns the type.

initModifications

public void initModifications()
Initialize the ArrayList for modifications.


getModifications

public java.util.List<Modification> getModifications()
Get the entry's attributes

Returns:
Returns the modifications.

addModification

public void addModification(int operation)
Add a new modification to the list

Parameters:
operation - The type of operation (add, delete or replace)

addAttributeTypeAndValues

public void addAttributeTypeAndValues(java.lang.String type)
Add a new attributeTypeAndValue

Parameters:
type - The attribute's name

addAttributeValue

public void addAttributeValue(java.lang.String value)
Add a new value to the current attribute

Parameters:
value - The value to add

addAttributeValue

public void addAttributeValue(Value<?> value)
Add a new value to the current attribute

Parameters:
value - The value to add

addAttributeValue

public void addAttributeValue(byte[] value)
Add a new value to the current attribute

Parameters:
value - The value to add

getCurrentAttributeType

public java.lang.String getCurrentAttributeType()
Return the current attribute's type


getObject

public LdapDN getObject()
Get the modification's DN

Returns:
Returns the object.

setObject

public void setObject(LdapDN object)
Set the modification DN.

Parameters:
object - The DN to set.

getCurrentOperation

public int getCurrentOperation()
Get the current operation

Returns:
Returns the currentOperation.

setCurrentOperation

public void setCurrentOperation(int currentOperation)
Store the current operation

Parameters:
currentOperation - The currentOperation to set.

setCurrentOperation

public void setCurrentOperation(ModificationOperation currentOperation)
Store the current operation

Parameters:
currentOperation - The currentOperation to set.

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 interface Asn1Object
Overrides:
computeLength in class LdapMessage
Returns:
The object's computed length

encode

public java.nio.ByteBuffer encode(java.nio.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 interface Asn1Object
Overrides:
encode in class LdapMessage
Parameters:
buffer - The buffer where to put the PDU
Returns:
The PDU.
Throws:
EncoderException - If anything goes wrong.

toString

public java.lang.String toString()
Get a String representation of a ModifyRequest

Overrides:
toString in class LdapMessage
Returns:
A ModifyRequest String


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.