IncidentInfo.java
上传用户:zhengdagz
上传日期:2014-03-06
资源大小:1956k
文件大小:4k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. /*
  2.  * $Id: IncidentInfo.java,v 1.2 2005/10/10 18:01:42 rbair Exp $
  3.  *
  4.  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
  5.  * Santa Clara, California 95054, U.S.A. All rights reserved.
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  20. */
  21. /**
  22.  * This is abstract class that incapsulates all the information needed
  23.  * to report a problem to the automated report/processing system.
  24.  *
  25.  * @author Alexander Zuev
  26.  * @version 1.0
  27.  */
  28. package org.jdesktop.swingx;
  29. public class IncidentInfo {
  30.     /**
  31.      * Short string that will be used as a error header
  32.      */
  33.     private String header;
  34.     /**
  35.      * Basic message that describes incident
  36.      */
  37.     private String basicErrorMessage;
  38.     /**
  39.      * Message that will fully describe the incident with all the
  40.      * available details
  41.      */
  42.     private String detailedErrorMessage;
  43.     /**
  44.      * Optional Throwable that will be used
  45.      */
  46.     private Throwable errorException;
  47.     /**
  48.      * Main constructor that adds all the information to IncidentInfo
  49.      * @param header
  50.      * @param basicErrorMessage
  51.      * @param detailedErrorMesage
  52.      * @param errorException
  53.      */
  54.     public IncidentInfo(String header, String basicErrorMessage,
  55.                         String detailedErrorMesage, Throwable errorException) {
  56.         this.header = header;
  57.         if(basicErrorMessage != null) {
  58.             this.basicErrorMessage = basicErrorMessage;
  59.         } else {
  60.             if(errorException != null) {
  61.                 this.basicErrorMessage = errorException.getLocalizedMessage();
  62.             } else {
  63.                 this.basicErrorMessage = "";
  64.             }
  65.         }
  66.         this.detailedErrorMessage = detailedErrorMesage;
  67.         this.errorException = errorException;
  68.     }
  69.     public IncidentInfo(String header, String basicErrorMessage, String detailedErrorMessage) {
  70.         this(header, basicErrorMessage, detailedErrorMessage, null);
  71.     }
  72.     public IncidentInfo(String header, Throwable errorException) {
  73.         this(header, null, null, errorException);
  74.     }
  75.     /**
  76.      * Get the current header string
  77.      *
  78.      * @return header string
  79.      */
  80.     public String getHeader() {
  81.         return header;
  82.     }
  83.     /**
  84.      * Set the current header string
  85.      *
  86.      * @param header
  87.      */
  88.     public void setHeader(String header) {
  89.         this.header = header;
  90.     }
  91.     /**
  92.      * Get the basic error description
  93.      *
  94.      * @return basic error description
  95.      */
  96.     public String getBasicErrorMessage() {
  97.         return basicErrorMessage;
  98.     }
  99.     /**
  100.      * Set the current basic error description
  101.      *
  102.      * @param basicErrorMessage
  103.      */
  104.     public void setBasicErrorMessage(String basicErrorMessage) {
  105.         this.basicErrorMessage = basicErrorMessage;
  106.     }
  107.     /**
  108.      * Get the detailed error description
  109.      *
  110.      * @return detailed description
  111.      */
  112.     public String getDetailedErrorMessage() {
  113.         return detailedErrorMessage;
  114.     }
  115.     /**
  116.      * Set the detailed description for this error
  117.      *
  118.      * @param detailedErrorMessage
  119.      */
  120.     public void setDetailedErrorMessage(String detailedErrorMessage) {
  121.         this.detailedErrorMessage = detailedErrorMessage;
  122.     }
  123.     /**
  124.      * Get an exception that contains some additional information about the
  125.      * error if provided.
  126.      *
  127.      * @return exception or null if no exception provided
  128.      */
  129.     public Throwable getErrorException() {
  130.         return errorException;
  131.     }
  132.     /**
  133.      * Set the exception that may contain additional information about the
  134.      * error.
  135.      *
  136.      * @param errorException
  137.      */
  138.     public void setErrorException(Throwable errorException) {
  139.         this.errorException = errorException;
  140.     }
  141. }