001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.exception;
017    
018    import java.util.Map;
019    
020    /**
021     * This class contains the exception incident information, exception, form and
022     * session user. It is constructed and saved into the HTTP Request for passing to the
023     * jsp when an exception occurs.
024     *
025     * @author Kuali Rice Team (rice.collab@kuali.org)
026     *
027     */
028    public interface KualiExceptionIncident {
029        /**
030         * The error report subject built from current settings and caught exception
031         * <p>Value is exceptionReportSubject
032         */
033         public static final String EXCEPTION_REPORT_SUBJECT="exceptionReportSubject";
034    
035         /**
036          * Boolean value for incident report display
037          */
038         public static final String EXCEPTION_HIDE_INCIDENT_REPORT = "exceptionHideIncidentReport";
039        /**
040         * The error report message
041         * <p>Value is exceptionReportMessage
042         */
043         public static final String EXCEPTION_REPORT_MESSAGE="exceptionReportMessage";
044         /**
045          * The error message
046          * <p>Value is exceptionMessage
047          */
048          public static final String EXCEPTION_MESSAGE="exceptionMessage";
049         /**
050          * The error message to be displayed
051          * <p>Value is displayMessage
052          */
053         public static final String DISPLAY_MESSAGE="displayMessage";
054         /**
055         * Additional message from user
056          * <p>Value is description
057         */
058         public static final String DESCRIPTION="description";
059         /**
060          * Document id. it's blank if not a document process
061          * <p>Value is documentId
062          */
063         public static final String DOCUMENT_ID="documentId";
064         /**
065          * Session user email address
066          * <p>Value is userEmail
067          */
068         public static final String USER_EMAIL="userEmail";
069         /**
070          * Session user login name
071          * <p>Value is principalName
072          */
073         public static final String UUID="principalName";
074         /**
075          * Session user name
076          * <p>Value is userName
077          */
078         public static final String USER_NAME="userName";
079         /**
080          * Detail message not for displaying
081         * <p>Value is stackTrace
082          */
083         public static final String STACK_TRACE="stackTrace";
084         /**
085         * Form that threw the exception
086         * <p>Value is componentName
087         */
088         public static final String COMPONENT_NAME="componentName";
089    
090        /**
091         * This method return list of {key,value} pairs that each key is the constants
092         * defined in this interface.
093         *
094         * @return
095         * <p>Example:
096         * <code>
097         * documentId, 2942084
098         * userEmail, someone@somewhere
099         * 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 errror
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 The caught exception
115         * @return
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    }