1 /*
2 * Copyright (c) 2001 - 2005 ivata limited.
3 * All rights reserved.
4 * -----------------------------------------------------------------------------
5 * ivata masks may be redistributed under the GNU General Public
6 * License as published by the Free Software Foundation;
7 * version 2 of the License.
8 *
9 * These programs are free software; you can redistribute them and/or
10 * modify them under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; version 2 of the License.
12 *
13 * These programs are distributed in the hope that they will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * See the GNU General Public License in the file LICENSE.txt for more
18 * details.
19 *
20 * If you would like a copy of the GNU General Public License write to
21 *
22 * Free Software Foundation, Inc.
23 * 59 Temple Place - Suite 330
24 * Boston, MA 02111-1307, USA.
25 *
26 *
27 * To arrange commercial support and licensing, contact ivata at
28 * http://www.ivata.com/contact.jsp
29 * -----------------------------------------------------------------------------
30 * $Log: ValidationException.java,v $
31 * Revision 1.2 2005/04/09 18:04:16 colinmacleod
32 * Changed copyright text to GPL v2 explicitly.
33 *
34 * Revision 1.1 2005/03/10 10:25:13 colinmacleod
35 * Moved from ivata groupware to ivata masks.
36 *
37 * Revision 1.6 2004/12/23 21:01:27 colinmacleod
38 * Updated Struts to v1.2.4.
39 * Changed base classes to use ivata masks.
40 *
41 * Revision 1.5 2004/11/12 15:57:10 colinmacleod
42 * Removed dependencies on SSLEXT.
43 * Moved Persistence classes to ivata masks.
44 *
45 * Revision 1.4 2004/07/13 19:42:43 colinmacleod
46 * Moved project to POJOs from EJBs.
47 * Applied PicoContainer to services layer (replacing session EJBs).
48 * Applied Hibernate to persistence layer (replacing entity EJBs).
49 *
50 * Revision 1.3 2004/03/21 21:16:23 colinmacleod
51 * Shortened name to ivata op.
52 *
53 * Revision 1.2 2004/02/01 22:07:29 colinmacleod
54 * Added full names to author tags
55 *
56 * Revision 1.1 2004/01/29 13:48:41 janboros
57 * Moved ivata openportal to SourceForge.
58 *
59 * Revision 1.1 2003/10/16 07:27:45 colin
60 * Moved to new CVS repository.
61 *
62 * Revision 1.3 2003/02/21 08:52:26 colin
63 * changed to implement Serializable
64 *
65 * Revision 1.2 2003/02/20 20:48:31 colin
66 * made it extend RuntimeException
67 *
68 * Revision 1.8 2003/02/20 20:27:36 colin
69 * improved validation by adding ValidationField and ValidationException
70 *
71 * Revision 1.1 2003/02/20 20:24:11 colin
72 * improved validation by adding ValidationField and ValidationException
73 * -----------------------------------------------------------------------------
74 */
75 package com.ivata.mask.validation;
76
77 import com.ivata.mask.util.SystemException;
78
79 /***
80 * <p>An instance of this class is thrown by <i>ivata groupware</i>
81 * server-side methods when an error occurs that prevents the method
82 * from continuing.</p>
83 *
84 * @since ivata masks 0.5 (2003-02-20)
85 * @author Colin MacLeod
86 * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
87 * @version $Revision: 1.2 $
88 * @see ValidationErrors
89 * @see org.apache.struts.action.ActionMessage
90 */
91 public class ValidationException extends SystemException {
92 /***
93 * <p>Contains all of the errors which caused this exception to
94 * happen.</p>
95 */
96 private ValidationErrors errors;
97
98 /***
99 * <p>Creates a validation exception.</p>
100 *
101 * @param error error which caused the exception to occur.
102 */
103 public ValidationException(ValidationError error) {
104 super("ValidationException: "
105 + error);
106
107 errors = new ValidationErrors();
108 errors.add(error);
109 }
110
111 /***
112 * <p>Creates a validation exception.</p>
113 *
114 * @param errors errors which caused the exception to occur.
115 */
116 public ValidationException(ValidationErrors errors) {
117 super("ValidationException: "
118 + errors);
119 this.errors = errors;
120 }
121
122 /***
123 * <p>Contains all of the errors which caused this exception to
124 * happen.</p>
125 *
126 * @return the current value of errors.
127 */
128 public ValidationErrors getErrors() {
129 return errors;
130 }
131 }