001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: AMSearchResults.java,v 1.4 2008/06/25 05:41:22 qcheng Exp $
026 *
027 */
028
029package com.iplanet.am.sdk;
030
031import java.util.Map;
032import java.util.Set;
033
034/**
035 * This class <code>AMSearchResults</code> provides to obtain the search
036 * results.
037 *
038 * @deprecated  As of Sun Java System Access Manager 7.1.
039 * @supported.all.api
040 */
041public class AMSearchResults {
042
043    /**
044     * Code used to indicate a successful search
045     */
046    public static final int SUCCESS = 0;
047
048    /**
049     * Code used to indicate that the search was unsuccessful as the size limit
050     * exceeded during the search process.
051     */
052    public static final int SIZE_LIMIT_EXCEEDED = 1;
053
054    /**
055     * Code used to indicate that the search was unsuccessful as the time limit
056     * exceeded during the search process.
057     */
058    public static final int TIME_LIMIT_EXCEEDED = 2;
059
060    /**
061     * Value returned when the total number of search results could not be
062     * obtained.
063     */
064    public static final int UNDEFINED_RESULT_COUNT = -1;
065
066    protected int vlvResponseCount; // Holds the total result count
067
068    protected Set searchResults = null; // Ordered set contain the
069
070    // result DN's
071    protected Map resultsMap = null; // Contains result of DN's and
072
073    // the attributes requested as part
074    // of the search
075    protected int errorCode;
076
077    /**
078     * Constructs the <code>AMSearchResults</code> object.
079     * 
080     * @param count
081     *            Number of entries
082     * @param results
083     *            Set of <code> DNs </code> from the search
084     * @param errorCode
085     *            Error Code
086     * @param map
087     *            Map of attributes and values if requested for
088     */
089    public AMSearchResults(int count, Set results, int errorCode, Map map) {
090        vlvResponseCount = count;
091        searchResults = results;
092        this.errorCode = errorCode;
093        resultsMap = map;
094    }
095
096    /**
097     * Method which returns the search results as a map containing DN's as key
098     * and the attribute value String. The attribute value
099     * 
100     * @return Map containing DN's as the key and Maps of attribute-values of
101     *         the attributes specified as part of the search. The Maps contains
102     *         attribute names as keys and Set containing values of those
103     *         attributes. Returns an empty Map if no attributes were specified
104     *         as part of search request.
105     */
106    public Map getResultAttributes() {
107        return resultsMap;
108    }
109
110    /**
111     * Method which returns the search results as an ordered set.
112     * 
113     * @return Set of DNs of matching the search criteria
114     */
115    public Set getSearchResults() {
116        return searchResults;
117    }
118
119    /**
120     * Method which returns the count of the all the results which match the
121     * search criteria.
122     * 
123     * @return total count of results matching the VLV search. Other wise
124     *         returns UNDEFINED_RESULT_COUNT
125     * @see #UNDEFINED_RESULT_COUNT
126     */
127    public int getTotalResultCount() {
128        return vlvResponseCount;
129    }
130
131    /**
132     * Method which returns the error code of search.
133     * 
134     * @return Error code of search. The possible values are
135     *         <code>SUCCESS</code>, <code>SIZE_LIMIT_EXCEEDED</code> and
136     *         <code>TIME_LIMIT_EXCEEDED</code>
137     * @see #SUCCESS
138     * @see #SIZE_LIMIT_EXCEEDED
139     * @see #TIME_LIMIT_EXCEEDED
140     */
141    public int getErrorCode() {
142        return errorCode;
143    }
144}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.