com.ibm.dse.tools.workbench.base
Class InstanceErrorsTable

java.lang.Object
  |
  +--com.ibm.dse.tools.workbench.base.AbstractTable
        |
        +--com.ibm.dse.tools.workbench.base.InstanceErrorsTable

public class InstanceErrorsTable
extends AbstractTable

This class represents a table of instance errors


Field Summary
static int CODE
          The identifier for the CODE column
static int ERRERRFK
          The identifiers for the relationship ATTATTFK
static int INSTANCE
          The identifier for the INSTANCE column
static int MESSAGE
          The identifier for the MESSAGE column
static int PARAMETERS
          The identifier for the PARAMETERS column
static int PROPAGATED_ERROR
          The identifier for the PROPAGATED_ERROR column
static int PROPERTY
          The identifier for the PROPERTY column
protected  java.util.Hashtable rowsByInstance
          The list of cached rows
 
Fields inherited from class com.ibm.dse.tools.workbench.base.AbstractTable
alias, checks, columnLengths, columns, DATA_DELIMITER, DATA_SEPARATOR, deletedRows, ESCAPE_SEQUENCE, fks, indexes, insertedRows, modifiedRows, name, pk, relations, repository, required, rows, triggers
 
Constructor Summary
InstanceErrorsTable(Repository rpstry)
          This constructor creates a InstanceErrorsTable object in a repository
 
Method Summary
 void add(TableRow row)
          This method adds a row to the list of rows.
 void addCompositionError(TableRow instance, java.lang.String message, java.lang.String params)
          This method adds a Composition error to the InstanceErrorTable, and propagates it.
 TableRow addError(TableRow instance, TableRow property, java.lang.String message, java.lang.String params)
          This method adds an error to the InstanceErrorTable, and propagates it.
 void addPropertyError(TableRow instance, TableRow property, java.lang.String message, java.lang.String params)
          This method adds an error to the InstanceErrorTable, and propagates it.
protected  void alterInstanceCode(TableRow origInstance, TableRow finalInstance)
          Changes the related rows pointing to a parent row to point to a new parent row.
protected  void alterPropertyCode(TableRow origProperty, TableRow finalProperty)
          Changes the related rows pointing to a parent row to point to a new parent row.
 java.lang.String[] buildErrorMessage(TableRow instance)
          This method builds the error messages related to this instance.
 void createRelations()
          This method creates the relationships for a table
 void deleteCompositionError(TableRow instance)
          This method deletes a composition error and all the propagated errors from the InstanceErrorTable.
 void deleteError(TableRow errorRow)
          This method deletes an error and all the propagated errors from the InstanceErrorTable.
 void deletePropertyError(TableRow instance, TableRow property)
          This method deletes a property error from the InstanceErrorTable, and all the propagated errors.
 TableRow getAttribute(TableRow property)
          Returns the row representing the attribute definition of a property
 boolean hasSelfGeneratedPk()
          This method indicates if the field in the primary key must be generated automatically
 void postDelete(TableRow row)
          This method is called after a row is deleted
 void removeFromList(TableRow row)
          This method removes this row from the error list
 void restoreRows()
          This method restores the mapped rows when doing a rollback
 TableRow[] retrieveErrorsByInstance(TableRow instance)
          Returns the Error rows related to the instance passed as parameter
 java.lang.String[] validate(TableRow row)
          This abstract method must validate the correctness of a row based on the rules of each object
 
Methods inherited from class com.ibm.dse.tools.workbench.base.AbstractTable
areTriggersActive, cleanRollbackData, count, createTableRow, createTableRow, exportToFile, flush, getAlias, getChecks, getChecks, getColumnLengths, getColumns, getColumnsString, getColumnsString, getConnection, getCreateChecksStrings, getCreateFksStrings, getCreateIndexesStrings, getCreatePkString, getCreateTableString, getDefaultVersion, getFks, getIndexes, getName, getPk, getPkValue, getRelated, getRelations, getRepository, getTimestamp, getUniqueValue, importFromString, isInPk, isRequired, postInsert, postUpdate, preDelete, preInsert, preUpdate, registerDeletedRow, registerInsertedRow, registerModifiedRow, retrieveAll, retrieveByPk, retrieveDistinct, setAlias, setRepository, setTriggersState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CODE

public static final int CODE
The identifier for the CODE column

INSTANCE

public static final int INSTANCE
The identifier for the INSTANCE column

PROPERTY

public static final int PROPERTY
The identifier for the PROPERTY column

PROPAGATED_ERROR

public static final int PROPAGATED_ERROR
The identifier for the PROPAGATED_ERROR column

MESSAGE

public static final int MESSAGE
The identifier for the MESSAGE column

PARAMETERS

public static final int PARAMETERS
The identifier for the PARAMETERS column

ERRERRFK

public static final int ERRERRFK
The identifiers for the relationship ATTATTFK

rowsByInstance

protected java.util.Hashtable rowsByInstance
The list of cached rows
Constructor Detail

InstanceErrorsTable

public InstanceErrorsTable(Repository rpstry)
This constructor creates a InstanceErrorsTable object in a repository
Parameters:
rpstry - com.ibm.dse.tools.workbench.base.DefaultRepository The repository in wich create the table
Method Detail

add

public void add(TableRow row)
This method adds a row to the list of rows. This method overwrites the AbstractTable.add(TableRow) method
Overrides:
add in class AbstractTable
Parameters:
row - com.ibm.dse.tools.workbench.base.TableRow

addCompositionError

public void addCompositionError(TableRow instance,
                                java.lang.String message,
                                java.lang.String params)
                         throws RepositoryException
This method adds a Composition error to the InstanceErrorTable, and propagates it.
Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The InstanceError row.
message - java.lang.String The error message
params - java.lang.String The error message parameters
Throws:
RepositoryException - An error occurred while propagating errors

addError

public TableRow addError(TableRow instance,
                         TableRow property,
                         java.lang.String message,
                         java.lang.String params)
                  throws RepositoryException
This method adds an error to the InstanceErrorTable, and propagates it.
Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The instance row.
property - com.ibm.dse.tools.workbench.base.TableRow The property row.
message - java.lang.String The error message
params - java.lang.String The error message parameters
Returns:
com.ibm.dse.tools.workbench.base.TableRow
Throws:
RepositoryException - An error occurred while propagating errors

addPropertyError

public void addPropertyError(TableRow instance,
                             TableRow property,
                             java.lang.String message,
                             java.lang.String params)
                      throws RepositoryException
This method adds an error to the InstanceErrorTable, and propagates it.
Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The InstanceError row.
property - com.ibm.dse.tools.workbench.base.TableRow The Property row.
message - java.lang.String The error message
parms - java.lang.String The error message parameters
Throws:
RepositoryException - An error occurred while propagating errors

alterInstanceCode

protected void alterInstanceCode(TableRow origInstance,
                                 TableRow finalInstance)
                          throws WorkbenchException
Changes the related rows pointing to a parent row to point to a new parent row.

In addition of altering the fk fields in the related rows so that they change their parent, it also changes the value at their Code column, if applies (that is if they have selfgenerated primary key).

Parameters:
origInstance - com.ibm.dse.tools.workbench.base.TableRow the initial parent row
finalInstance - com.ibm.dse.tools.workbench.base.TableRow the new parent row.
Throws:
WorkbenchException - An error ocurred while altering the related rows.

alterPropertyCode

protected void alterPropertyCode(TableRow origProperty,
                                 TableRow finalProperty)
                          throws WorkbenchException
Changes the related rows pointing to a parent row to point to a new parent row.

In addition of altering the fk fields in the related rows so that they change their parent, it also changes the value at their Code column, if applies (that is if they have selfgenerated primary key).

Parameters:
origProperty - com.ibm.dse.tools.workbench.base.TableRow the initial parent row
finalProperty - com.ibm.dse.tools.workbench.base.TableRow the new parent row.
Throws:
WorkbenchException - An error ocurred while altering the related rows.

buildErrorMessage

public java.lang.String[] buildErrorMessage(TableRow instance)
                                     throws RepositoryException
This method builds the error messages related to this instance.
Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The error row
Returns:
String [] The error messages.
Throws:
RepositoryException - An error occurred while propagating errors

createRelations

public void createRelations()
                     throws WBInvalidArgumentException
This method creates the relationships for a table
Overrides:
createRelations in class AbstractTable
Throws:
WBInvalidArgumentException - There is an error creating relationships.

deleteCompositionError

public void deleteCompositionError(TableRow instance)
                            throws RepositoryException
This method deletes a composition error and all the propagated errors from the InstanceErrorTable.
Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The InstanceError row.
Throws:
RepositoryException - An error occurred while propagating errors

deleteError

public void deleteError(TableRow errorRow)
                 throws WorkbenchException
This method deletes an error and all the propagated errors from the InstanceErrorTable.
Parameters:
errorRow - com.ibm.dse.tools.workbench.base.TableRow The InstanceError row.
Throws:
RepositoryException - An error occurred while propagating errors

deletePropertyError

public void deletePropertyError(TableRow instance,
                                TableRow property)
                         throws WorkbenchException
This method deletes a property error from the InstanceErrorTable, and all the propagated errors.
Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The InstanceError row.
property - com.ibm.dse.tools.workbench.base.TableRow The Property
Throws:
RepositoryException - An error occurred while propagating errors

getAttribute

public TableRow getAttribute(TableRow property)
                      throws WorkbenchException
Returns the row representing the attribute definition of a property
Parameters:
property - com.ibm.dse.tools.workbench.base.TableRow
Returns:
com.ibm.dse.tools.workbench.base.TableRow
Throws:
WorkbenchException -  

hasSelfGeneratedPk

public boolean hasSelfGeneratedPk()
This method indicates if the field in the primary key must be generated automatically
Overrides:
hasSelfGeneratedPk in class AbstractTable
Returns:
boolean

postDelete

public void postDelete(TableRow row)
                throws RepositoryException
This method is called after a row is deleted
Overrides:
postDelete in class AbstractTable
Parameters:
row - com.ibm.dse.tools.workbench.base.TableRow
Throws:
RepositoryException -  

removeFromList

public void removeFromList(TableRow row)
This method removes this row from the error list
Overrides:
removeFromList in class AbstractTable
Parameters:
row - com.ibm.dse.tools.workbench.base.TableRow. Error row
Throws:
WorkbenchException -  

restoreRows

public void restoreRows()
This method restores the mapped rows when doing a rollback
Overrides:
restoreRows in class AbstractTable

retrieveErrorsByInstance

public TableRow[] retrieveErrorsByInstance(TableRow instance)
                                    throws WorkbenchException
Returns the Error rows related to the instance passed as parameter

The retrieved rows are added to the list, for cache purpose

Parameters:
instance - com.ibm.dse.tools.workbench.base.TableRow The instance whose errors would be retrieved
Returns:
com.ibm.dse.tools.workbench.base.TableRow[] The Error rows
Throws:
WorkbenchException - An error ocurred while retrieving the errors

validate

public java.lang.String[] validate(TableRow row)
Description copied from class: AbstractTable
This abstract method must validate the correctness of a row based on the rules of each object

It returns the list of error strings or null if there are no errors

Overrides:
validate in class AbstractTable
Tags copied from class: AbstractTable
Parameters:
com.ibm.dse.tools.workbench.base.TableRow - the row to validate
Returns:
java.lang.String[]