org.palo.api.persistence
Interface PersistenceError

All Known Implementing Classes:
PersistenceErrorImpl

public interface PersistenceError

A PersistenceError describes an error which could happen during the loading or saving of jpalo subjects like Subsets or CubeViews. This class provides methods and constants to get detailed information about what went wrong...

The example below shows how to receive more information on an UNKNOWN_ELEMENT error during cube view loading:

 if(error.getType() == PersistenceError.UNKNOWN_ELEMNT) {
        CubeView view = (CubeView)error.getSource();
        String missingElementID = error.getCause();             //get error cause
        Dimension dimension = (Dimension)error.getLocation();   //at location
        System.err.println("Error during loading of cube view: "+view.getName());
        System.err.println("Could not find element with id '"+missingElementID+"' in dimension '"+dimension.getName()+"'!!");
        if(error.getTargetType() == PersistenceError.TARGET_EXPANDED_PATH) {
                System.err.println("Element was part of expanded path!");
                Object section = error.getSection();
                if(section instanceof Axis) 
                        System.err.println("\tof axis: "+((Axis)section).getId();
        }
 }

Version:
$Id: PersistenceError.html,v 1.15 2009/07/09 11:01:47 ArndHouben Exp $

Field Summary
static int[] ALL_ERROR_TYPES
           
static int LOADING_FAILED
           
static int TARGET_EXPANDED_PATH
           
static int TARGET_GENERAL
           
static int TARGET_HIDDEN_PATH
           
static int TARGET_SELECTED
           
static int TARGET_SUBSET
           
static int TARGET_UNKNOWN
           
static int UNKNOWN_AXIS
           
static int UNKNOWN_CUBE_VIEW
           
static int UNKNOWN_DIMENSION
           
static int UNKNOWN_ELEMENT
           
static int UNKNOWN_ERROR
           
static int UNKNOWN_PATH
           
static int UNKNOWN_SUBSET
           
 
Method Summary
 java.lang.String getCause()
          Returns the cause of this error depending on the type of error.
 java.lang.Object getLocation()
          Returns the location where this error was initiated, e.g. if a dimension could not be found this will return its containing database
 java.lang.String getMessage()
          Returns the error message
 java.lang.Object getSection()
          Returns the section where the error occurs, e.g. if the error source is a CubeView the section could be an Axis.
 java.lang.Object getSource()
          Returns the source which causes this error, e.g. a CubeView or a Subset If no source was determined null is returned
 java.lang.String getSourceId()
          Returns the id of the source which causes this error, e.g. the id of a CubeView.
 int getTargetType()
          Returns one of the defined target constants which describes the target at which the error occurred, e.g. if the error is of type UNKNOWN_ELEMENT the target type could be a TARGET_EXPANDED_PATH meaning that the unknown element was detected at an expanded path.
 int getType()
          Returns one of the defined error constants to describe the kind of error
 

Field Detail

UNKNOWN_ERROR

static final int UNKNOWN_ERROR
See Also:
Constant Field Values

UNKNOWN_DIMENSION

static final int UNKNOWN_DIMENSION
See Also:
Constant Field Values

UNKNOWN_ELEMENT

static final int UNKNOWN_ELEMENT
See Also:
Constant Field Values

UNKNOWN_CUBE_VIEW

static final int UNKNOWN_CUBE_VIEW
See Also:
Constant Field Values

UNKNOWN_AXIS

static final int UNKNOWN_AXIS
See Also:
Constant Field Values

UNKNOWN_SUBSET

static final int UNKNOWN_SUBSET
See Also:
Constant Field Values

UNKNOWN_PATH

static final int UNKNOWN_PATH
See Also:
Constant Field Values

LOADING_FAILED

static final int LOADING_FAILED
See Also:
Constant Field Values

TARGET_UNKNOWN

static final int TARGET_UNKNOWN
See Also:
Constant Field Values

TARGET_GENERAL

static final int TARGET_GENERAL
See Also:
Constant Field Values

TARGET_SELECTED

static final int TARGET_SELECTED
See Also:
Constant Field Values

TARGET_EXPANDED_PATH

static final int TARGET_EXPANDED_PATH
See Also:
Constant Field Values

TARGET_HIDDEN_PATH

static final int TARGET_HIDDEN_PATH
See Also:
Constant Field Values

TARGET_SUBSET

static final int TARGET_SUBSET
See Also:
Constant Field Values

ALL_ERROR_TYPES

static final int[] ALL_ERROR_TYPES
Method Detail

getSource

java.lang.Object getSource()
Returns the source which causes this error, e.g. a CubeView or a Subset If no source was determined null is returned

Returns:
the error source or null

getSourceId

java.lang.String getSourceId()
Returns the id of the source which causes this error, e.g. the id of a CubeView. Note that if getSource() returns null that does not automatically mean that this method returns null too!

Returns:
the id of the error source instance or null

getLocation

java.lang.Object getLocation()
Returns the location where this error was initiated, e.g. if a dimension could not be found this will return its containing database

Returns:
the location where this error started or null if none could be determined

getCause

java.lang.String getCause()
Returns the cause of this error depending on the type of error. E.g. if a dimension could not be found this method will return the dimension id.

Returns:
the cause of this error or null if it could not be determined

getSection

java.lang.Object getSection()
Returns the section where the error occurs, e.g. if the error source is a CubeView the section could be an Axis. If no section could be determined null is returned.

Returns:
the error section or null

getTargetType

int getTargetType()
Returns one of the defined target constants which describes the target at which the error occurred, e.g. if the error is of type UNKNOWN_ELEMENT the target type could be a TARGET_EXPANDED_PATH meaning that the unknown element was detected at an expanded path.

Returns:
defined target type constants

getType

int getType()
Returns one of the defined error constants to describe the kind of error

Returns:
one of the defined error constants

getMessage

java.lang.String getMessage()
Returns the error message

Returns:
error message