Class ModifyDnRequestDecorator
- 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<ModifyDnRequest>
-
- org.apache.directory.api.ldap.codec.decorators.ModifyDnRequestDecorator
-
- All Implemented Interfaces:
Asn1Object
,Decorator<ModifyDnRequest>
,AbandonableRequest
,Message
,ModifyDnRequest
,Request
,ResultResponseRequest
,SingleReplyRequest
public class ModifyDnRequestDecorator extends SingleReplyRequestDecorator<ModifyDnRequest> implements ModifyDnRequest
A decorator for the ModifyDnRequest message- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description ModifyDnRequestDecorator(LdapApiService codec, ModifyDnRequest decoratedMessage)
Makes a ModifyDnRequest encodable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModifyDnRequest
addAllControls(Control[] controls)
Adds an array of controls to this Message.ModifyDnRequest
addControl(Control control)
Adds a control to this Message.int
computeLength()
Compute the ModifyDNRequest length
ModifyDNRequest :ByteBuffer
encode(ByteBuffer buffer)
Encode the ModifyDNRequest message to a PDU.boolean
getDeleteOldRdn()
Gets the flag which determines if the old Rdn attribute is to be removed from the entry when the new Rdn is used in its stead.Dn
getName()
Gets the entry's distinguished name representing the entry PDU field.Rdn
getNewRdn()
Gets the new relative distinguished name for the entry which represents the PDU's newrdn field.Dn
getNewSuperior()
Gets the optional distinguished name of the new superior entry where the candidate entry is to be moved.boolean
isMove()
Gets whether or not this request is a Dn change resulting in a move operation.ModifyDnRequest
removeControl(Control control)
Deletes a control removing it from this Message.ModifyDnRequest
setDeleteOldRdn(boolean deleteOldRdn)
Sets the flag which determines if the old Rdn attribute is to be removed from the entry when the new Rdn is used in its stead.ModifyDnRequest
setMessageId(int messageId)
Sets the Message ID for this requestModifyDnRequest
setName(Dn name)
Sets the entry's distinguished name representing the entry PDU field.ModifyDnRequest
setNewRdn(Rdn newRdn)
Sets the new relative distinguished name for the entry which represents the PDU's newrdn field.ModifyDnRequest
setNewSuperior(Dn newSuperior)
Sets the optional distinguished name of the new superior entry where the candidate entry is to be moved.-
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
-
ModifyDnRequestDecorator
public ModifyDnRequestDecorator(LdapApiService codec, ModifyDnRequest decoratedMessage)
Makes a ModifyDnRequest encodable.- Parameters:
codec
- The LDAP service instancedecoratedMessage
- the decorated ModifyDnRequest
-
-
Method Detail
-
getName
public Dn getName()
Gets the entry's distinguished name representing the entry PDU field.- Specified by:
getName
in interfaceModifyDnRequest
- Returns:
- the distinguished name of the entry.
-
setName
public ModifyDnRequest setName(Dn name)
Sets the entry's distinguished name representing the entry PDU field.- Specified by:
setName
in interfaceModifyDnRequest
- Parameters:
name
- the distinguished name of the entry.- Returns:
- The ModifyDnRequest instance
-
getNewRdn
public Rdn getNewRdn()
Gets the new relative distinguished name for the entry which represents the PDU's newrdn field.- Specified by:
getNewRdn
in interfaceModifyDnRequest
- Returns:
- the relative dn with one component
-
setNewRdn
public ModifyDnRequest setNewRdn(Rdn newRdn)
Sets the new relative distinguished name for the entry which represents the PDU's newrdn field.- Specified by:
setNewRdn
in interfaceModifyDnRequest
- Parameters:
newRdn
- the relative dn with one component- Returns:
- The ModifyDnRequest instance
-
getDeleteOldRdn
public boolean getDeleteOldRdn()
Gets the flag which determines if the old Rdn attribute is to be removed from the entry when the new Rdn is used in its stead. This property corresponds to the deleteoldrdn.- Specified by:
getDeleteOldRdn
in interfaceModifyDnRequest
- Returns:
- true if the old rdn is to be deleted, false if it is not
-
setDeleteOldRdn
public ModifyDnRequest setDeleteOldRdn(boolean deleteOldRdn)
Sets the flag which determines if the old Rdn attribute is to be removed from the entry when the new Rdn is used in its stead. This property corresponds to the deleteoldrdn.- Specified by:
setDeleteOldRdn
in interfaceModifyDnRequest
- Parameters:
deleteOldRdn
- true if the old rdn is to be deleted, false if it is not- Returns:
- The ModifyDnRequest instance
-
getNewSuperior
public Dn getNewSuperior()
Gets the optional distinguished name of the new superior entry where the candidate entry is to be moved. This property corresponds to the PDU's newSuperior field. May be null representing a simple Rdn change rather than a move operation.- Specified by:
getNewSuperior
in interfaceModifyDnRequest
- Returns:
- the dn of the superior entry the candidate entry is moved under.
-
setNewSuperior
public ModifyDnRequest setNewSuperior(Dn newSuperior)
Sets the optional distinguished name of the new superior entry where the candidate entry is to be moved. This property corresponds to the PDU's newSuperior field. May be null representing a simple Rdn change rather than a move operation. Setting this property to a non-null value toggles the move flag obtained via theisMove
method.- Specified by:
setNewSuperior
in interfaceModifyDnRequest
- Parameters:
newSuperior
- the dn of the superior entry the candidate entry for Dn modification is moved under.- Returns:
- The ModifyDnRequest instance
-
isMove
public boolean isMove()
Gets whether or not this request is a Dn change resulting in a move operation. Setting the newSuperior property to a non-null name, toggles this flag.- Specified by:
isMove
in interfaceModifyDnRequest
- Returns:
- true if the newSuperior property is NOT null, false otherwise.
-
setMessageId
public ModifyDnRequest setMessageId(int messageId)
Sets the Message ID for this request- Specified by:
setMessageId
in interfaceMessage
- Specified by:
setMessageId
in interfaceModifyDnRequest
- Overrides:
setMessageId
in classMessageDecorator<ModifyDnRequest>
- Parameters:
messageId
- The message Id- Returns:
- A Message reference
-
addControl
public ModifyDnRequest addControl(Control control)
Adds a control to this Message.- Specified by:
addControl
in interfaceMessage
- Specified by:
addControl
in interfaceModifyDnRequest
- Overrides:
addControl
in classMessageDecorator<ModifyDnRequest>
- Parameters:
control
- the control to add.- Returns:
- A Message reference
-
addAllControls
public ModifyDnRequest addAllControls(Control[] controls)
Adds an array of controls to this Message.- Specified by:
addAllControls
in interfaceMessage
- Specified by:
addAllControls
in interfaceModifyDnRequest
- Overrides:
addAllControls
in classMessageDecorator<ModifyDnRequest>
- Parameters:
controls
- the controls to add.- Returns:
- A Message reference
-
removeControl
public ModifyDnRequest removeControl(Control control)
Deletes a control removing it from this Message.- Specified by:
removeControl
in interfaceMessage
- Specified by:
removeControl
in interfaceModifyDnRequest
- Overrides:
removeControl
in classMessageDecorator<ModifyDnRequest>
- Parameters:
control
- the control to remove.- Returns:
- A Message reference
-
computeLength
public int computeLength()
Compute the ModifyDNRequest length
ModifyDNRequest :0x6C L1 | +--> 0x04 L2 entry +--> 0x04 L3 newRDN +--> 0x01 0x01 (true/false) deleteOldRDN (3 bytes) [+--> 0x80 L4 newSuperior ] L2 = Length(0x04) + Length(Length(entry)) + Length(entry) L3 = Length(0x04) + Length(Length(newRDN)) + Length(newRDN) L4 = Length(0x80) + Length(Length(newSuperior)) + Length(newSuperior) L1 = L2 + L3 + 3 [+ L4] Length(ModifyDNRequest) = Length(0x6C) + Length(L1) + L1
- Specified by:
computeLength
in interfaceAsn1Object
- Returns:
- The PDU's length of a ModifyDN Request
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encode the ModifyDNRequest message to a PDU.
ModifyDNRequest :0x6C LL 0x04 LL entry 0x04 LL newRDN 0x01 0x01 deleteOldRDN [0x80 LL newSuperior]
- 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
-
-