aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2013-01-09 15:41:29 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2013-01-09 15:41:29 +0000
commit535a04fa05f739ec16dd81666e3b0f82dfbd442d (patch)
tree0804f301c1a9ceb303a8441b7b29244fc8eb7ff0 /src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java
parent1efaf6fd5619dfa95c9d7e8c71eda4c2ffba4998 (diff)
downloadpdf-as-3-535a04fa05f739ec16dd81666e3b0f82dfbd442d.tar.gz
pdf-as-3-535a04fa05f739ec16dd81666e3b0f82dfbd442d.tar.bz2
pdf-as-3-535a04fa05f739ec16dd81666e3b0f82dfbd442d.zip
pdf-as-lib maven project files moved to pdf-as-lib
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/pdf-as/trunk@926 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java318
1 files changed, 0 insertions, 318 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java
deleted file mode 100644
index dc35582..0000000
--- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/**
- * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *
- * $Id: ErrorCodeException.java,v 1.1 2006/08/03 07:47:02 wprinz Exp $
- */
-package at.knowcenter.wag.egov.egiz.exceptions;
-
-import org.apache.log4j.Logger;
-
-import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
-import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
-
-/**
- * This exception should be inherit, if an exception should be shown as a
- * feedback message in user interfaces.
- *
- * <p>
- * 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!
- * </p>
- * <p>
- * 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.
- * </p>
- *
- * @author wlackner
- * @author wprinz (enforced error code)
- *
- * @deprecated
- *
- * @see at.knowcenter.wag.egov.egiz.cfg.SettingsReader
- */
-public class ErrorCodeException extends PresentableException
-{
- /**
- * SVUID.
- */
- private static final long serialVersionUID = 2071967845179686593L;
-
- /**
- * Template key getting error messages
- */
- private static final String ERROR_CODE_KEY = "error.code.";
-
- /**
- * The default error message
- */
- private static final String DEFAULT_ERROR_MESSAGE = "Fehler Code:";
-
- /**
- * The logger definition.
- */
- private static final Logger logger_ = ConfigLogger.getLogger(ErrorCodeException.class);
-
- /**
- * The SettingsReader instance
- */
- private SettingsReader settings_ = null;
-
- /**
- * The default error code
- */
- private int error_code_ = -1;
-
- /**
- * If an external application is called
- */
- private String externalErrorCode_ = null;
-
- /**
- * If an external application is called
- */
- private String externalErrorMessage_ = null;
-
- /**
- * Constructor that sets the error code.
- *
- * @param error_code
- * The error code.
- */
- public ErrorCodeException(final int error_code)
- {
- super(error_code, "just an error code");
- this.error_code_ = error_code;
- loadSettings();
- }
-
- /**
- * Inherit Constructor from Exception,
- *
- * @param error_code
- * The error code.
- * @param message
- * The in depth developer provided error message.
- * @see Exception
- */
- public ErrorCodeException(final int error_code, String message)
- {
- super(error_code, message);
- this.error_code_ = error_code;
- loadSettings();
- }
-
- /**
- * Inherit Constructor from Exception,
- *
- * @param error_code
- * The error code.
- * @param message
- * The in depth developer provided error message.
- * @param cause
- * The cause of this exception.
- * @see Exception
- */
- public ErrorCodeException(final int error_code, String message, Throwable cause)
- {
- super(error_code, message, cause);
- this.error_code_ = error_code;
- loadSettings();
- }
-
- /**
- * Inherit Constructor from Exception,
- *
- * @param error_code
- * The error code.
- * @param cause
- * The cause of this exception.
- * @see Exception
- */
- public ErrorCodeException(final int error_code, Throwable cause)
- {
- super(error_code, cause);
- this.error_code_ = error_code;
- loadSettings();
- }
-
- /**
- * Load the settings file. Call the SettingsReader instance.
- */
- private void loadSettings()
- {
- if (settings_ == null)
- {
- try
- {
- settings_ = SettingsReader.getInstance();
- }
- catch (SettingsException e)
- {
- String log_message = "Can not load pdf signature settings. Cause:\n" + e.getMessage();
- logger_.error(log_message, e);
- }
- }
- }
-
- /**
- * 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
- *
- * @see at.knowcenter.wag.egov.egiz.cfg.SettingsReader
- * @return Returns the errorCode.
- */
- public int getErrorCode()
- {
- return this.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
- *
- * @see at.knowcenter.wag.egov.egiz.cfg.SettingsReader
- * @param error_code
- * The error code to be set.
- */
- public void setErrorCode(final int error_code)
- {
- this.error_code_ = error_code;
- }
-
- /**
- * 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.
- *
- * @param errorCode
- * The errorCode to set.
- */
- public void setExternalErrorCode(String errorCode)
- {
- externalErrorCode_ = errorCode;
- }
-
- /**
- * Returns an external error code that is set manually
- *
- * @return the external error code if set, <code>null</code> otherwise
- */
- public String getExternalErrorCode()
- {
- return externalErrorCode_;
- }
-
- /**
- * 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.
- *
- * @param errorMessage
- */
- public void setExternalErrorMessage(String errorMessage)
- {
- externalErrorMessage_ = errorMessage;
- }
-
- /**
- * Returns an external error message that is set manually
- *
- * @return the external error message if set, <code>null</code> otherwise
- */
- public String getExternalErrorMessage()
- {
- return externalErrorMessage_;
- }
-
- /**
- * Checks if an external error message is set.
- *
- * @return returns <code>true</code> if a message is set, <code>false</code>
- * otherwise
- */
- public boolean hasExternalErrorMessage()
- {
- return (externalErrorMessage_ != null);
- }
-
- /**
- * 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.
- *
- * @return an error message that can be used for ui communication
- */
- public String getErrorCodeMessage()
- {
- String err_msg = null;
- if (settings_ != null)
- {
- err_msg = settings_.getSetting(ERROR_CODE_KEY + error_code_, DEFAULT_ERROR_MESSAGE + error_code_);
- }
- return err_msg;
- }
-
- /**
- * 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.
- *
- * @return an error message that can be used for ui communication
- */
- public static String getErrorCodeMessage(int errorCode)
- {
- SettingsReader settings = null;
- String err_msg = DEFAULT_ERROR_MESSAGE + errorCode;
- try
- {
- settings = SettingsReader.getInstance();
- err_msg = settings.getSetting(ERROR_CODE_KEY + errorCode, DEFAULT_ERROR_MESSAGE + errorCode);
- }
- catch (SettingsException e)
- {
- logger_.error(e.getMessage(), e);
- }
- return err_msg;
- }
-
- /**
- * Checks if the exception has an ErrorCode state.
- *
- * @return true if an ErrorCode does exist false otherwise
- */
- public boolean hasErrorCode()
- {
- return error_code_ != 0;
- }
-} \ No newline at end of file