1 /*
2 * The SmartWeb Framework
3 * Copyright (C) 2004-2006
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * For further informations on the SmartWeb Framework please visit
20 *
21 * http://smartweb.sourceforge.net
22 */
23
24 package net.smartlab.web;
25
26
27 /**
28 * A BusinessException is thrown whenever an application tries to perform a
29 * business operation but the request cannot be accomplished for some reason.
30 *
31 * @author rlogiacco
32 */
33 public class BusinessException extends Exception {
34
35 private static final long serialVersionUID = -8937869317112676920L;
36
37 /**
38 * Instantiates the class with a message. The providen message is used as a
39 * key and searched in available resource bundles. If the message is not a
40 * valid resource key than it's used directly.
41 *
42 * @param message the key to be searched in resource bundles.
43 */
44 public BusinessException(String message) {
45 super(message);
46 }
47
48 /**
49 * Instantiates the class with a message and a parameter. The providen
50 * message is used as a key and searched in available resource bundles. If
51 * the message is not a valid resource key than it's used directly.
52 *
53 * @param message the key to be searched in resource bundles.
54 * @param param an object to be used for param substitution.
55 */
56 public BusinessException(String message, Object param) {
57 this(message, new Object[] { param });
58 }
59
60 /**
61 * Instantiates the class with a message and two parameters. The providen
62 * message is used as a key and searched in available resource bundles. If
63 * the message is not a valid resource key than it's used directly.
64 *
65 * @param message the key to be searched in resource bundles.
66 * @param param1 an object to be used for param substitution.
67 * @param param2 an object to be used for param substitution.
68 */
69 public BusinessException(String message, Object param1, Object param2) {
70 this(message, new Object[] { param1, param2 });
71 }
72
73 /**
74 * Instantiates the class with a message and three parameters. The providen
75 * message is used as a key and searched in available resource bundles. If
76 * the message is not a valid resource key than it's used directly.
77 *
78 * @param message the key to be searched in resource bundles.
79 * @param param1 an object to be used for param substitution.
80 * @param param2 an object to be used for param substitution.
81 * @param param3 an object to be used for param substitution.
82 */
83 public BusinessException(String message, Object param1, Object param2, Object param3) {
84 this(message, new Object[] { param1, param2, param3});
85 }
86
87 /**
88 * Instantiates the class with a message and four parameters. The providen
89 * message is used as a key and searched in available resource bundles. If
90 * the message is not a valid resource key than it's used directly.
91 *
92 * @param message the key to be searched in resource bundles.
93 * @param param1 an object to be used for param substitution.
94 * @param param2 an object to be used for param substitution.
95 * @param param3 an object to be used for param substitution.
96 * @param param4 an object to be used for param substitution.
97 */
98 public BusinessException(String message, Object param1, Object param2, Object param3, Object param4) {
99 this(message, new Object[] { param1, param2, param3, param4 });
100 }
101
102 /**
103 * Instantiates the class with a message and an array of parameters. The
104 * providen message is used as a key and searched in available resource
105 * bundles. If the message is not a valid resource key than it's used
106 * directly.
107 *
108 * @param message the key to be searched in resource bundles.
109 * @param params a set of objects for param substitution.
110 */
111 public BusinessException(String message, Object[] params) {
112 super(message);
113 }
114
115 /**
116 * Default empty constructor.
117 */
118 public BusinessException() {
119 super();
120 }
121
122 /**
123 * Constructs a new instance with the specified cause.
124 *
125 * @param cause the <code>throwable</code> instance wich generated this
126 * exception.
127 */
128 public BusinessException(Throwable cause) {
129 super(cause);
130 }
131
132 /**
133 * Constructs a new instance with the specified describing message and
134 * cause.
135 *
136 * @param message the description of the occurred exception.
137 * @param cause the <code>throwable</code> instance wich generated this
138 * exception.
139 */
140 public BusinessException(String message, Throwable cause) {
141 super(message, cause);
142 }
143 }