|
Spring LDAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.ldap.query.LdapQueryBuilder
public final class LdapQueryBuilder
Builder of LdapQueries. Start with a call to query()
, proceed with specifying the
basic search configuration (e.g. search base, time limit, etc.), finally specify the actual query.
Example:
import static org.springframework.ldap.query.LdapQueryBuilder.query; ... LdapQuery query = query() .base("dc=261consulting, dc=com") .searchScope(SearchScope.ONELEVEL) .timeLimit(200) .countLimit(221) .where("objectclass").is("person").and("cn").is("John Doe");
Default configuration is that base path is LdapUtils.emptyLdapName()
.
All other parameters are undefined, meaning that (in the case of base search parameters), the LdapTemplate
defaults will be used. Filter conditions must always be specified.
SearchControls
,
LdapOperations.search(LdapQuery, org.springframework.ldap.core.AttributesMapper)
,
LdapOperations.search(LdapQuery, org.springframework.ldap.core.ContextMapper)
,
LdapOperations.searchForObject(LdapQuery, org.springframework.ldap.core.ContextMapper)
,
LdapOperations.searchForContext(LdapQuery)
Method Summary | |
---|---|
String[] |
attributes()
Get the attributes to return. |
LdapQueryBuilder |
attributes(String... attributesToReturn)
|
Name |
base()
Get the search base. |
LdapQueryBuilder |
base(Name baseDn)
Set the base search path for the query. |
LdapQueryBuilder |
base(String baseDn)
Set the base search path for the query. |
Integer |
countLimit()
Get the count limit. |
LdapQueryBuilder |
countLimit(int countLimit)
Set the count limit for the query. |
Filter |
filter()
Get the filter. |
LdapQuery |
filter(Filter filter)
|
LdapQuery |
filter(String hardcodedFilter)
Specify a hardcoded filter. |
LdapQuery |
filter(String filterFormat,
Object... params)
Specify a hardcoded filter using the specified parameters. |
static LdapQueryBuilder |
query()
Construct a new LdapQueryBuilder. |
SearchScope |
searchScope()
Get the search scope. |
LdapQueryBuilder |
searchScope(SearchScope searchScope)
Set the search scope for the query. |
Integer |
timeLimit()
Get the time limit. |
LdapQueryBuilder |
timeLimit(int timeLimit)
Set the time limit for the query. |
ConditionCriteria |
where(String attribute)
Start specifying the filter conditions in this query. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static LdapQueryBuilder query()
public LdapQueryBuilder base(String baseDn)
LdapUtils.emptyLdapName()
.
baseDn
- the base search path.
public LdapQueryBuilder base(Name baseDn)
LdapUtils.emptyLdapName()
.
baseDn
- the base search path.
public LdapQueryBuilder searchScope(SearchScope searchScope)
SearchScope.SUBTREE
.
searchScope
- the search scope.
public LdapQueryBuilder countLimit(int countLimit)
countLimit
- the count limit.
public LdapQueryBuilder attributes(String... attributesToReturn)
public LdapQueryBuilder timeLimit(int timeLimit)
timeLimit
- the time limit.
public ConditionCriteria where(String attribute)
attribute
- The attribute that the first part of the filter should test against.
IllegalStateException
- if a filter has already been specified.public LdapQuery filter(String hardcodedFilter)
where(String)
or filter(String, Object...)
instead.
hardcodedFilter
- The hardcoded filter string to use in the search.
IllegalStateException
- if a filter has already been specified.public LdapQuery filter(Filter filter)
public LdapQuery filter(String filterFormat, Object... params)
LdapEncoder.filterEncode(String)
to make sure no malicious data gets through. The filterFormat
String should be formatted for input to MessageFormat.format(String, Object...)
.
filterFormat
- the filter format string, formatted for input to MessageFormat.format(String, Object...)
.params
- the parameters that will be used for building the final filter. All parameters will be properly encoded.
IllegalStateException
- if a filter has already been specified.public Name base()
LdapQuery
LdapUtils.emptyLdapName()
.
base
in interface LdapQuery
public SearchScope searchScope()
LdapQuery
null
, indicating that the LdapTemplate default should be used.
searchScope
in interface LdapQuery
public Integer countLimit()
LdapQuery
null
, indicating that the LdapTemplate default should be used.
countLimit
in interface LdapQuery
public Integer timeLimit()
LdapQuery
null
, indicating that the LdapTemplate default should be used.
timeLimit
in interface LdapQuery
public String[] attributes()
LdapQuery
null
, indicating that all attributes should be returned.
attributes
in interface LdapQuery
public Filter filter()
LdapQuery
filter
in interface LdapQuery
|
Spring LDAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |