1 /**
2 * Copyright 2005-2014 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.krad.exception;
17
18 import java.util.Map;
19
20 /**
21 * This class contains the exception incident information, exception, form and
22 * session user. It is constructed and saved into the HTTP Request for passing to the
23 * jsp when an exception occurs.
24 *
25 * @author Kuali Rice Team (rice.collab@kuali.org)
26 *
27 */
28 public interface KualiExceptionIncident {
29 /**
30 * The error report subject built from current settings and caught exception
31 * <p>Value is exceptionReportSubject
32 */
33 public static final String EXCEPTION_REPORT_SUBJECT="exceptionReportSubject";
34
35 /**
36 * Boolean value for incident report display
37 */
38 public static final String EXCEPTION_HIDE_INCIDENT_REPORT = "exceptionHideIncidentReport";
39 /**
40 * The error report message
41 * <p>Value is exceptionReportMessage
42 */
43 public static final String EXCEPTION_REPORT_MESSAGE="exceptionReportMessage";
44 /**
45 * The error message
46 * <p>Value is exceptionMessage
47 */
48 public static final String EXCEPTION_MESSAGE="exceptionMessage";
49 /**
50 * The error message to be displayed
51 * <p>Value is displayMessage
52 */
53 public static final String DISPLAY_MESSAGE="displayMessage";
54 /**
55 * Additional message from user
56 * <p>Value is description
57 */
58 public static final String DESCRIPTION="description";
59 /**
60 * Document id. it's blank if not a document process
61 * <p>Value is documentId
62 */
63 public static final String DOCUMENT_ID="documentId";
64 /**
65 * Session user email address
66 * <p>Value is userEmail
67 */
68 public static final String USER_EMAIL="userEmail";
69 /**
70 * Session user login name
71 * <p>Value is principalName
72 */
73 public static final String UUID="principalName";
74 /**
75 * Session user name
76 * <p>Value is userName
77 */
78 public static final String USER_NAME="userName";
79 /**
80 * Detail message not for displaying
81 * <p>Value is stackTrace
82 */
83 public static final String STACK_TRACE="stackTrace";
84 /**
85 * Form that threw the exception
86 * <p>Value is componentName
87 */
88 public static final String COMPONENT_NAME="componentName";
89
90 /**
91 * This method return list of {key,value} pairs that each key is the constants
92 * defined in this interface.
93 *
94 * @return
95 * <p>Example:
96 * <code>
97 * documentId, 2942084
98 * userEmail, someone@somewhere
99 * userName, some name
100 * componentFormName, Form that threw exception name
101 * exceptionMessage, Error message from exception
102 * displayMessage, Either exception error message or generic exception error message
103 * stackTrace, Exception stack trace here
104 * </code>
105 *
106 */
107 public Map<String, String> toProperties();
108
109 /**
110 * This method checks the exception (set during construction) and return error
111 * message if it's Kuali type of exception (defined by the list of exception names).
112 * Otherwise, it returns a generic message.
113 *
114 * @param exception The caught exception
115 * @return display message
116 */
117 public String getDisplayMessage(Exception exception);
118
119 /**
120 * This method get the specified key value from the implementing class.
121 *
122 * @param key
123 * @return null is return if not found
124 */
125 public String getProperty(String key);
126
127 }