View Javadoc

1   /*
2    * $Id: InvalidParametersException.java 129 2004-11-27 22:14:22Z josem $
3    *
4    * Tarsis
5    * Copyright (C) 2002 Talika Open Source Group
6    *
7    * This program is free software; you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation; either version 2 of the License, or
10   * (at your option) any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program; if not, write to the Free Software
19   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20   *
21   */
22  
23  package org.talika.tarsis.filters.validator;
24  
25  import java.util.Collection;
26  import java.util.Map;
27  import java.util.Collections;
28  
29  import org.talika.tarsis.error.UserException;
30  
31  /**
32   * Thrown by <code>ValidatorFilter</code> to transport all invalid parameter
33   * exceptions as one unique exception.
34   *
35   * @author  Jose M. Palomar
36   * @version $Revision: 129 $
37   */
38  public class InvalidParametersException extends UserException {
39  
40      // Fields
41      /**
42       * Collection of <code>RequiredParameterException</code> exceptions.
43       */
44      private Collection missingParameters;
45  
46      /**
47       * Map of <code>InvalidValueException</code> exceptions.
48       */
49      private Map invalidValueParameters;
50  
51      // Constructors
52      /**
53       * Constructs a new <code>InvalidParametersException</code> exception.
54       *
55       * @param msg String text of the exception message.
56       * @param missingParameters Collection <code>RequiredParameterException</code>
57       * exceptions.
58       * @param invalidValueParameters Map <code>InvalidValueException</code>
59       * exceptions.
60       */
61      public InvalidParametersException(String msg, Collection missingParameters,
62      Map invalidValueParameters) {
63          super(msg);
64          this.missingParameters = missingParameters;
65          this.invalidValueParameters = invalidValueParameters;
66      }
67  
68      // Method
69      /**
70       * Returns a collection of <code>RequiredParameterException</code> exceptions.
71       *
72       * @return Collection <code>RequiredParameterException</code> exceptions.
73       */
74      public Collection getMissingParameters() {
75          return Collections.unmodifiableCollection(missingParameters);
76      }
77  
78      /**
79       * Returns a map of <code>InvalidValueException</code> exceptions.
80       *
81       * @return Map <code>InvalidValueException</code> exceptions.
82       */
83      public Map getInvalidValueParameters() {
84          return Collections.unmodifiableMap(invalidValueParameters);
85      }
86  
87  }