Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
WorkflowServiceErrorException |
|
| 1.2857142857142858;1.286 |
1 | /* | |
2 | * Copyright 2008-2009 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kew.exception; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.Collection; | |
20 | ||
21 | /** | |
22 | * RuntimeException thrown from Service level classes when business rule validation | |
23 | * fails. This exception is caught by StrutsExceptionHandler. If any service errors | |
24 | * have been set on in the serviceErrors collection these are stripped off of the | |
25 | * exception put into ActionMessages in the Error que and the request is directed back to | |
26 | * the original ActionMapping input page. | |
27 | */ | |
28 | public class WorkflowServiceErrorException extends RuntimeException { | |
29 | ||
30 | ||
31 | private static final long serialVersionUID = 2457592489303923040L; | |
32 | private Collection serviceErrors; | |
33 | ||
34 | public WorkflowServiceErrorException(String message) { | |
35 | 0 | this(message, (Throwable)null); |
36 | 0 | } |
37 | ||
38 | public WorkflowServiceErrorException(String message, Throwable throwable) { | |
39 | 0 | super(message, throwable); |
40 | 0 | serviceErrors = new ArrayList(); |
41 | 0 | } |
42 | ||
43 | public WorkflowServiceErrorException(String msg, WorkflowServiceError error) { | |
44 | 0 | super(msg); |
45 | 0 | serviceErrors = new ArrayList(); |
46 | 0 | serviceErrors.add(error); |
47 | 0 | } |
48 | ||
49 | ||
50 | public WorkflowServiceErrorException(String msg, Collection errors) { | |
51 | 0 | super(msg); |
52 | 0 | setServiceErrors(errors); |
53 | 0 | } |
54 | ||
55 | public Collection getServiceErrors() { | |
56 | 0 | return serviceErrors; |
57 | } | |
58 | ||
59 | public void setServiceErrors(Collection serviceErrors) { | |
60 | 0 | this.serviceErrors = serviceErrors; |
61 | 0 | } |
62 | ||
63 | public String toString() { | |
64 | 0 | if (serviceErrors != null) { |
65 | 0 | return super.toString() + " " + serviceErrors; |
66 | } else { | |
67 | 0 | return super.toString() + " (no service errors)"; |
68 | } | |
69 | } | |
70 | } |