org.apache.directory.api.ldap.model.message
Class AddRequestImpl

java.lang.Object
  extended by org.apache.directory.api.ldap.model.message.AbstractMessage
      extended by org.apache.directory.api.ldap.model.message.AbstractRequest
          extended by org.apache.directory.api.ldap.model.message.AbstractAbandonableRequest
              extended by org.apache.directory.api.ldap.model.message.AddRequestImpl
All Implemented Interfaces:
AbandonableRequest, AddRequest, Message, Request, ResultResponseRequest<AddResponse>, SingleReplyRequest<AddResponse>

public class AddRequestImpl
extends AbstractAbandonableRequest
implements AddRequest

Lockable add request implementation.

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.api.ldap.model.message.AbstractMessage
controls
 
Fields inherited from interface org.apache.directory.api.ldap.model.message.AddRequest
RESP_TYPE, TYPE
 
Constructor Summary
AddRequestImpl()
          Creates an AddRequest implementation to create a new entry.
 
Method Summary
 AddRequest addAllControls(Control[] controls)
          Adds an array of controls to this Message.
 void addAttributeType(String type)
          Create a new attributeValue
 void addAttributeValue(byte[] value)
          Add a new value to the current attribute
 void addAttributeValue(String value)
          Add a new value to the current attribute
 void addAttributeValue(Value<?> value)
          Add a new value to the current attribute
 AddRequest addControl(Control control)
          Adds a control to this Message.
 boolean equals(Object obj)
          Checks to see if an object is equivalent to this AddRequest.
 String getCurrentAttributeType()
           
 Entry getEntry()
          Gets the entry to add.
 Dn getEntryDn()
          Gets the distinguished name of the entry to add.
 MessageTypeEnum getResponseType()
          Gets the protocol response message type for this request which produces at least one response.
 AddResponse getResultResponse()
          The result containing response for this request.
 int hashCode()
           
 AddRequest removeControl(Control control)
          Deletes a control removing it from this Message.
 AddRequest setEntry(Entry entry)
          Sets the Entry to add.
 AddRequest setEntryDn(Dn dn)
          Sets the distinguished name of the entry to add.
 AddRequest setMessageId(int messageId)
          Sets the Message ID for this request
 String toString()
           
 
Methods inherited from class org.apache.directory.api.ldap.model.message.AbstractAbandonableRequest
abandon, addAbandonListener, isAbandoned
 
Methods inherited from class org.apache.directory.api.ldap.model.message.AbstractRequest
hasResponse
 
Methods inherited from class org.apache.directory.api.ldap.model.message.AbstractMessage
get, getControl, getControls, getMessageId, getType, hasControl, put, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.Request
hasResponse
 
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.AbandonableRequest
abandon, addAbandonListener, isAbandoned
 

Constructor Detail

AddRequestImpl

public AddRequestImpl()
Creates an AddRequest implementation to create a new entry.

Method Detail

addAttributeType

public void addAttributeType(String type)
                      throws LdapException
Create a new attributeValue

Parameters:
type - The attribute's name (called 'type' in the grammar)
Throws:
LdapException

getCurrentAttributeType

public String getCurrentAttributeType()
Returns:
Returns the currentAttribute type.

addAttributeValue

public void addAttributeValue(String value)
                       throws LdapException
Add a new value to the current attribute

Parameters:
value - The value to add
Throws:
LdapException

addAttributeValue

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

Parameters:
value - The value to add
Throws:
LdapException

addAttributeValue

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

Parameters:
value - The value to add
Throws:
LdapException

getEntryDn

public Dn getEntryDn()
Gets the distinguished name of the entry to add.

Specified by:
getEntryDn in interface AddRequest
Returns:
the Dn of the added entry.

setEntryDn

public AddRequest setEntryDn(Dn dn)
Sets the distinguished name of the entry to add.

Specified by:
setEntryDn in interface AddRequest
Parameters:
dn - the Dn of the added entry.
Returns:
The AddRequest instance

getEntry

public Entry getEntry()
Gets the entry to add.

Specified by:
getEntry in interface AddRequest
Returns:
the added Entry

setEntry

public AddRequest setEntry(Entry entry)
Sets the Entry to add.

Specified by:
setEntry in interface AddRequest
Parameters:
entry - the added Entry
Returns:
The AddRequest instance

setMessageId

public AddRequest setMessageId(int messageId)
Sets the Message ID for this request

Specified by:
setMessageId in interface AddRequest
Specified by:
setMessageId in interface Message
Overrides:
setMessageId in class AbstractMessage
Parameters:
messageId - The message Id
Returns:
A Message reference

addControl

public AddRequest addControl(Control control)
                      throws MessageException
Adds a control to this Message.

Specified by:
addControl in interface AddRequest
Specified by:
addControl in interface Message
Overrides:
addControl in class AbstractMessage
Parameters:
control - the control to add.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or the control is not known etc.

addAllControls

public AddRequest addAllControls(Control[] controls)
                          throws MessageException
Adds an array of controls to this Message.

Specified by:
addAllControls in interface AddRequest
Specified by:
addAllControls in interface Message
Overrides:
addAllControls in class AbstractMessage
Parameters:
controls - the controls to add.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or they are not known etc.

removeControl

public AddRequest removeControl(Control control)
                         throws MessageException
Deletes a control removing it from this Message.

Specified by:
removeControl in interface AddRequest
Specified by:
removeControl in interface Message
Overrides:
removeControl in class AbstractMessage
Parameters:
control - the control to remove.
Returns:
A Message reference
Throws:
MessageException - if controls cannot be added to this Message or the control is not known etc.

getResponseType

public MessageTypeEnum getResponseType()
Gets the protocol response message type for this request which produces at least one response.

Specified by:
getResponseType in interface SingleReplyRequest<AddResponse>
Returns:
the message type of the response.

getResultResponse

public AddResponse getResultResponse()
The result containing response for this request.

Specified by:
getResultResponse in interface ResultResponseRequest<AddResponse>
Returns:
the result containing response for this request

equals

public boolean equals(Object obj)
Checks to see if an object is equivalent to this AddRequest. First there's a quick test to see if the obj is the same object as this one - if so true is returned. Next if the super method fails false is returned. Then the name of the entry is compared - if not the same false is returned. Lastly the attributes of the entry are compared. If they are not the same false is returned otherwise the method exists returning true.

Overrides:
equals in class AbstractRequest
Parameters:
obj - the object to test for equality to this
Returns:
true if the obj is equal to this AddRequest, false otherwise

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractRequest
Returns:
the instance's hash code
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.