at.knowcenter.wag.egov.egiz.exceptions
Class ErrorCodeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by at.knowcenter.wag.egov.egiz.exceptions.PresentableException
              extended by at.knowcenter.wag.egov.egiz.exceptions.ErrorCodeException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
NormalizeException, PDFDocumentException, SettingNotFoundException, SignatureException, WebException

public class ErrorCodeException
extends PresentableException

This exception should be inherit, if an exception should be shown as a feedback message in user interfaces.

The error code is an integer number. The error codes are defined in an separate configuration file, readed be the SettingsReader. If the SettingsReader can not initialized, a corresponding error message can not read!

The error code can be seen a a replacement of the exception message. For all intents and purposes, the error code should be used to provide exceptional feedback to the user. Nevertheless, if possible, a debug message String (the message parameter) should still be provided giving in depth developer descriptions of the problem. These message strings will then show up in the log files accordingly.

Author:
wlackner, wprinz (enforced error code)
See Also:
SettingsReader, Serialized Form

Constructor Summary
ErrorCodeException(int error_code)
          Constructor that sets the error code.
ErrorCodeException(int error_code, String message)
          Inherit Constructor from Exception,
ErrorCodeException(int error_code, String message, Throwable cause)
          Inherit Constructor from Exception,
ErrorCodeException(int error_code, Throwable cause)
          Inherit Constructor from Exception,
 
Method Summary
 int getErrorCode()
          Return the manually stored error code.
 String getErrorCodeMessage()
          Get the configured error message that corresponds to the error code.
static String getErrorCodeMessage(int errorCode)
          Get the configured error message that corresponds to the given error code.
 String getExternalErrorCode()
          Returns an external error code that is set manually
 String getExternalErrorMessage()
          Returns an external error message that is set manually
 boolean hasErrorCode()
          Checks if the exception has an ErrorCode state.
 boolean hasExternalErrorMessage()
          Checks if an external error message is set.
 void setErrorCode(int error_code)
          Set a special error code in case of commuicating this error in an user interface.
 void setExternalErrorCode(String errorCode)
          Set a special error code in case of commuicating this error in an user interface.
 void setExternalErrorMessage(String errorMessage)
          Set a special error message in case of commuicating this error in an user interface.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ErrorCodeException

public ErrorCodeException(int error_code)
Constructor that sets the error code.

Parameters:
error_code - The error code.

ErrorCodeException

public ErrorCodeException(int error_code,
                          String message)
Inherit Constructor from Exception,

Parameters:
error_code - The error code.
message - The in depth developer provided error message.
See Also:
Exception

ErrorCodeException

public ErrorCodeException(int error_code,
                          String message,
                          Throwable cause)
Inherit Constructor from Exception,

Parameters:
error_code - The error code.
message - The in depth developer provided error message.
cause - The cause of this exception.
See Also:
Exception

ErrorCodeException

public ErrorCodeException(int error_code,
                          Throwable cause)
Inherit Constructor from Exception,

Parameters:
error_code - The error code.
cause - The cause of this exception.
See Also:
Exception
Method Detail

getErrorCode

public int getErrorCode()
Return the manually stored error code. The error code is only a key for a configurable error message. The error code and its corresponding message have to be declared in an separate property file, loaded by the SettingsReader

Returns:
Returns the errorCode.
See Also:
SettingsReader

setErrorCode

public void setErrorCode(int error_code)
Set a special error code in case of commuicating this error in an user interface. The error code is only a key for a configurable error message. The error code and its corresponding message have to be declared in an separate property file, loaded by the SettingsReader

Parameters:
error_code - The error code to be set.
See Also:
SettingsReader

setExternalErrorCode

public void setExternalErrorCode(String errorCode)
Set a special error code in case of commuicating this error in an user interface. The error code is a key for an external application error message. The error code and its corresponding message have to be declared by the external tool that used.

Parameters:
errorCode - The errorCode to set.

getExternalErrorCode

public String getExternalErrorCode()
Returns an external error code that is set manually

Returns:
the external error code if set, null otherwise

setExternalErrorMessage

public void setExternalErrorMessage(String errorMessage)
Set a special error message in case of commuicating this error in an user interface. The error message and its corresponding error code have to be declared by the external tool that used.

Parameters:
errorMessage -

getExternalErrorMessage

public String getExternalErrorMessage()
Returns an external error message that is set manually

Returns:
the external error message if set, null otherwise

hasExternalErrorMessage

public boolean hasExternalErrorMessage()
Checks if an external error message is set.

Returns:
returns true if a message is set, false otherwise

getErrorCodeMessage

public String getErrorCodeMessage()
Get the configured error message that corresponds to the error code. If the config file can't be read, or an error code is not declared in the config file, the default error message would be returned.

Returns:
an error message that can be used for ui communication

getErrorCodeMessage

public static String getErrorCodeMessage(int errorCode)
Get the configured error message that corresponds to the given error code. If the config file can't be read, or an error code is not declared in the config file, the default error message would be returned.

Returns:
an error message that can be used for ui communication

hasErrorCode

public boolean hasErrorCode()
Checks if the exception has an ErrorCode state.

Returns:
true if an ErrorCode does exist false otherwise


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.