SearchControlspublic class SearchControls extends Object implements SerializableThis class encapsulates
factors that determine scope of search and what gets returned
as a result of the search.
A SearchControls instance is not synchronized against concurrent
multithreaded access. Multiple threads trying to access and modify
a single SearchControls instance should lock the object. |
Fields Summary |
---|
public static final int | OBJECT_SCOPESearch the named object.
The NamingEnumeration that results from search()
using OBJECT_SCOPE will contain one or zero element.
The enumeration contains one element if the named object satisfies
the search filter specified in search().
The element will have as its name the empty string because the names
of elements in the NamingEnumeration are relative to the
target context--in this case, the target context is the named object.
It contains zero element if the named object does not satisfy
the search filter specified in search().
The value of this constant is 0. | public static final int | ONELEVEL_SCOPESearch one level of the named context.
The NamingEnumeration that results from search()
using ONELEVEL_SCOPE contains elements with
objects in the named context that satisfy
the search filter specified in search().
The names of elements in the NamingEnumeration are atomic names
relative to the named context.
The value of this constant is 1. | public static final int | SUBTREE_SCOPESearch the entire subtree rooted at the named object.
If the named object is not a DirContext, search only the object.
If the named object is a DirContext, search the subtree
rooted at the named object, including the named object itself.
The search will not cross naming system boundaries.
The NamingEnumeration that results from search()
using SUBTREE_SCOPE contains elements of objects
from the subtree (including the named context)
that satisfy the search filter specified in search().
The names of elements in the NamingEnumeration are either
relative to the named context or is a URL string.
If the named context satisfies the search filter, it is
included in the enumeration with the empty string as
its name.
The value of this constant is 2. | private int | searchScopeContains the scope with which to apply the search. One of
ONELEVEL_SCOPE, OBJECT_SCOPE, or
SUBTREE_SCOPE. | private int | timeLimitContains the milliseconds to wait before returning
from search. | private boolean | derefLinkIndicates whether JNDI links are dereferenced during
search. | private boolean | returnObjIndicates whether object is returned in SearchResult. | private long | countLimitContains the maximum number of SearchResults to return. | private String[] | attributesToReturnContains the list of attributes to be returned in
SearchResult for each matching entry of search. null
indicates that all attributes are to be returned. | private static final long | serialVersionUIDUse serialVersionUID from JNDI 1.1.1 for interoperability. |
Constructors Summary |
---|
public SearchControls()Constructs a search constraints using defaults.
The defaults are:
- search one level
- no maximum return limit for search results
- no time limit for search
- return all attributes associated with objects that satisfy
the search filter.
- do not return named object (return only name and class)
- do not dereference links during search
searchScope = ONELEVEL_SCOPE;
timeLimit = 0; // no limit
countLimit = 0; // no limit
derefLink = false;
returnObj = false;
attributesToReturn = null; // return all
| public SearchControls(int scope, long countlim, int timelim, String[] attrs, boolean retobj, boolean deref)Constructs a search constraints using arguments.
searchScope = scope;
timeLimit = timelim; // no limit
derefLink = deref;
returnObj = retobj;
countLimit = countlim; // no limit
attributesToReturn = attrs; // return all
|
Methods Summary |
---|
public long | getCountLimit()Retrieves the maximum number of entries that will be returned
as a result of the search.
0 indicates that all entries will be returned.
return countLimit;
| public boolean | getDerefLinkFlag()Determines whether links will be dereferenced during the search.
return derefLink;
| public java.lang.String[] | getReturningAttributes()Retrieves the attributes that will be returned as part of the search.
A value of null indicates that all attributes will be returned.
An empty array indicates that no attributes are to be returned.
return attributesToReturn;
| public boolean | getReturningObjFlag()Determines whether objects will be returned as part of the result.
return returnObj;
| public int | getSearchScope()Retrieves the search scope of these SearchControls.
One of OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
return searchScope;
| public int | getTimeLimit()Retrieves the time limit of these SearchControls in milliseconds.
If the value is 0, this means to wait indefinitely.
return timeLimit;
| public void | setCountLimit(long limit)Sets the maximum number of entries to be returned
as a result of the search.
0 indicates no limit: all entries will be returned.
countLimit = limit;
| public void | setDerefLinkFlag(boolean on)Enables/disables link dereferencing during the search.
derefLink = on;
| public void | setReturningAttributes(java.lang.String[] attrs)Specifies the attributes that will be returned as part of the search.
null indicates that all attributes will be returned.
An empty array indicates no attributes are returned.
attributesToReturn = attrs;
| public void | setReturningObjFlag(boolean on)Enables/disables returning objects returned as part of the result.
If disabled, only the name and class of the object is returned.
If enabled, the object will be returned.
returnObj = on;
| public void | setSearchScope(int scope)Sets the search scope to one of:
OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE.
searchScope = scope;
| public void | setTimeLimit(int ms)Sets the time limit of these SearchControls in milliseconds.
If the value is 0, this means to wait indefinitely.
timeLimit = ms;
|
|