001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 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: ValidValues.java,v 1.2 2008/06/25 05:43:45 qcheng Exp $
026 *
027 * Portions Copyrighted 2014 ForgeRock AS.
028 */
029
030
031
032package com.sun.identity.policy;
033
034import java.util.*;
035
036/**
037 * This class <code>ValidValues</code> provides search results and a error 
038 * code indicating if the search was successfully or time limit exceeded or
039 * search limit exceeded.
040 *
041 * @supported.all.api
042 * @deprecated since 12.0.0
043 */
044@Deprecated
045public class ValidValues {
046    /**
047     * Code used to indicate a successful search
048     */   
049    public static final int SUCCESS = 0;
050
051    /**
052     * Code used to indicate that the search was unsuccessful 
053     *  as the size limit exceeded during the search process.
054     */   
055    public static final int SIZE_LIMIT_EXCEEDED = 1;
056
057    /**
058     * Code used to indicate that the search was unsuccessful 
059     *  as the time limit exceeded during the search process.
060     */   
061    public static final int TIME_LIMIT_EXCEEDED = 2;
062
063    Set searchResults = null; // set contains the result entries 
064    int errorCode;
065
066    /**
067     * Constructs a <code>ValidValues</code> given <code>errorCode</code>
068     * and a set of values 
069     *
070     * @param errorCode error code
071     * @param results set of values to be included 
072     *
073     * @see #SUCCESS
074     * @see #SIZE_LIMIT_EXCEEDED
075     * @see #TIME_LIMIT_EXCEEDED
076     */
077    public ValidValues(int errorCode, Set results) {
078        searchResults = results;
079        this.errorCode = errorCode;
080    }
081
082    /**
083     * Returns the search results as a set. 
084     * @return set of entries matching the search criteria. Each element in the
085     * Set is a String.
086     */
087    public Set getSearchResults() {
088        return searchResults;
089    }
090
091    /**
092     * Returns the error code of search. 
093     * @return Error code of search. The possible values are 
094     * <code>SUCCESS</code>, <code>SIZE_LIMIT_EXCEEDED</code>
095     * and <code>TIME_LIMIT_EXCEEDED</code>
096     * @see #SUCCESS
097     * @see #SIZE_LIMIT_EXCEEDED
098     * @see #TIME_LIMIT_EXCEEDED
099     */
100    public int getErrorCode() {
101        return errorCode;
102    }
103}