|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.kns.web.struts.form;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import java.util.HashMap;  | 
  |  20 |     | 
   import java.util.HashSet;  | 
  |  21 |     | 
   import java.util.Map;  | 
  |  22 |     | 
   import java.util.Set;  | 
  |  23 |     | 
     | 
  |  24 |     | 
   import javax.servlet.http.HttpServletRequest;  | 
  |  25 |     | 
     | 
  |  26 |     | 
   import org.apache.log4j.Logger;  | 
  |  27 |     | 
   import org.apache.struts.action.ActionMapping;  | 
  |  28 |     | 
   import org.kuali.rice.kns.exception.ExceptionIncident;  | 
  |  29 |     | 
   import org.kuali.rice.kns.util.KNSConstants;  | 
  |  30 |     | 
     | 
  |  31 |     | 
     | 
  |  32 |     | 
     | 
  |  33 |     | 
     | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |    0 |    public class KualiExceptionIncidentForm extends KualiForm { | 
  |  37 |     | 
       private static final long serialVersionUID = 831951332440283401L;  | 
  |  38 |    0 |        private static Logger LOG=Logger.getLogger(KualiExceptionIncidentForm.class);   | 
  |  39 |     | 
         | 
  |  40 |     | 
         | 
  |  41 |     | 
     | 
  |  42 |     | 
     | 
  |  43 |    0 |        private static final Set<String> PROPS_NEEDED_FOR_MAP = new HashSet<String>();  | 
  |  44 |     | 
       static { | 
  |  45 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.DOCUMENT_ID);  | 
  |  46 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.USER_EMAIL);  | 
  |  47 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.USER_NAME);  | 
  |  48 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.UUID);  | 
  |  49 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.COMPONENT_NAME);  | 
  |  50 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.DESCRIPTION);  | 
  |  51 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.EXCEPTION_REPORT_SUBJECT);  | 
  |  52 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.EXCEPTION_MESSAGE);  | 
  |  53 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.DISPLAY_MESSAGE);  | 
  |  54 |    0 |                PROPS_NEEDED_FOR_MAP.add(ExceptionIncident.STACK_TRACE);  | 
  |  55 |    0 |        }  | 
  |  56 |     | 
         | 
  |  57 |     | 
         | 
  |  58 |     | 
     | 
  |  59 |     | 
     | 
  |  60 |    0 |        private boolean cancel=false;  | 
  |  61 |     | 
         | 
  |  62 |     | 
     | 
  |  63 |     | 
     | 
  |  64 |     | 
     | 
  |  65 |     | 
         | 
  |  66 |     | 
     | 
  |  67 |     | 
     | 
  |  68 |     | 
        private String exceptionReportSubject;  | 
  |  69 |     | 
         | 
  |  70 |     | 
     | 
  |  71 |     | 
     | 
  |  72 |     | 
        private String exceptionMessage;  | 
  |  73 |     | 
          | 
  |  74 |     | 
     | 
  |  75 |     | 
     | 
  |  76 |     | 
         private String displayMessage;  | 
  |  77 |     | 
          | 
  |  78 |     | 
     | 
  |  79 |     | 
     | 
  |  80 |     | 
        private String description;  | 
  |  81 |     | 
          | 
  |  82 |     | 
     | 
  |  83 |     | 
     | 
  |  84 |    0 |         private String documentId="";   | 
  |  85 |     | 
          | 
  |  86 |     | 
     | 
  |  87 |     | 
     | 
  |  88 |    0 |         private String userEmail="";  | 
  |  89 |     | 
          | 
  |  90 |     | 
     | 
  |  91 |     | 
     | 
  |  92 |    0 |         private String principalName="";  | 
  |  93 |     | 
          | 
  |  94 |     | 
     | 
  |  95 |     | 
     | 
  |  96 |    0 |         private String userName="";  | 
  |  97 |     | 
          | 
  |  98 |     | 
     | 
  |  99 |     | 
     | 
  |  100 |     | 
        private String stackTrace;  | 
  |  101 |     | 
          | 
  |  102 |     | 
     | 
  |  103 |     | 
     | 
  |  104 |     | 
       private String componentName;  | 
  |  105 |     | 
     | 
  |  106 |     | 
         | 
  |  107 |     | 
     | 
  |  108 |     | 
     | 
  |  109 |     | 
       public void populate(HttpServletRequest request) { | 
  |  110 |     | 
             | 
  |  111 |    0 |            super.populate(request);  | 
  |  112 |     | 
             | 
  |  113 |     | 
             | 
  |  114 |    0 |            if(notNull(request.getParameter(KNSConstants.CANCEL_METHOD + ".x")) && notNull(request.getParameter(KNSConstants.CANCEL_METHOD + ".y"))){ | 
  |  115 |    0 |                    this.setCancel(true);  | 
  |  116 |     | 
           }                  | 
  |  117 |    0 |        }  | 
  |  118 |     | 
         | 
  |  119 |     | 
       private boolean notNull(String s){ | 
  |  120 |    0 |                if(s != null && !"".equals(s)){ | 
  |  121 |    0 |                        return true;  | 
  |  122 |     | 
               }else   | 
  |  123 |    0 |                        return false;  | 
  |  124 |     | 
       }  | 
  |  125 |     | 
     | 
  |  126 |     | 
         | 
  |  127 |     | 
     | 
  |  128 |     | 
     | 
  |  129 |     | 
     | 
  |  130 |     | 
     | 
  |  131 |     | 
     | 
  |  132 |     | 
       public void reset(ActionMapping mapping, HttpServletRequest request) { | 
  |  133 |     | 
             | 
  |  134 |    0 |            this.setMethodToCall(null);  | 
  |  135 |    0 |            this.setRefreshCaller(null);  | 
  |  136 |    0 |            this.setAnchor(null);  | 
  |  137 |    0 |            this.setCurrentTabIndex(0);  | 
  |  138 |     | 
             | 
  |  139 |    0 |            this.cancel=false;  | 
  |  140 |    0 |            this.documentId=null;  | 
  |  141 |    0 |            this.componentName=null;  | 
  |  142 |    0 |            this.description=null;  | 
  |  143 |    0 |            this.displayMessage=null;  | 
  |  144 |    0 |            this.exceptionMessage=null;  | 
  |  145 |    0 |            this.stackTrace=null;  | 
  |  146 |    0 |            this.userEmail=null;  | 
  |  147 |    0 |            this.userName=null;  | 
  |  148 |    0 |            this.principalName=null;  | 
  |  149 |     | 
     | 
  |  150 |    0 |        }  | 
  |  151 |     | 
         | 
  |  152 |     | 
         | 
  |  153 |     | 
     | 
  |  154 |     | 
     | 
  |  155 |     | 
     | 
  |  156 |     | 
     | 
  |  157 |     | 
     | 
  |  158 |     | 
     | 
  |  159 |     | 
     | 
  |  160 |     | 
     | 
  |  161 |     | 
     | 
  |  162 |     | 
     | 
  |  163 |     | 
     | 
  |  164 |     | 
     | 
  |  165 |     | 
     | 
  |  166 |     | 
     | 
  |  167 |     | 
     | 
  |  168 |     | 
     | 
  |  169 |     | 
       public Map<String, String> toMap() { | 
  |  170 |    0 |            if (LOG.isTraceEnabled()) { | 
  |  171 |    0 |                String message=String.format("ENTRY"); | 
  |  172 |    0 |                LOG.trace(message);  | 
  |  173 |     | 
           }  | 
  |  174 |     | 
             | 
  |  175 |    0 |            Map<String, String> map=new HashMap<String, String>();  | 
  |  176 |    0 |            map.put(ExceptionIncident.DOCUMENT_ID, this.documentId);  | 
  |  177 |    0 |            map.put(ExceptionIncident.USER_EMAIL, this.userEmail);  | 
  |  178 |    0 |            map.put(ExceptionIncident.USER_NAME, this.userName);  | 
  |  179 |    0 |            map.put(ExceptionIncident.UUID, this.principalName);  | 
  |  180 |    0 |            map.put(ExceptionIncident.COMPONENT_NAME, this.componentName);  | 
  |  181 |    0 |            map.put(ExceptionIncident.DESCRIPTION, this.description);  | 
  |  182 |    0 |            map.put(ExceptionIncident.EXCEPTION_REPORT_SUBJECT, this.exceptionReportSubject);  | 
  |  183 |    0 |            map.put(ExceptionIncident.EXCEPTION_MESSAGE, this.exceptionMessage);  | 
  |  184 |    0 |            map.put(ExceptionIncident.DISPLAY_MESSAGE, this.displayMessage);  | 
  |  185 |    0 |            map.put(ExceptionIncident.STACK_TRACE, this.stackTrace);  | 
  |  186 |     | 
             | 
  |  187 |    0 |            if (LOG.isTraceEnabled()) { | 
  |  188 |    0 |                String message=String.format("ENTRY %s", map.toString()); | 
  |  189 |    0 |                LOG.trace(message);  | 
  |  190 |     | 
           }  | 
  |  191 |     | 
             | 
  |  192 |    0 |            return map;  | 
  |  193 |     | 
       }  | 
  |  194 |     | 
     | 
  |  195 |     | 
         | 
  |  196 |     | 
     | 
  |  197 |     | 
     | 
  |  198 |     | 
       public final boolean isCancel() { | 
  |  199 |    0 |            return this.cancel;  | 
  |  200 |     | 
       }  | 
  |  201 |     | 
     | 
  |  202 |     | 
         | 
  |  203 |     | 
     | 
  |  204 |     | 
     | 
  |  205 |     | 
       public final void setCancel(boolean cancel) { | 
  |  206 |    0 |            this.cancel = cancel;  | 
  |  207 |    0 |        }  | 
  |  208 |     | 
     | 
  |  209 |     | 
         | 
  |  210 |     | 
     | 
  |  211 |     | 
     | 
  |  212 |     | 
     | 
  |  213 |     | 
     | 
  |  214 |     | 
     | 
  |  215 |     | 
     | 
  |  216 |     | 
         | 
  |  217 |     | 
     | 
  |  218 |     | 
     | 
  |  219 |     | 
       public final String getDescription() { | 
  |  220 |    0 |            return this.description;  | 
  |  221 |     | 
       }  | 
  |  222 |     | 
     | 
  |  223 |     | 
         | 
  |  224 |     | 
     | 
  |  225 |     | 
     | 
  |  226 |     | 
       public final void setDescription(String description) { | 
  |  227 |    0 |            this.description = description;  | 
  |  228 |    0 |        }  | 
  |  229 |     | 
     | 
  |  230 |     | 
         | 
  |  231 |     | 
     | 
  |  232 |     | 
     | 
  |  233 |     | 
       public final String getExceptionMessage() { | 
  |  234 |    0 |            return this.exceptionMessage;  | 
  |  235 |     | 
       }  | 
  |  236 |     | 
     | 
  |  237 |     | 
         | 
  |  238 |     | 
     | 
  |  239 |     | 
     | 
  |  240 |     | 
       public final void setExceptionMessage(String exceptionMessage) { | 
  |  241 |    0 |            this.exceptionMessage = exceptionMessage;  | 
  |  242 |    0 |        }  | 
  |  243 |     | 
     | 
  |  244 |     | 
         | 
  |  245 |     | 
     | 
  |  246 |     | 
     | 
  |  247 |     | 
       public final String getDisplayMessage() { | 
  |  248 |    0 |            return this.displayMessage;  | 
  |  249 |     | 
       }  | 
  |  250 |     | 
     | 
  |  251 |     | 
         | 
  |  252 |     | 
     | 
  |  253 |     | 
     | 
  |  254 |     | 
       public final void setDisplayMessage(String displayMessage) { | 
  |  255 |    0 |            this.displayMessage = displayMessage;  | 
  |  256 |    0 |        }  | 
  |  257 |     | 
     | 
  |  258 |     | 
         | 
  |  259 |     | 
     | 
  |  260 |     | 
     | 
  |  261 |     | 
       public final String getDocumentId() { | 
  |  262 |    0 |            return this.documentId;  | 
  |  263 |     | 
       }  | 
  |  264 |     | 
     | 
  |  265 |     | 
         | 
  |  266 |     | 
     | 
  |  267 |     | 
     | 
  |  268 |     | 
       public final void setDocumentId(String documentId) { | 
  |  269 |    0 |            this.documentId = documentId;  | 
  |  270 |    0 |        }  | 
  |  271 |     | 
         | 
  |  272 |     | 
         | 
  |  273 |     | 
     | 
  |  274 |     | 
     | 
  |  275 |     | 
       public final String getUserEmail() { | 
  |  276 |    0 |            return this.userEmail;  | 
  |  277 |     | 
       }  | 
  |  278 |     | 
     | 
  |  279 |     | 
         | 
  |  280 |     | 
     | 
  |  281 |     | 
     | 
  |  282 |     | 
       public final void setUserEmail(String userEmail) { | 
  |  283 |    0 |            this.userEmail = userEmail;  | 
  |  284 |    0 |        }  | 
  |  285 |     | 
     | 
  |  286 |     | 
         | 
  |  287 |     | 
     | 
  |  288 |     | 
     | 
  |  289 |     | 
           public String getPrincipalName() { | 
  |  290 |    0 |                    return this.principalName;  | 
  |  291 |     | 
           }  | 
  |  292 |     | 
     | 
  |  293 |     | 
             | 
  |  294 |     | 
     | 
  |  295 |     | 
     | 
  |  296 |     | 
           public void setPrincipalName(String principalName) { | 
  |  297 |    0 |                    this.principalName = principalName;  | 
  |  298 |    0 |            }  | 
  |  299 |     | 
     | 
  |  300 |     | 
             | 
  |  301 |     | 
     | 
  |  302 |     | 
     | 
  |  303 |     | 
       public final String getUserName() { | 
  |  304 |    0 |            return this.userName;  | 
  |  305 |     | 
       }  | 
  |  306 |     | 
     | 
  |  307 |     | 
         | 
  |  308 |     | 
     | 
  |  309 |     | 
     | 
  |  310 |     | 
       public final void setUserName(String userName) { | 
  |  311 |    0 |            this.userName = userName;  | 
  |  312 |    0 |        }  | 
  |  313 |     | 
     | 
  |  314 |     | 
         | 
  |  315 |     | 
     | 
  |  316 |     | 
     | 
  |  317 |     | 
       public final void setStackTrace(String stackTrace) { | 
  |  318 |    0 |            this.stackTrace = stackTrace;  | 
  |  319 |    0 |        }  | 
  |  320 |     | 
     | 
  |  321 |     | 
         | 
  |  322 |     | 
     | 
  |  323 |     | 
     | 
  |  324 |     | 
       public final String getStackTrace() { | 
  |  325 |    0 |            return this.stackTrace;  | 
  |  326 |     | 
       }  | 
  |  327 |     | 
     | 
  |  328 |     | 
         | 
  |  329 |     | 
     | 
  |  330 |     | 
     | 
  |  331 |     | 
       public final String getExceptionReportSubject() { | 
  |  332 |    0 |            return this.exceptionReportSubject;  | 
  |  333 |     | 
       }  | 
  |  334 |     | 
     | 
  |  335 |     | 
         | 
  |  336 |     | 
     | 
  |  337 |     | 
     | 
  |  338 |     | 
       public final void setExceptionReportSubject(String exceptionReportSubject) { | 
  |  339 |    0 |            this.exceptionReportSubject = exceptionReportSubject;  | 
  |  340 |    0 |        }  | 
  |  341 |     | 
     | 
  |  342 |     | 
         | 
  |  343 |     | 
     | 
  |  344 |     | 
     | 
  |  345 |     | 
       public final String getComponentName() { | 
  |  346 |    0 |            return this.componentName;  | 
  |  347 |     | 
       }  | 
  |  348 |     | 
     | 
  |  349 |     | 
         | 
  |  350 |     | 
     | 
  |  351 |     | 
     | 
  |  352 |     | 
       public final void setComponentName(String componentName) { | 
  |  353 |    0 |            this.componentName = componentName;  | 
  |  354 |    0 |        }  | 
  |  355 |     | 
     | 
  |  356 |     | 
             | 
  |  357 |     | 
     | 
  |  358 |     | 
     | 
  |  359 |     | 
     | 
  |  360 |     | 
     | 
  |  361 |     | 
           @Override  | 
  |  362 |     | 
           public boolean shouldMethodToCallParameterBeUsed(  | 
  |  363 |     | 
                           String methodToCallParameterName,  | 
  |  364 |     | 
                           String methodToCallParameterValue, HttpServletRequest request) { | 
  |  365 |     | 
                     | 
  |  366 |    0 |                    return true;  | 
  |  367 |     | 
           }  | 
  |  368 |     | 
     | 
  |  369 |     | 
             | 
  |  370 |     | 
     | 
  |  371 |     | 
     | 
  |  372 |     | 
           @Override  | 
  |  373 |     | 
           public boolean shouldPropertyBePopulatedInForm(  | 
  |  374 |     | 
                           String requestParameterName, HttpServletRequest request) { | 
  |  375 |    0 |                    if (PROPS_NEEDED_FOR_MAP.contains(requestParameterName)) { | 
  |  376 |    0 |                            return true;  | 
  |  377 |     | 
                   }  | 
  |  378 |    0 |                    else if (KNSConstants.CANCEL_METHOD.equals(requestParameterName)) { | 
  |  379 |    0 |                            return true;  | 
  |  380 |     | 
                   }  | 
  |  381 |    0 |                    return super.shouldPropertyBePopulatedInForm(requestParameterName, request);  | 
  |  382 |     | 
           }  | 
  |  383 |     | 
   }  | 
  |  384 |     | 
     |