All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.enterprise.exc.SysException Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

// @(#) $Id: SysException.java 2093 2007-11-28 14:23:36Z s3460 $
package at.spardat.enterprise.exc;

/**
 * This class is used to throw system-level exceptions. System-exceptions
 * inform the outside world from abnormal conditions that are caused by
 * the system, for example network-failures or failures with 
 * database connections. The most common subcategories are:
 * 
    *
  • Unexpected failures or resource shortages in hardware. Examples: * Failure of processor, disk or network. Shortages of any kind: Out * of disk space, out of file handles, network traffic jam, no more * data base connections, database table space full. *
  • Unexpected failures of system-level-software. Examples: Failures * of the operating system, the database system, the application server. *
  • Unexpected failures of application-level-software because of * programming errors. *
* What makes system-exceptions different from {@link AppException}s are * the following properties: *
    *
  • System-exceptions are always unexpected, cannot be predicted in advance * and therefore cannot be dealt with reasonably in the program (beyond * reporting in a generic way). *
  • They may appear in almost any method, since business logic * in online applications usually accessed data sources like database * or backend systems that may throw these exceptions. *
  • Since the end-user does not cause and cannot solve the underlying cause of * system-exceptions, system-exceptions should not * primarely be reported to him, but to a system-administrator. *
* * This class may be subclassed with the restriction, that only methods may * be added in the subclass, not instance variables. The reason: This class * is used in remote communications and arbitrarely subclassing would require * the remote clients to be also able to load the subclasses. * * @author YSD, 21.05.2003 19:29:23 */ public class SysException extends BaseException { /** * Increase this if u make non compatible changes */ private static final long serialVersionUID = 1L; /** * Constructs and sets the message of this from a two * parameter java.text.MessageFormat compatible string. * * @param messageFmt format string as defined in java.text.MessageFormat. * @param params the message parameters * */ public SysException (String messageFmt, Object[] params) { super (null, messageFmt, null, params); showToEndUser_ = false; } /** * Constructs and sets the message of this from a two * parameter java.text.MessageFormat compatible string. * * @param messageFmt format string as defined in java.text.MessageFormat. * @param param1 first message parameter * @param param2 second message parameter */ public SysException (String messageFmt, Object param1, Object param2) { super (null, messageFmt, null, new Object[]{param1,param2}); showToEndUser_ = false; } /** * Constructs and sets the message of this from a one * parameter java.text.MessageFormat compatible string. * * @param messageFmt format string as defined in java.text.MessageFormat. * @param param1 message parameter */ public SysException (String messageFmt, Object param1) { super (null, messageFmt, null, new Object[]{param1}); showToEndUser_ = false; } /** * Constructs and sets the message to the provided value. * * @param message text to set */ public SysException (String message) { super (null, message, null, null); showToEndUser_ = false; } /** * Constructs and sets the message and the detail exception to the provided value. * * @param detail the detail throwable to set. * @param message message to set */ public SysException (Throwable detail, String message) { super (detail, message, null, null); showToEndUser_ = false; } /** * Constructs with a detail exception and an empty message. * * @param detail the detail throwable to set. */ public SysException (Throwable detail) { super (detail, "", null, null); showToEndUser_ = false; } /** * Constructs and sets the message of this from a two * parameter java.text.MessageFormat compatible string. * * @param detail the detail throwable. * @param messageFmt format string as defined in java.text.MessageFormat. * @param param1 first message parameter * @param param2 second message parameter */ public SysException (Throwable detail, String messageFmt, Object param1, Object param2) { super (detail, messageFmt, null, new Object[]{param1,param2}); showToEndUser_ = false; } /** * Constructs and sets the message of this from a one * parameter java.text.MessageFormat compatible string. * * @param detail detail throwable. * @param messageFmt format string as defined in java.text.MessageFormat. * @param param1 message parameter */ public SysException (Throwable detail, String messageFmt, Object param1) { super (detail, messageFmt, null, new Object[]{param1}); showToEndUser_ = false; } /** * Constructs and sets the message of this from a one * parameter java.text.MessageFormat compatible string. * * @param detail detail throwable. * @param messageFmt format string as defined in java.text.MessageFormat. * @param params the message parameters */ public SysException (Throwable detail, String messageFmt, Object[] params) { super (detail, messageFmt, null, params); showToEndUser_ = false; } /** * Sets the code. The code should be used to discrimitate among * different kinds of exceptions/notifications. * * @see INotification */ public SysException setCode (int code) { notification_.setCode(code); return this; } /** * Sets one or a bit-or combination of the reaction constants * of INotification. * * @see INotification#getReaction() * @return this */ public SysException setReaction (int reaction) { notification_.setReaction(reaction); return this; } /** * Sets the short message. * * @see INotification#getShortMessage() */ public SysException setShortMessage (String shortMessage) { notification_.setShortMessage(shortMessage); return this; } /** * Sets the type which may be one of the T_-constants in * {@link INotification}. * * @see INotification#getType() * @return this */ public SysException setType (int type) { notification_.setType(type); return this; } /** * Sets if this exception may be directly displayed to the end user or not. If * not called, this property defaults to false. */ public SysException setShowToEndUser (boolean what) { showToEndUser_ = what; return this; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy