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

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

There is a newer version: 6.0.2
Show newest version
/*******************************************************************************
 * 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: INotification.java 2093 2007-11-28 14:23:36Z s3460 $
package at.spardat.enterprise.exc;

/**
 * An INotification is a message that some business logic code wants to tell to
 * its environment. This may be exceptional, informative or a question (as indicated
 * by {@link #getType()}. Besides having a detailed message ({@link #getMessage()}), 
 * a notification may have a short message ({@link #getShortMessage()}), that may be 
 * used in title bars if this notification is displayed in the presentation layer. 

* * The recipient of a INotification who must handle it may discriminate * among different notifications using an integer code, {@link #getCode}. * The code should obey the following * convention in order to ensure that codes from different applications or modules * do not clash. The code should follow the form of 9 digit decimal number AAAMMMCCC, where *

    *
  • AAA is an application code. *
  • MMM is a module code within an application. *
  • CCC is a unique code within an module. *
* Codes 001xxxxxx are reservered for infrastructure like enterprise or XMA. A typical * use of these kinds of codes is to define some module offset: *
 * public static final int          MY_MODULE = 55001000;
 * 
* and to construct Notifications by adding offsets to the module constant: *
 * new Notification (...).setCode (MY_MODULE+5);
 * 
* * The piece of code that creates an INotification may also define the possible * reactions the recipient should take when he receives the notification, see {@link #getReaction()}.

* * @author YSD, 21.05.2003 18:11:13 */ public interface INotification { /** * Indicates that the type of the notification is a question. */ public static final int T_QUESTION = 1; /** * Indicates that the type of the notification is a information. */ public static final int T_INFORMATION = 1<<1; /** * Indicates that the type of the notification is a warning. */ public static final int T_WARNING = 1<<2; /** * Indicates that the type of the notification is a error. */ public static final int T_ERROR = 1<<3; /** * Indicates that the permissible user reaction(s) to this notification is OK. */ public static final int R_OK = 1; /** * Indicates that the permissible user reaction(s) to this notification is CANCEL. */ public static final int R_CANCEL = 1<<1; /** * Indicates that the permissible user reaction(s) to this notification is YES. */ public static final int R_YES = 1<<2; /** * Indicates that the permissible user reaction(s) to this notification is NO. */ public static final int R_NO = 1<<3; /** * Indicates that the permissible user reaction(s) to this notification is RETRY. */ public static final int R_RETRY = 1<<4; /** * Indicates that the permissible user reaction(s) to this notification is ABORT. */ public static final int R_ABORT = 1<<5; /** * Indicates that the permissible user reaction(s) to this notification is IGNORE. */ public static final int R_IGNORE = 1<<6; /** * Indicates that the permissible user reaction(s) to this notification is OK or CANCEL. */ public static final int R_OK_CANCEL = R_OK | R_CANCEL; /** * Indicates that the permissible user reaction(s) to this notification is YES or NO. */ public static final int R_YES_NO = R_YES | R_NO; /** * Indicates that the permissible user reaction(s) to this notification is YES, NO or CANCEL. */ public static final int R_YES_NO_CANCEL = R_YES | R_NO | R_CANCEL; /** * Indicates that the permissible user reaction(s) to this notification is RETRY or CANCEL. */ public static final int R_RETRY_CANCEL = R_RETRY | R_CANCEL; /** * Indicates that the permissible user reaction(s) to this notification is ABORT, RETRY or IGNORE. */ public static final int R_ABORT_RETRY_IGNORE = R_ABORT | R_RETRY | R_IGNORE; /** * Returns the type of this notification, that is one of the constants with praefix T_. * If no type is set, this defaults to T_ERROR. */ public int getType(); /** * Returns the permissible user reaction to the notification which is one of the constants * starting with R_. You will get a bit or combination of constants. If you * did set a constant that combines some others, like R_YES_NO, the bit or * combination of R_YES and R_NO is returned. */ public int getReaction(); /** * Returns a short text explaining this notification. This text is optional. If not set, * it defaults to a text derived from type. The returned String is never null. */ public String getShortMessage(); /** * Returns a fully descriptive text of this notification. The returned text is never null. */ public String getMessage(); /** * Returns the code. The code should be used to discrimitate amongst * different kinds of notifications. It should be a number that is unique amongst all applications. * The returned code is zero if it has not been set, i.e., zero is a reserved code. */ public int getCode (); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy