Class SearchResultEntryDecorator
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.api.MessageDecorator<SearchResultEntry>
-
- org.apache.directory.api.ldap.codec.decorators.SearchResultEntryDecorator
-
- All Implemented Interfaces:
Asn1Object
,Decorator<SearchResultEntry>
,Message
,Response
,SearchResultEntry
public class SearchResultEntryDecorator extends MessageDecorator<SearchResultEntry> implements SearchResultEntry
A decorator for the SearchResultEntry message- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description SearchResultEntryDecorator(LdapApiService codec, SearchResultEntry decoratedMessage)
Makes a SearchResultEntry encodable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(byte[] type)
Create a new attributevoid
addAttribute(String type)
Create a new attributevoid
addAttributeValue(Object value)
Add a new value to the current attributeint
computeLength()
Compute the SearchResultEntry length
SearchResultEntry :ByteBuffer
encode(ByteBuffer buffer)
Encode the SearchResultEntry message to a PDU.Attribute
getCurrentAttribute()
Entry
getEntry()
Gets the entry.Dn
getObjectName()
Gets the distinguished name of the entry object returned.void
setEntry(Entry entry)
Sets an entryvoid
setObjectName(Dn objectName)
Sets the distinguished name of the entry object returned.-
Methods inherited from class org.apache.directory.api.ldap.codec.api.MessageDecorator
addAllControls, addControl, get, getCodecService, getControl, getControls, getControlsLength, getCurrentControl, getDecorated, getDecorator, getMessageId, getMessageLength, getType, hasControl, put, removeControl, setControlsLength, setMessageId, 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.Message
addAllControls, addControl, get, getControl, getControls, getMessageId, getType, hasControl, put, removeControl, setMessageId
-
-
-
-
Constructor Detail
-
SearchResultEntryDecorator
public SearchResultEntryDecorator(LdapApiService codec, SearchResultEntry decoratedMessage)
Makes a SearchResultEntry encodable.- Parameters:
codec
- The LDAP service instancedecoratedMessage
- the decorated SearchResultEntry
-
-
Method Detail
-
getCurrentAttribute
public Attribute getCurrentAttribute()
- Returns:
- The current attribute
-
addAttribute
public void addAttribute(String type) throws LdapException
Create a new attribute- Parameters:
type
- The attribute's type- Throws:
LdapException
- If the value is invalid
-
addAttribute
public void addAttribute(byte[] type) throws LdapException
Create a new attribute- Parameters:
type
- The attribute's type- Throws:
LdapException
- If the value is invalid
-
addAttributeValue
public void addAttributeValue(Object value) throws LdapException
Add a new value to the current attribute- Parameters:
value
- The added value- Throws:
LdapException
- If the value is invalid
-
getObjectName
public Dn getObjectName()
Gets the distinguished name of the entry object returned.- Specified by:
getObjectName
in interfaceSearchResultEntry
- Returns:
- the Dn of the entry returned.
-
setObjectName
public void setObjectName(Dn objectName)
Sets the distinguished name of the entry object returned.- Specified by:
setObjectName
in interfaceSearchResultEntry
- Parameters:
objectName
- the Dn of the entry returned.
-
getEntry
public Entry getEntry()
Gets the entry.- Specified by:
getEntry
in interfaceSearchResultEntry
- Returns:
- the entry
-
setEntry
public void setEntry(Entry entry)
Sets an entry- Specified by:
setEntry
in interfaceSearchResultEntry
- Parameters:
entry
- the entry
-
computeLength
public int computeLength()
Compute the SearchResultEntry length
SearchResultEntry :0x64 L1 | +--> 0x04 L2 objectName +--> 0x30 L3 (attributes) | +--> 0x30 L4-1 (partial attributes list) | | | +--> 0x04 L5-1 type | +--> 0x31 L6-1 (values) | | | +--> 0x04 L7-1-1 value | +--> ... | +--> 0x04 L7-1-n value | +--> 0x30 L4-2 (partial attributes list) | | | +--> 0x04 L5-2 type | +--> 0x31 L6-2 (values) | | | +--> 0x04 L7-2-1 value | +--> ... | +--> 0x04 L7-2-n value | +--> ... | +--> 0x30 L4-m (partial attributes list) | +--> 0x04 L5-m type +--> 0x31 L6-m (values) | +--> 0x04 L7-m-1 value +--> ... +--> 0x04 L7-m-n value
- Specified by:
computeLength
in interfaceAsn1Object
- Returns:
- The object's computed length
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encode the SearchResultEntry message to a PDU.
SearchResultEntry :0x64 LL 0x04 LL objectName 0x30 LL attributes 0x30 LL partialAttributeList 0x04 LL type 0x31 LL vals 0x04 LL attributeValue ... 0x04 LL attributeValue ... 0x30 LL partialAttributeList 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
-
-