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 */ 028 029 030 031package com.sun.identity.policy; 032 033import java.util.*; 034 035/** 036 * This class <code>ValidValues</code> provides search results and a error 037 * code indicating if the search was successfully or time limit exceeded or 038 * search limit exceeded. 039 * 040 * @supported.all.api 041 */ 042public class ValidValues { 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 050 * as the size limit 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 056 * as the time limit exceeded during the search process. 057 */ 058 public static final int TIME_LIMIT_EXCEEDED = 2; 059 060 Set searchResults = null; // set contains the result entries 061 int errorCode; 062 063 /** 064 * Constructs a <code>ValidValues</code> given <code>errorCode</code> 065 * and a set of values 066 * 067 * @param errorCode error code 068 * @param results set of values to be included 069 * 070 * @see #SUCCESS 071 * @see #SIZE_LIMIT_EXCEEDED 072 * @see #TIME_LIMIT_EXCEEDED 073 */ 074 public ValidValues(int errorCode, Set results) { 075 searchResults = results; 076 this.errorCode = errorCode; 077 } 078 079 /** 080 * Returns the search results as a set. 081 * @return set of entries matching the search criteria. Each element in the 082 * Set is a String. 083 */ 084 public Set getSearchResults() { 085 return searchResults; 086 } 087 088 /** 089 * Returns the error code of search. 090 * @return Error code of search. The possible values are 091 * <code>SUCCESS</code>, <code>SIZE_LIMIT_EXCEEDED</code> 092 * and <code>TIME_LIMIT_EXCEEDED</code> 093 * @see #SUCCESS 094 * @see #SIZE_LIMIT_EXCEEDED 095 * @see #TIME_LIMIT_EXCEEDED 096 */ 097 public int getErrorCode() { 098 return errorCode; 099 } 100}