01: package edu.iu.uis.eden;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05:
06: /**
07: * RuntimeException thrown from Service level classes when business rule validation
08: * fails. This exception is caught by StrutsExceptionHandler. If any service errors
09: * have been set on in the serviceErrors collection these are stripped off of the
10: * exception put into ActionMessages in the Error que and the request is directed back to
11: * the original ActionMapping input page.
12: */
13: public class WorkflowServiceErrorException extends RuntimeException {
14:
15: private static final long serialVersionUID = 2457592489303923040L;
16: private Collection serviceErrors;
17:
18: public WorkflowServiceErrorException(String message) {
19: this (message, (Throwable) null);
20: }
21:
22: public WorkflowServiceErrorException(String message,
23: Throwable throwable) {
24: super (message, throwable);
25: serviceErrors = new ArrayList();
26: }
27:
28: public WorkflowServiceErrorException(String msg,
29: WorkflowServiceError error) {
30: super (msg);
31: serviceErrors = new ArrayList();
32: serviceErrors.add(error);
33: }
34:
35: public WorkflowServiceErrorException(String msg, Collection errors) {
36: super (msg);
37: setServiceErrors(errors);
38: }
39:
40: public Collection getServiceErrors() {
41: return serviceErrors;
42: }
43:
44: public void setServiceErrors(Collection serviceErrors) {
45: this .serviceErrors = serviceErrors;
46: }
47:
48: public String toString() {
49: if (serviceErrors != null) {
50: return super .toString() + " " + serviceErrors;
51: } else {
52: return super .toString() + " (no service errors)";
53: }
54: }
55: }
|