Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.5.0)

E10653-06


oracle.jbo.common
Class JboExceptionHelper

java.lang.Object
  extended by oracle.jbo.common.PropertiesHelper
      extended by oracle.jbo.common.JboExceptionHelper

All Implemented Interfaces:
java.io.Serializable, ExprWrappable, Properties
Direct Known Subclasses:
JboExHelperLocalized

public class JboExceptionHelper
extends PropertiesHelper

The top-level class for Business Component exceptions.

This class provides tools for localizing exception messages for various target languages, and for message formatting.

Message-text localization occurs when the client calls getLocalizedMessage(), rather than at time the exception occurs, because the client may need to present the message in a number of different languages.

The components of a message are:

Additional components may be introduced in future.

A counterpart subclass of ResourceBundle, JboExceptionBundle, is used to determine the overall formatting of the message. The default format is

productCode-errorCode: messageBody

For example, ORA-10234: I don't think so.

Most subclasses wll provide a value for the error code in a specialized constructor.

Applications may define subclasses of most JBO exceptions. To do this the application should override the following methods to provide the correct set of values for the messaging services:

Other methods may be overridden to modify the message format.

Since:
JDeveloper 3.0
See Also:
JboExHelperLocalized, JboException, Serialized Form

Field Summary
static int SEVERITY_ERROR
           
static int SEVERITY_RAC_RECOVERABLE_ERROR
           
static int SEVERITY_RECOVERABLE_ERROR
           
static int SEVERITY_VETOABLE_WARNING
           
static int SEVERITY_WARNING
           

 

Fields inherited from class oracle.jbo.common.PropertiesHelper
mProperties

 

Constructor Summary
JboExceptionHelper(JboMessage ex, java.lang.String msg, java.lang.String errorCode, java.lang.Object[] params)
          Creates a translatable exception.

 

Method Summary
 void addToDetails(java.lang.Object obj)
          Adds to the list of details.
 java.lang.String getBaseMessage()
          Gets the message without localizing it or inserting parameters.
 java.lang.String getDetailMessage()
          Constructs a message incorporating the list of details.
 java.lang.Object[] getDetails()
          Gets the list of objects and exceptions that spawned this message.
 java.util.ArrayList getDetailsList()
           
 java.lang.String getErrorCode()
          Gets the error code.
protected  java.lang.String getErrorMsg(java.util.Locale l, java.lang.Object[] params)
           
protected  java.lang.String getErrorMsgFormat(java.util.Locale l)
          Return the default format to print messages in.
protected  java.lang.String getErrorMsgWithNamedTokens(java.util.Locale l, java.util.Map<java.lang.String,java.lang.Object> params)
           
 java.lang.Object[] getErrorParameters()
          Gets the error message parameters.
 java.util.Map getErrorParametersMap()
           
 java.lang.String getLocalizedBaseMessage(java.util.Locale l)
          Localizes an un-parameterized message text for a specific Locale.
 java.lang.String getLocalizedMessage(java.util.Locale l)
          Formats the message text for a specific Locale.
 java.lang.String getMessage()
          Formats the message text for the default locale.
 java.lang.String getProductCode()
          Gets the product code.
 java.util.Hashtable getProperties()
          Gets the table of properties.
 java.lang.Class getResourceClass()
          Gets the resource bundle used to localize messages.
 java.lang.String getResourceName()
          Gets the name of the ResourceBundle used to localize messages.
 int getSeverity()
           
 boolean isAppendCodes()
          Returns true if this exception has to prefix the error message with Product and Message Ids.
 void setAppendCodes(boolean flag)
          Set false if this exception should not prefix the error message with Product and Message Ids.
 void setDetails(java.lang.Object[] details)
          Sets the list of details.
 void setDetailsList(java.util.ArrayList details)
          Sets the list of details.
 void setErrorParameters(java.lang.Object[] params)
          Resets the error parameters.
 void setErrorParametersMap(java.util.Map params)
           
 void setLocaleContext(LocaleContext locale)
          Set the default locale for this exception to the given locale.
 void setSeverity(int severity)
           

 

Methods inherited from class oracle.jbo.common.PropertiesHelper
closeObject, getImageLoc, getProperty, getProperty, isReadOnly, refreshProperties, refreshProperty, setName, setProperty

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

SEVERITY_RAC_RECOVERABLE_ERROR

public static final int SEVERITY_RAC_RECOVERABLE_ERROR
See Also:
Constant Field Values

SEVERITY_RECOVERABLE_ERROR

public static final int SEVERITY_RECOVERABLE_ERROR
See Also:
Constant Field Values

SEVERITY_ERROR

public static final int SEVERITY_ERROR
See Also:
Constant Field Values

SEVERITY_WARNING

public static final int SEVERITY_WARNING
See Also:
Constant Field Values

SEVERITY_VETOABLE_WARNING

public static final int SEVERITY_VETOABLE_WARNING
See Also:
Constant Field Values

Constructor Detail

JboExceptionHelper

public JboExceptionHelper(JboMessage ex,
                          java.lang.String msg,
                          java.lang.String errorCode,
                          java.lang.Object[] params)
Creates a translatable exception.
Parameters:
ex - a Business Component error or warning.
msg - the default text of the message.
errorCode - error code; a key associated with a message in a resource bundle.
params - the error message's parameters.
See Also:
ResourceBundle

Method Detail

getMessage

public java.lang.String getMessage()
Formats the message text for the default locale.
Returns:
the localized message.

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.util.Locale l)
Formats the message text for a specific Locale.
Parameters:
l - a locale.
Returns:
the localized message.

getBaseMessage

public java.lang.String getBaseMessage()
Gets the message without localizing it or inserting parameters.
Returns:
the un-formatted, non-localized message.

getLocalizedBaseMessage

public java.lang.String getLocalizedBaseMessage(java.util.Locale l)
Localizes an un-parameterized message text for a specific Locale.
Parameters:
l - a locale.
Returns:
the localalized but un-formatted message.

getResourceName

public java.lang.String getResourceName()
Gets the name of the ResourceBundle used to localize messages.
Returns:
null.

getResourceClass

public java.lang.Class getResourceClass()
Gets the resource bundle used to localize messages.
Returns:
null.

getErrorParameters

public java.lang.Object[] getErrorParameters()
Gets the error message parameters.
Returns:
an array of objects.

getErrorParametersMap

public java.util.Map getErrorParametersMap()

setErrorParameters

public void setErrorParameters(java.lang.Object[] params)
Resets the error parameters. This method is for use by derived classes who create their own set of parameters but do not want the "thrower" to know about it.

setErrorParametersMap

public void setErrorParametersMap(java.util.Map params)

getErrorCode

public java.lang.String getErrorCode()
Gets the error code.
Returns:
a string containing an error code.

getProductCode

public java.lang.String getProductCode()
Gets the product code.
Returns:
the exception's product code.

getErrorMsg

protected java.lang.String getErrorMsg(java.util.Locale l,
                                       java.lang.Object[] params)

getErrorMsgWithNamedTokens

protected java.lang.String getErrorMsgWithNamedTokens(java.util.Locale l,
                                                      java.util.Map<java.lang.String,java.lang.Object> params)

getErrorMsgFormat

protected java.lang.String getErrorMsgFormat(java.util.Locale l)
Return the default format to print messages in. When the exception system cannot load the Format information required to format messages for printing, it calls this method to obtain the required information.

In general, the Message format consists of 3 elements, these are:

  1. product code from getProductCode
  2. error code from getErrorCode
  3. error message text loaded from the resource bundle
This method returns a string of the form "{0}-{1}: {2}". An example message in this form might look like:
JBO-100: A Mandatory attribute is missing.
Parameters:
l - the locale for the formatted message.
Returns:
a format string to format the printed message.

getDetails

public java.lang.Object[] getDetails()
Gets the list of objects and exceptions that spawned this message.
Returns:
an array.

getDetailMessage

public java.lang.String getDetailMessage()
Constructs a message incorporating the list of details.
Returns:
a text string.

setDetails

public void setDetails(java.lang.Object[] details)
Sets the list of details.
Parameters:
details - an array which replaces the current list of details.

setDetailsList

public void setDetailsList(java.util.ArrayList details)
Sets the list of details.
Parameters:
details - an array which replaces the current list of details.

getDetailsList

public java.util.ArrayList getDetailsList()

addToDetails

public void addToDetails(java.lang.Object obj)
Adds to the list of details.
Parameters:
obj - an object to add to the details list.

isAppendCodes

public boolean isAppendCodes()
Returns true if this exception has to prefix the error message with Product and Message Ids.

setAppendCodes

public void setAppendCodes(boolean flag)
Set false if this exception should not prefix the error message with Product and Message Ids. By default this flag is set to true.

setLocaleContext

public void setLocaleContext(LocaleContext locale)
Set the default locale for this exception to the given locale. This locale will be used when returning message from getMessage.

getProperties

public java.util.Hashtable getProperties()
Description copied from interface: Properties
Gets the table of properties.
Specified by:
getProperties in interface Properties
Overrides:
getProperties in class PropertiesHelper
Returns:
a hashtable of properties.

getSeverity

public int getSeverity()

setSeverity

public void setSeverity(int severity)

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.5.0)

E10653-06


Copyright © 1997, 2011, Oracle. All rights reserved.