Package com.iplanet.ums
Class SearchControl
- java.lang.Object
-
- com.iplanet.ums.SearchControl
-
- All Implemented Interfaces:
Serializable
public class SearchControl extends Object implements Serializable
This class provides a way to customize Search behaviors. Common behaviors are time limit, result limit and Virtual list view. In future, we will provide ways for client to define different hierarchical tree through SearchControl.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intSCOPE_BASESearch scope for just this object.static intSCOPE_ONESearch scope for one level.static intSCOPE_SUBSearch scope for subtree level.
-
Constructor Summary
Constructors Constructor Description SearchControl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancontains(String name)Checks if an internal attribute is defined for the controlprotected Objectget(String name)Gets internal attribute defined in SearchControlintgetMaxResults()Gets the maximum number of search results to return. return 0 means there is no limit.intgetSearchScope()Gets the search scope defined in the SearchControl.intgetSearchScope(int defaultScope)Gets the search scope defined in the SearchControl.SortKey[]getSortKeys()Get existing attribute names for sorting.intgetTimeOut()Get current time out setting.StringgetVLVJumpTo()Get jumpTo value for VLV range.int[]getVLVRange()Get range for current VLV setting.booleanisGetAllReturnAttributesEnabled()Method to check if the boolean getAllAttributesEnabled is enabled or disabled.protected voidset(String name, Object o)Sets internal attribute value in SearchControlvoidsetAllReturnAttributes(boolean getAllAttributes)Sets the specified boolean value to the variable.voidsetMaxResults(int maxNumber)Sets the maximum number of search results to return; 0 means there is no limit.voidsetSearchScope(int scope)Sets the search scope in SearchControl.voidsetSortKeys(SortKey[] sortKeys)Set sort order based on SortKeyvoidsetSortKeys(String[] attributeNames)Set sort order based on attribute names.voidsetTimeOut(int timeOut)Sets the maximum number of milliseconds to wait for any operation for the search.voidsetVLVRange(int startIndex, int beforeCount, int afterCount)Set range for retrieving VLV data.voidsetVLVRange(String jumpTo, int beforeCount, int afterCount)Set range for retrieving VLV data.
-
-
-
Field Detail
-
SCOPE_ONE
public static final int SCOPE_ONE
Search scope for one level. You use this search scope in getting immediate children of a container. This is the default search scope in getChildren method in search API. One can use SearchControl.setSearchScope to override the default search scope in getChildren.
-
SCOPE_SUB
public static final int SCOPE_SUB
Search scope for subtree level. This scope is used as the default search scope in the search API. One can use SearchControl.setSearchScope to override the default search scope in search methods.
-
SCOPE_BASE
public static final int SCOPE_BASE
Search scope for just this object.
-
-
Method Detail
-
setSortKeys
public void setSortKeys(String[] attributeNames)
Set sort order based on attribute names.- Parameters:
attributeNames- array of attribute names to sort on
-
setSortKeys
public void setSortKeys(SortKey[] sortKeys)
Set sort order based on SortKey- Parameters:
sortKeys- array of SortKey.
-
getSortKeys
public SortKey[] getSortKeys()
Get existing attribute names for sorting.
-
setVLVRange
public void setVLVRange(int startIndex, int beforeCount, int afterCount)Set range for retrieving VLV data.- Parameters:
startIndex- starting positionbeforeCount- Number of entries before the startIndexafterCount- Number of entries after the startIndex.
-
setVLVRange
public void setVLVRange(String jumpTo, int beforeCount, int afterCount)
Set range for retrieving VLV data.- Parameters:
jumpTo- Search expression defining the result set returnbeforeCount- Number of entries before the startIndexafterCount- Number of entries after the startIndex.
-
getVLVRange
public int[] getVLVRange()
Get range for current VLV setting.- Returns:
- array of int which contain startIndex, beforeCount and afterCount.
-
getVLVJumpTo
public String getVLVJumpTo()
Get jumpTo value for VLV range.- Returns:
- jumpTo value.
-
setTimeOut
public void setTimeOut(int timeOut)
Sets the maximum number of milliseconds to wait for any operation for the search.- Parameters:
timeOut- Max number of milliseconds.
-
getTimeOut
public int getTimeOut()
Get current time out setting.
-
setMaxResults
public void setMaxResults(int maxNumber)
Sets the maximum number of search results to return; 0 means there is no limit.
-
getMaxResults
public int getMaxResults()
Gets the maximum number of search results to return. return 0 means there is no limit.
-
setSearchScope
public void setSearchScope(int scope)
Sets the search scope in SearchControl.- Parameters:
scope- Search scope defined in the SearchControl to be used with the search API.
-
getSearchScope
public int getSearchScope()
Gets the search scope defined in the SearchControl.- Returns:
- search scope defined in the SearchControl. If search scope is never defined in the SearchControl SCOPE_SUB for subtree type of search is assumed.
-
getSearchScope
public int getSearchScope(int defaultScope)
Gets the search scope defined in the SearchControl. Allow user to specify default search scope if nothing has been defined in the SearchControl yet.- Parameters:
defaultScope- Scope value to be used in case the SearchControl is not set up with a search scope- Returns:
- Search scope defined in the SearchControl. Return defaultScope if scope is not defined in the control.
-
get
protected Object get(String name)
Gets internal attribute defined in SearchControl- Parameters:
name- Name of attribute to get- Returns:
- Object representing the value of the attribute. Return null object if the given attribute name is not found
-
contains
protected boolean contains(String name)
Checks if an internal attribute is defined for the control- Parameters:
name- Name of internal attribute to check against- Returns:
trueif internal attribute is defined in the control andfalseotherwise
-
setAllReturnAttributes
public void setAllReturnAttributes(boolean getAllAttributes)
Sets the specified boolean value to the variable. Boolean value is set to true, if all attributes of the entries need to be obtained as part of the search. NOTE: If this getAllReturnAttributes boolean is set to true as part of AMSearchControl, it overrides any other setReturnAttributes set as part of the AMSearchControl. This is similar to using a wildcard '*' in search. When all the return attributes are set, the return attributes can be obtained as a map with DN as map-key and set of attribute values as map-value from AMSearchResults object.- Parameters:
getAllAttributes- Boolean value set to true as part of the AMSearchControl to obtain all attributes as part of the search.
-
isGetAllReturnAttributesEnabled
public boolean isGetAllReturnAttributesEnabled()
Method to check if the boolean getAllAttributesEnabled is enabled or disabled.- Returns:
- Returns the value of the boolean getAllAttributesEnabled. Returns true or false.
-
-