8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * opensso/legal/CDDLv1.0.txt
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at opensso/legal/CDDLv1.0.txt.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: AMSearchControl.java,v 1.4 2008/06/25 05:41:22 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.iplanet.am.sdk;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport java.util.Set;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.iplanet.ums.SearchControl;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This class provides a way to customize Search behaviors. Common behaviors are
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * time limit, result limit and Virtual list view. In future, we will provide
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * ways for client to define different hierarchical tree through
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchControl</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @deprecated As of Sun Java System Access Manager 7.1.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @supported.all.api
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class AMSearchControl {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private SearchControl searchControl;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private Set returnAttributes = null;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Disabled by default
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static boolean getAllAttributesEnabled = false;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Creates the <code>AMSearchControl</code> object
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public AMSearchControl() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl = new SearchControl();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected SearchControl getSearchControl() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set the return attribute names, if attributes of the entries need to be
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * obtained as part of the search.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * NOTE: If the return attribute values are specified as part of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchControl</code>, there could be a significant performance
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * overhead compared to when none are specified. When the return attributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * are set, the return attributes can be obtained as a map with DN as
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * map-key and set of attribute values as map-value from
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchResults</code> object.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param attributeNames
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set of attribute names whose values need to be obtained as
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * part of the search.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setReturnAttributes(Set attributeNames) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster returnAttributes = attributeNames;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the list of attributes requested to be read when the search is
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * performed.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return list of attributes requested to be read.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String[] getReturnAttributes() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String returnAttrs[] = null;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (returnAttributes != null && !returnAttributes.isEmpty()) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster returnAttrs = (String[]) returnAttributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster .toArray(new String[returnAttributes.size()]);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return returnAttrs;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets the specified boolean value to the variable. Boolean value is set to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * true, if all attributes of the entries need to be obtained as part of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * search.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * NOTE: If this <code>getAllReturnAttributes</code> boolean is set to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * true as part of <code>AMSearchControl</code>, it overrides any other
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>setReturnAttributes</code> set as part of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchControl</code>. This is similar to using a wildcard '*'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * in search.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When the option for getting all attributes is set to true, the search
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * results will return a Map, where the Key is the DN of the search results,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * and value is another Map of attribute names for keys and Sets for values
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of those attributes.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param getAllAttributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Boolean value set to true as part of the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchControl</code> to obtain all attributes as
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * part of the search.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setAllReturnAttributes(boolean getAllAttributes) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SearchControl sc = getSearchControl();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sc.setAllReturnAttributes(getAllAttributes);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster getAllAttributesEnabled = getAllAttributes;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns true if the option for getting all attributes has been enabled.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return true if the option for getting all attributes has been enabled.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public boolean isGetAllReturnAttributesEnabled() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return getAllAttributesEnabled;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set sort order based on attribute names.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param attributeNames
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * array of attribute names to sort on
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setSortKeys(String[] attributeNames) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl.setSortKeys(attributeNames);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set range for retrieving VLV data.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param startIndex
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * starting position.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param beforeCount
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Number of entries before the <code>startIndex</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param afterCount
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Number of entries after the <code>startIndex</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected void setVLVRange(int startIndex, int beforeCount, int afterCount)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl.setVLVRange(startIndex, beforeCount, afterCount);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Set range for retrieving VLV data.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param jumpTo
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Search expression defining the result set return.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param beforeCount
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Number of entries before the <code>startIndex</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param afterCount
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Number of entries after the <code>startIndex</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected void setVLVRange(String jumpTo, int beforeCount, int afterCount)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl.setVLVRange(jumpTo, beforeCount, afterCount);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Get range for current VLV setting.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return array of integers which contain <code>startIndex</code>,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>beforeCount</code> and <code>afterCount</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected int[] getVLVRange() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl.getVLVRange();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns <code>jumpTo</code> value for VLV range.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return <code>jumpTo</code> value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected String getVLVJumpTo() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl.getVLVJumpTo();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets the maximum number of milliseconds to wait for any operation for the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * search.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param timeOut
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Max number of milliseconds
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setTimeOut(int timeOut) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl.setTimeOut(timeOut);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns current time out setting.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return current time out setting.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public int getTimeOut() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl.getTimeOut();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets the maximum number of search results to return; 0 means there is no
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * limit.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param maxNumber
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Max number of results
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setMaxResults(int maxNumber) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl.setMaxResults(maxNumber);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns the maximum number of search results. return 0 means there is no
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * limit.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return the maximum number of search results.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public int getMaxResults() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl.getMaxResults();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets the search scope in <code>AMSearchControl</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param scope
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Search scope defined in the <code>AMSearchControl</code> to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * be used with the search API
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setSearchScope(int scope) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster searchControl.setSearchScope(scope);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the search scope defined in the <code>AMSearchControl</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return search scope defined in the <code>AMSearchControl</code>. If
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * search scope is never defined in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchControl</code> <code>SCOPE_SUB</code> for
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * subtree type of search is assumed.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public int getSearchScope() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl.getSearchScope();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the search scope defined in the <code>AMSearchControl</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Allows a user to specify default search scope if nothing has been defined
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * in the <code>AMSearchControl</code> yet.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param defaultScope
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Scope value to be used in case the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMSearchControl</code> is not set up with a search
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * scope
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return Search scope defined in the <code>AMSearchControl</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Return <code>defaultScope</code> if scope is not defined in the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * control.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public int getSearchScope(int defaultScope) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return searchControl.getSearchScope(defaultScope);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}