Package org.ldaptive
Class SearchRequest
java.lang.Object
org.ldaptive.AbstractRequestMessage
org.ldaptive.SearchRequest
- All Implemented Interfaces:
Request
LDAP search request defined as:
SearchRequest ::= [APPLICATION 3] SEQUENCE {
baseObject LDAPDN,
scope ENUMERATED {
baseObject (0),
singleLevel (1),
wholeSubtree (2),
... },
aliases ENUMERATED {
neverDerefAliases (0),
derefInSearching (1),
derefFindingBaseObj (2),
derefAlways (3) },
sizeLimit INTEGER (0 .. maxInt),
timeLimit INTEGER (0 .. maxInt),
typesOnly BOOLEAN,
filter Filter,
attributes AttributeSelection }
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.ldaptive.AbstractRequestMessage
AbstractRequestMessage.AbstractBuilder<B,T extends AbstractRequestMessage> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringBase DN.private String[]Binary attribute names used to convey attributes that should be treated as binary when a response is received for this request.private DerefAliasesDeref aliases.private static final inthash code seed.static final intBER protocol number.private String[]Return attributes.private FilterSearch filter.private SearchScopeSearch scope.private intSize limit.private DurationTime limit.private booleanTypes only.Fields inherited from class org.ldaptive.AbstractRequestMessage
logger -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SearchRequest(String dn) Creates a new search request.SearchRequest(String dn, String filter) Creates a new search request.SearchRequest(String dn, String filter, String... attributes) Creates a new search request.SearchRequest(String dn, Filter filter, String... attributes) Creates a new search request.SearchRequest(String dn, FilterTemplate template, String... attributes) Creates a new search request.SearchRequest(String dn, SearchScope scope, DerefAliases aliases, int size, Duration time, boolean types, Filter filter, String... attributes) Creates a new search request. -
Method Summary
Modifier and TypeMethodDescriptionstatic SearchRequest.Builderbuilder()Creates a builder for this class.static SearchRequest.Builderbuilder(SearchRequest request) Creates a builder for this class.voidInvokesLdapAttribute.configureBinary(String...)for each attribute in the supplied entry usingbinaryAttributes.static SearchRequestcopy(SearchRequest request) Returns a new search request with the same properties as the supplied request.static SearchRequestcopy(SearchRequest request, boolean deep) Returns a new search request with the same properties as the supplied request.booleanReturns the base DN.String[]Returns names of binary attributes.Returns how to dereference aliases.Returns the search filter.protected DEREncoder[]getRequestEncoders(int id) Returns the request encoders for this message.String[]Returns the search return attributes.Gets the search scope.intReturns the size limit.Returns the time limit.inthashCode()booleanReturns whether to return only attribute types.static SearchRequestReturns a search request initialized for use with an object level search scope.static SearchRequestobjectScopeSearchRequest(String dn, String[] attrs) Returns a search request initialized for use with an object level search scope.static SearchRequestobjectScopeSearchRequest(String dn, String[] attrs, String filter) Returns a search request initialized for use with an object level search scope.static SearchRequestobjectScopeSearchRequest(String dn, String[] attrs, Filter filter) Returns a search request initialized for use with an object level search scope.static SearchRequestobjectScopeSearchRequest(String dn, String[] attrs, FilterTemplate template) Returns a search request initialized for use with an object level search scope.voidSets the base DN.voidsetBinaryAttributes(String... attrs) Sets names of binary attributes.voidsetDerefAliases(DerefAliases aliases) Sets how to dereference aliases.voidSets the search filter.voidSets the search filter.voidsetFilter(FilterTemplate template) Sets the search filter.voidsetReturnAttributes(String... attributes) Sets the search return attributes.voidsetSearchScope(SearchScope scope) Sets the search scope.voidsetSizeLimit(int limit) Sets the size limit.voidsetTimeLimit(Duration limit) Sets the time limit.voidsetTypesOnly(boolean types) Sets whether to return only attribute types.toString()Methods inherited from class org.ldaptive.AbstractRequestMessage
encode, getControls, getResponseTimeout, setControls, setResponseTimeout
-
Field Details
-
PROTOCOL_OP
public static final int PROTOCOL_OPBER protocol number.- See Also:
-
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
baseDn
Base DN. -
searchScope
Search scope. -
derefAliases
Deref aliases. -
sizeLimit
private int sizeLimitSize limit. -
timeLimit
Time limit. -
typesOnly
private boolean typesOnlyTypes only. -
searchFilter
Search filter. -
returnAttributes
Return attributes. -
binaryAttributes
Binary attribute names used to convey attributes that should be treated as binary when a response is received for this request. This property is not part of the request specification. SeeLdapAttribute.isBinary().
-
-
Constructor Details
-
SearchRequest
public SearchRequest()Default constructor. -
SearchRequest
Creates a new search request.- Parameters:
dn- base DN
-
SearchRequest
Creates a new search request.- Parameters:
dn- base DNfilter- search filter
-
SearchRequest
Creates a new search request.- Parameters:
dn- base DNfilter- search filterattributes- return attributes
-
SearchRequest
Creates a new search request.- Parameters:
dn- base DNtemplate- filter templateattributes- return attributes
-
SearchRequest
Creates a new search request.- Parameters:
dn- base DNfilter- search filterattributes- return attributes
-
SearchRequest
public SearchRequest(String dn, SearchScope scope, DerefAliases aliases, int size, Duration time, boolean types, Filter filter, String... attributes) Creates a new search request.- Parameters:
dn- base DNscope- search scopealiases- deref aliasessize- size limittime- time limittypes- types onlyfilter- search filterattributes- return attributes
-
-
Method Details
-
getBaseDn
Returns the base DN.- Returns:
- base DN
-
setBaseDn
Sets the base DN.- Parameters:
dn- base DN
-
getSearchScope
Gets the search scope.- Returns:
- search scope
-
setSearchScope
Sets the search scope.- Parameters:
scope- search scope
-
getDerefAliases
Returns how to dereference aliases.- Returns:
- how to dereference aliases
-
setDerefAliases
Sets how to dereference aliases.- Parameters:
aliases- how to dereference aliases
-
getSizeLimit
public int getSizeLimit()Returns the size limit.- Returns:
- size limit
-
setSizeLimit
public void setSizeLimit(int limit) Sets the size limit.- Parameters:
limit- size limit- Throws:
IllegalArgumentException- if limit is negative
-
getTimeLimit
Returns the time limit.- Returns:
- time limit
-
setTimeLimit
Sets the time limit.- Parameters:
limit- time limit- Throws:
IllegalArgumentException- if limit is null or negative
-
isTypesOnly
public boolean isTypesOnly()Returns whether to return only attribute types.- Returns:
- whether to return only attribute types
-
setTypesOnly
public void setTypesOnly(boolean types) Sets whether to return only attribute types.- Parameters:
types- whether to return only attribute types
-
getFilter
Returns the search filter.- Returns:
- search filter
-
setFilter
Sets the search filter.- Parameters:
filter- search filter
-
setFilter
Sets the search filter. SeeFilterParser.parse(String).- Parameters:
filter- search filter- Throws:
IllegalArgumentException- if the filter cannot be parsed
-
setFilter
Sets the search filter. SeeFilterTemplateandFilterParser.parse(String).- Parameters:
template- filter template- Throws:
IllegalArgumentException- if the filter cannot be parsed
-
getReturnAttributes
Returns the search return attributes.- Returns:
- search return attributes
-
setReturnAttributes
Sets the search return attributes.- Parameters:
attributes- search return attributes
-
getBinaryAttributes
Returns names of binary attributes.- Returns:
- binary attribute names
-
setBinaryAttributes
Sets names of binary attributes.- Parameters:
attrs- binary attribute names
-
configureBinaryAttributes
InvokesLdapAttribute.configureBinary(String...)for each attribute in the supplied entry usingbinaryAttributes.- Parameters:
entry- to configure binary attributes for
-
getRequestEncoders
Description copied from class:AbstractRequestMessageReturns the request encoders for this message.- Specified by:
getRequestEncodersin classAbstractRequestMessage- Parameters:
id- message ID- Returns:
- request encoders
-
equals
-
hashCode
public int hashCode() -
toString
- Overrides:
toStringin classAbstractRequestMessage
-
objectScopeSearchRequest
Returns a search request initialized for use with an object level search scope.- Parameters:
dn- of an ldap entry- Returns:
- search request
-
objectScopeSearchRequest
Returns a search request initialized for use with an object level search scope.- Parameters:
dn- of an ldap entryattrs- to return- Returns:
- search request
-
objectScopeSearchRequest
Returns a search request initialized for use with an object level search scope.- Parameters:
dn- of an ldap entryattrs- to returnfilter- to execute on the ldap entry- Returns:
- search request
- Throws:
IllegalArgumentException- if the filter cannot be parsed
-
objectScopeSearchRequest
public static SearchRequest objectScopeSearchRequest(String dn, String[] attrs, FilterTemplate template) Returns a search request initialized for use with an object level search scope.- Parameters:
dn- of an ldap entryattrs- to returntemplate- to execute on the ldap entry- Returns:
- search request
- Throws:
IllegalArgumentException- if the filter cannot be parsed
-
objectScopeSearchRequest
Returns a search request initialized for use with an object level search scope.- Parameters:
dn- of an ldap entryattrs- to returnfilter- to execute on the ldap entry- Returns:
- search request
-
copy
Returns a new search request with the same properties as the supplied request.- Parameters:
request- to copy- Returns:
- copy of the supplied search request
-
copy
Returns a new search request with the same properties as the supplied request.- Parameters:
request- to copydeep- whether to make a deep copy of this search request- Returns:
- copy of the supplied search request
-
builder
Creates a builder for this class.- Returns:
- new builder
-
builder
Creates a builder for this class.- Parameters:
request- search request to initialize the builder with- Returns:
- new builder
-