pt.moredata.dao
Interface DataAccessObject

All Superinterfaces:
DAOView

public interface DataAccessObject
extends DAOView

Gere acessos a dados tabulares lidos de um data source.
Aborda-se a interacção com os dados a um nivel mais elevado permitindo assim ao utilizador concentrar-se na sua lógica de programação em vez de codificar o acesso aos dados.
Mantem associado a toda a informação um conjunto de flags que depois permitem a sincronização dos dados em memória com os do data source.
Nesta fase suporta os seguintes data sources:


Wish List Company MoreData

Version:
2.0, $Revision: 1.17 $
Author:
Paulo Carmo, Ricardo Amaro, Sergio Ferreira
See Also:
DataBaseTable, DataCell, MetaField, DataRecordSet, DataRow, DataSource

Field Summary
 
Fields inherited from interface pt.moredata.dao.DAOView
DYNASET, INDIVIDUAL_UPDATE, SNAPSHOT, SUPERSET_UPDATE, UNKNOWN
 
Method Summary
 void addAllColumnsFromTable()
          Add all columns from all tables to the DataAccessObject.
 void addAllColumnsFromTable(java.lang.String tableName)
          Add all columns from one table to the DataAccessObject.
 void addApplyListener(DAOApplyListener listener)
          Adds a new DAOApplyListener to this DataAccessObject.
 void addColumn(java.lang.String columnName)
          Add a new column to the DataAccessObject from the only table of the DataAccessObject.
 void addColumn(java.lang.String tableName, java.lang.String columnName)
          Add a new column to the DataAccessObject from a giveen table.
 void addColumn(java.lang.String tableName, java.lang.String columnName, boolean isPKPart)
          Add a new column to the DataAccessObject from a giveen table.
 void addDeleteListener(DAODeleteListener listener)
          Adds a new DAODeleteListener to this DataAccessObject.
 void addDescColumn(java.lang.String descColumn)
           
 void addInsertListener(DAOInsertListener listener)
          Adds a new DAOInsertListener to this DataAccessObject.
 void addJoinClause(java.lang.String whereString)
          Add a join clause to the DataAccessObject.
 void addMetaField(MetaField metaField)
          Deprecated. This method will be removed and will not have a replacment.
 void addOrderBy(java.lang.String columnName)
          Add a column name to the orderby list to be used by the query method.
 void addPkColumn(java.lang.String pkColumn)
          Deprecated. Use method addColumn(String tableName, String columnName, isPKPart) instead.
 void addPkColumn(java.lang.String tableName, java.lang.String pkColumn)
          Deprecated. Use method addColumn(String tableName, String columnName, isPKPart) instead.
 void addPkToListMap(java.util.Collection pKey, int rowNumber)
          Deprecated. This method will be removed and will not have a replacment.
 void addQueryListener(DAOQueryListener listener)
          Adds a new DAOQueryListener to this DataAccessObject.
 void addRowAppliedListener(DAORowAppliedListener listener)
          Adds a new DAORowAppliedListener to this DataAccessObject.
 void addRowRetrivedListener(DAORowRetrivedListener listener)
          Deprecated. This listener will be removed soon. With the introduction of the Reader interface, the data is no longer readed by the DataAcessObject, so ther is no way of fireing the even.
 void addSecTable(DataBaseTable table)
          Deprecated. Use addTable(String tableName) instead.
 void addSecTable(java.lang.String tableName)
          Deprecated. Use addTable(String tableName) instead.
 void addSecTable(java.lang.String tableName, java.lang.String tableAlias)
          Deprecated. Use addTable(String tableName) instead.
 void addTable(java.lang.String tableName)
          Add a new table to the DataAccessObject.
 void addTable(java.lang.String tableName, java.lang.String joinClause)
          Add a new table to the DataAccessObject.
 void addTable(java.lang.String tableName, java.lang.String tableAlias, java.lang.String joinClause)
          Add a new table to the DataAccessObject.
 void addUpdateListener(DAOUpdateListener listener)
          Adds a new DAOUpdateListener to this DataAccessObject.
 void apply()
          Update the repository with the DataAccessObject data.
 void apply(int rowNumber)
          Update a row of the repository with the DataAccessObject data for that row.
 void backupPk(int rowNum)
          Deprecated. This method will be removed and will not have a replacment.
 void clear()
          Remove all row from the DataAccessObject.
 void clearAllSecTables()
          Deprecated. Use method removeTable(String tableName) instead.
 void clearJoinClauses()
          Remove all join clauses added by the addJoinClause(String whereString) method.
 void clearMetaFieldAt(int index)
          Deprecated. This method will be removed and will not have a replacment.
 void clearMetaFields()
          Deprecated. This method will be removed and will not have a replacment.
 void clearOrderBy()
          Remove all column names from the orderby list added by the addOrderBy(String columnName) method.
 void clearRecordSet()
          Deprecated. Use method clear() instead.
 void clearSecTable(java.lang.String tableName)
          Deprecated. Use method removeTable(String tableName) instead.
 void clearSecTableAt(int index)
          Deprecated. Use method removeTable(String tableName) instead.
 void clearWhereStr()
          Delete the whereString clause used by the query method.
 void delete()
          Deprecated. Use method clear() instead.
 void delete(int rowNumber)
          Deprecated. Use deleteFromDataSource(int rowNumber) instead.
 void deleteFromDAO(int rowNumber)
          Delete a row from the DataAccessObject.
 void deleteFromDataSource(int rowNumber)
          Delete a row from the repository only.
 void deleteRow(int rowNumber)
          Deprecated. Use deleteFromDAO(int rowNumber) instead.
 int getBadRowNumber()
          Get the value of badRowNumber.
 DAOFieldsInfo getDAOFieldsInfo()
          Return the DAOFieldsInfo object with information about this DataAccessObject columns and tables.
 DataMetaField getDataMetaField(int numField)
          Deprecated. Use method getMetaField(int numField) instead.
 DataMetaField getDataMetaField(java.lang.String fieldName)
          Deprecated. Use method getMetaField(String fieldName) instead.
 int getDataSourceAction(int rowNumber)
          Return the code for the action to be executed by the applay method for a giveen row.
 java.util.ArrayList getDataSourcePk(int rowNumber)
          Return the primary key value for a DataAccessObject row exactly like it was readed from the repository.
 MetaField getMetaField(java.lang.String columnName)
          Return the meta field information for a giveen column name.
 MetaField getMetaField(java.lang.String tableName, java.lang.String columnName)
          Return the meta field information for a giveen column name.
 java.lang.String[] getOrderBy()
          Return an array with all the columns names of the orderby list.
 java.lang.String getOrderBy(int index)
          Return the column name at a specific index of the orderby list.
 int getQueryPolicy(java.lang.String columnName)
          Returns the policy used by DAOView query method for a giveen column.
 int getQueryPolicy(java.lang.String tableName, java.lang.String columnName)
          Returns the policy used by DAOView query method for a giveen column.
 RecordSet getRecordSet()
          Return the RecordSet of the DataAccessObject.
 DataTableInfo getTableInfo()
          Return a DataTableInfo object with information about the table of the DataAccessObject.
 DataTableInfo getTableInfo(java.lang.String tableName)
          Return a DataTableInfo object with information about a giveen table of the DataAccessObject.
 int getUpdateType()
          Returns the update policy of the DataAccessObject.
 java.lang.String getWhereStr()
          Return the whereString clause to be used by the query method.
 void insert(int rowNumber)
          Insert a giveen row from the DataAccessObject into the repository.
 boolean isDescColumn(java.lang.String descColumn)
          Deprecated. Use the method isColumn(String columnName) instead.
 void query()
          Query the repository and load the data into the DataaccessObject.
 java.util.ArrayList queryByPk(java.util.List selectList, java.util.List pk)
          Deprecated. This method will be removed and will not have a replacment.
 void removeApplyListener(DAOApplyListener listener)
          Removes a DAOApplyListener from this DataAccessObject.
 void removeColumn(java.lang.String columnName)
          Remove a column from the DataAccessObject.
 void removeColumn(java.lang.String tableName, java.lang.String columnName)
          Remove a column from the DataAccessObject.
 void removeDeleteListener(DAODeleteListener listener)
          Removes a DAODeleteListener from this DataAccessObject.
 void removeInsertListener(DAOInsertListener listener)
          Removes a DAOInsertListener from this DataAccessObject.
 void removeQueryListener(DAOQueryListener listener)
          Removes a DAOQueryListener from this DataAccessObject.
 void removeRowAppliedListener(DAORowAppliedListener listener)
          Removes a DAORowAppliedListener from this DataAccessObject.
 void removeRowRetrivedListener(DAORowRetrivedListener listener)
          Deprecated. This listener will be removed soon. With the introduction of the Reader interface, the data is no longer readed by the DataAcessObject, so ther is no way of fireing the even.
 void removeTable(java.lang.String tableName)
          Removes a table and the corresponding MetaField's from the DataAccessObject.
 void removeUpdateListener(DAOUpdateListener listener)
          Removes a DAOUpdateListener from this DataAccessObject.
 void setCellAt(int rowNum, int columnNum, java.lang.Object obj)
          Deprecated. Use the method setCellAt(int rowNum, String name, Object obj) instead.
 void setCellAt(int rowNum, int columnNum, java.lang.Object obj, boolean engineProcessed)
          Deprecated. Use the method setCellAt(int rowNum, String name, Object obj,boolean engineProcessed) instead.
 void setCellAt(int rowNumber, java.lang.String columnName, java.lang.Object obj)
          Changes the value of a cell of the DataAccessObject.
 void setCellAt(int rowNumber, java.lang.String columnName, java.lang.Object obj, boolean engineProcessed)
          Changes the value of a cell of the DataAccessObject.
 void setCellAt(int rowNumber, java.lang.String tableName, java.lang.String columnName, java.lang.Object obj)
          Changes the value of a cell of the DataAccessObject.
 void setCellAt(int rowNumber, java.lang.String tableName, java.lang.String columnName, java.lang.Object obj, boolean engineProcessed)
          Changes the value of a cell of the DataAccessObject.
 void setCounterColumn(int column, boolean value)
          Deprecated. This method will be removed and will not have a replacment.
 void setDataSource(DataSource dataSource)
          Change the DataSource object used to interact with the repository.
 void setDefaultValue(java.lang.String columnName, java.lang.Object value)
          Change the default value to be used in a insert statement when a cell value of a giveen column is null.
 void setDefaultValue(java.lang.String tableName, java.lang.String columnName, java.lang.Object value)
          Change the default value to be used in a insert statement when a cell value of a giveen column is null.
 void setDeleted(int rowNumber, boolean deleted)
          Change the deleted property of a row.
 void setDistinctQuery(boolean distinctQuery)
          If true the «distinct» keyword will be used in a query sql command.
 void setFixedValue(int column, java.lang.Object value)
          Deprecated. Use method setDefaultValue(String columnName, Object value) instead.
 void setMainTable(DataBaseTable mainTable)
          Deprecated. Use method addTableName(String tableName) instead.
 void setMainTable(java.lang.String tableName)
          Deprecated. Use method addTableName(String tableName) instead.
 void setMainTable(java.lang.String tableName, java.lang.String tableAlias)
          Deprecated. Use method addTableName(String tableName) instead.
 void setNewRow(boolean _newRow, int rowNum)
          Deprecated. Use method setNewRow(int rowNumber , boolean newRow) instead.
 void setNewRow(int rowNumber, boolean newRow)
          Change the newRow property of a row.
 void setOrderBy(int index, java.lang.String columnName)
          Change a column name at a specific index of the orderby list.
 void setOrderBy(java.lang.String[] columnNames)
          Rebuild the orderby list with a set of column names.
 void setQueryPolicy(java.lang.String columnName, int queryPolicy)
          Change the query policy for a column of the DAOView table.
 void setQueryPolicy(java.lang.String tableName, java.lang.String columnName, int queryPolicy)
          Changes the query policy for a column of a giveen table.
 void setTableName(java.lang.String _tableName)
          Deprecated. Use method addTableName(String tableName) instead.
 void setUpdateType(int policy)
          Set the update policy of the DataAccessObject.
 void setWhereStr(java.lang.String whereString)
          Change the whereString clause used by the query method.
 void sort()
          Deprecated. This method will be removed and will not have a replacment. Use class DAOSort to sort a DataAccessObject.
 void update(int rowNumber)
          Update a repository row with data from the DataAccessObject.
 
Methods inherited from interface pt.moredata.dao.DAOView
dump, dump, dumpMetaFields, dumpMetaFields, getBackupCellAt, getBackupCellAt, getCellAt, getCellAt, getCellAt, getCellAt, getCellAt, getCellByPk, getCellFromPk, getCellFromPk, getColumnName, getColumnNames, getColumnNumber, getColumnNumber, getColumns, getColumns, getColumns, getColumnsNames, getColumnsNames, getDataSource, getDataType, getDataType, getDataType, getDbType, getDSource, getPKColumnNames, getPKColumnNames, getPKName, getPKNameAndValue, getPKNameAndValue, getPKValue, getPKValue, getRowFromPk, getRowNumber, getRowNumber, getRows, getTableName, getTablesNames, hasPrimaryKey, hasPrimaryKey, isCellModified, isCellModified, isColumn, isColumn, isDeleted, isInsertColumn, isModified, isNewRow, isPkPart, isPkPart, isPkPart, isUpdateColumn
 

Method Detail

addAllColumnsFromTable

public void addAllColumnsFromTable(java.lang.String tableName)
                            throws UnknownTableNameException,
                                   AmbiguousTableNameException,
                                   DuplicatedColumnNameException
Add all columns from one table to the DataAccessObject. MetaData is read from the DataSource and a DataMetaField object is constructed for each column of the table. No data is read from the DataSource.

Parameters:
tableName - The table name.
Throws:
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.
DuplicatedColumnNameException - If a Metafield already exists with the same column name.

addAllColumnsFromTable

public void addAllColumnsFromTable()
                            throws DuplicatedColumnNameException
Add all columns from all tables to the DataAccessObject. MetaData is read from the DataSource and a DataMetaField object is constructed for each column of each table of the DataAccessObject. No data is read from the DataSource.

Throws:
DuplicatedColumnNameException - If a Metafield already exists with the same column name.

addApplyListener

public void addApplyListener(DAOApplyListener listener)
Adds a new DAOApplyListener to this DataAccessObject.

Parameters:
listener - The listener to be add.

addColumn

public void addColumn(java.lang.String columnName)
               throws UnknownColumnNameException,
                      AmbiguousTableException,
                      DuplicatedColumnNameException
Add a new column to the DataAccessObject from the only table of the DataAccessObject. The table must allready been added to the DataAccessObject. If the DataAccessObject has more than one table use the method addColumn(String, String) instead.

Parameters:
columnName - The column name.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousTableException - When the DataAccessObject has more than one table.
DuplicatedColumnNameException - If a Metafield already exists with the same column name.

addColumn

public void addColumn(java.lang.String tableName,
                      java.lang.String columnName)
               throws UnknownColumnNameException,
                      UnknownTableNameException,
                      AmbiguousTableNameException,
                      DuplicatedColumnNameException
Add a new column to the DataAccessObject from a giveen table. The table must allready been added to the DataAccessObject with the method addTable(String) or addTable(String, String) method.

Parameters:
tableName - The table that owns the column.
columnName - The column name.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.
DuplicatedColumnNameException - If a Metafield already exists with the same column name.

addColumn

public void addColumn(java.lang.String tableName,
                      java.lang.String columnName,
                      boolean isPKPart)
               throws UnknownColumnNameException,
                      UnknownTableNameException,
                      AmbiguousTableNameException,
                      DuplicatedColumnNameException
Add a new column to the DataAccessObject from a giveen table. The table must allready been added to the DataAccessObject with the method addTable(String) or addTable(String, String) method.

Parameters:
tableName - The table that owns the column.
columnName - The column name.
isPKPart - If true the column is added to the primary key list of the giveen table.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.
DuplicatedColumnNameException - If a Metafield already exists with the same column name.

addDeleteListener

public void addDeleteListener(DAODeleteListener listener)
Adds a new DAODeleteListener to this DataAccessObject.

Parameters:
listener - The listener to be add.

addInsertListener

public void addInsertListener(DAOInsertListener listener)
Adds a new DAOInsertListener to this DataAccessObject.

Parameters:
listener - The listener to add.

addJoinClause

public void addJoinClause(java.lang.String whereString)
Add a join clause to the DataAccessObject. Join clauses are added to the whereString clause of a query. Unlike whereString clause, join clause are presistent, i.e adding a second join clause will not delete the first one.

Parameters:
whereString - The join clause to be used in the query command.

addOrderBy

public void addOrderBy(java.lang.String columnName)
Add a column name to the orderby list to be used by the query method. Column names are added to the list by the same order which this method is invoked.

Parameters:
columnName - The name of the column to be added to the orderby list.

addQueryListener

public void addQueryListener(DAOQueryListener listener)
Adds a new DAOQueryListener to this DataAccessObject.

Parameters:
listener - The listener to add.

addRowAppliedListener

public void addRowAppliedListener(DAORowAppliedListener listener)
Adds a new DAORowAppliedListener to this DataAccessObject.

Parameters:
listener - The listener to add.

addRowRetrivedListener

public void addRowRetrivedListener(DAORowRetrivedListener listener)
Deprecated. This listener will be removed soon. With the introduction of the Reader interface, the data is no longer readed by the DataAcessObject, so ther is no way of fireing the even.

Adds a new DAORowRetrivedListener to this DataAccessObject.

Parameters:
listener - The listener to add.

addTable

public void addTable(java.lang.String tableName)
              throws DuplicatedTableNameException
Add a new table to the DataAccessObject.

Parameters:
tableName - The table name to be add.
Throws:
DuplicatedTableNameException - If there is a table with the same table name and no alias.

addTable

public void addTable(java.lang.String tableName,
                     java.lang.String joinClause)
              throws DuplicatedTableNameException
Add a new table to the DataAccessObject.

Parameters:
tableName - The table name to be add.
joinClause - The join clause to be use by the query method.
Throws:
DuplicatedTableNameException - If there is a table with the same table name and no alias.

addTable

public void addTable(java.lang.String tableName,
                     java.lang.String tableAlias,
                     java.lang.String joinClause)
              throws DuplicatedTableAliasException,
                     DuplicatedTableNameException
Add a new table to the DataAccessObject.

Parameters:
tableName - The table name to be add.
tableAlias - The alias for the table name. A table alias could be used in any method where the table name is requiered.
joinClause - The join clause to be use by the query method.
Throws:
DuplicatedTableAliasException - If this table alias is the same that another table name or alias.
DuplicatedTableNameException - If the tableAlias is null and there is a table with the same table name and no alias.

addUpdateListener

public void addUpdateListener(DAOUpdateListener listener)
Adds a new DAOUpdateListener to this DataAccessObject.

Parameters:
listener - The listener to add.

apply

public void apply(int rowNumber)
           throws NoTableDefinedException,
                  NoColumnDefinedException,
                  NoPrimaryKeyDefinedException,
                  RowIndexOutOfBoundsException,
                  WriterException
Update a row of the repository with the DataAccessObject data for that row. If the rows was changed in DataAccessObject it is updated in the repository, if the row is new it is inserted and if the rows was removed it is deleted from the repository. Changes made by others in the repository are not reflected in the DataAccessObject unless the query method is implicity executed.

Parameters:
rowNumber - The row number.
Throws:
NoTableDefinedException - If there is no table defined.
NoColumnDefinedException - If there is no column defined.
NoPrimaryKeyDefinedException - If there is no primary key defined.
WriterException - If there was an error reported by the repository.
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

apply

public void apply()
           throws NoTableDefinedException,
                  NoColumnDefinedException,
                  NoPrimaryKeyDefinedException,
                  WriterException
Update the repository with the DataAccessObject data. Rows that was changed in DataAccessObject are updated in the repository, new rows are inserted and rows that was removed from DataAccessObject are deleted from the repository Changes made by others in the repository are not reflected in the DataAccessObject unless the query method is implicity executed.

Throws:
NoTableDefinedException - If there is no table defined.
NoColumnDefinedException - If there is no column defined.
NoPrimaryKeyDefinedException - If there is no primary key defined.
WriterException - If there was an error reported by the repository.

clear

public void clear()
Remove all row from the DataAccessObject. The repository is not changed.


clearJoinClauses

public void clearJoinClauses()
Remove all join clauses added by the addJoinClause(String whereString) method. Join clauses added by the addTable(String tableName, String joinClause) are not removed.


clearOrderBy

public void clearOrderBy()
Remove all column names from the orderby list added by the addOrderBy(String columnName) method.


clearWhereStr

public void clearWhereStr()
Delete the whereString clause used by the query method.


deleteFromDataSource

public void deleteFromDataSource(int rowNumber)
                          throws RowIndexOutOfBoundsException,
                                 WriterException
Delete a row from the repository only. The row will be in DataAccessObject after be deleted from the repository.

Parameters:
rowNumber - The row number to be deleted.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
WriterException - When ther is an error writing to the repository.

deleteFromDAO

public void deleteFromDAO(int rowNumber)
                   throws RowIndexOutOfBoundsException
Delete a row from the DataAccessObject. The row is removed from the repository when and only when the apply() or apply(in rowNumber) method is executed.

Parameters:
rowNumber - The row number to be deleted.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getBadRowNumber

public int getBadRowNumber()
Get the value of badRowNumber.

Specified by:
getBadRowNumber in interface DAOView
Returns:
Value of badRowNumber.

getDAOFieldsInfo

public DAOFieldsInfo getDAOFieldsInfo()
Return the DAOFieldsInfo object with information about this DataAccessObject columns and tables.

Returns:
The DAOFieldsInfo object of this DataAccessObject.

getDataSourceAction

public int getDataSourceAction(int rowNumber)
                        throws RowIndexOutOfBoundsException
Return the code for the action to be executed by the applay method for a giveen row.

Specified by:
getDataSourceAction in interface DAOView
Parameters:
rowNumber - The row number.
Returns:
The action to be executed for the row number.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getDataSourcePk

public java.util.ArrayList getDataSourcePk(int rowNumber)
                                    throws RowIndexOutOfBoundsException
Return the primary key value for a DataAccessObject row exactly like it was readed from the repository.

Parameters:
rowNumber - The row number.
Returns:
A list of values for the primary columns.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getMetaField

public MetaField getMetaField(java.lang.String tableName,
                              java.lang.String columnName)
                       throws UnknownColumnNameException,
                              UnknownTableNameException,
                              AmbiguousTableNameException
Return the meta field information for a giveen column name.

Parameters:
tableName - The table name.
columnName - The column name.
Returns:
The meta field information for a giveen column name.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getMetaField

public MetaField getMetaField(java.lang.String columnName)
                       throws UnknownColumnNameException,
                              AmbiguousColumnNameException
Return the meta field information for a giveen column name.

Parameters:
columnName - The column name.
Returns:
The meta field information for a giveen column name.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

getOrderBy

public java.lang.String getOrderBy(int index)
Return the column name at a specific index of the orderby list.

Parameters:
index - The index in the orderby list.
Returns:
The column name at a specific index of the orderby list.

getOrderBy

public java.lang.String[] getOrderBy()
Return an array with all the columns names of the orderby list.

Returns:
An array with all the columns names of the orderby list.

getQueryPolicy

public int getQueryPolicy(java.lang.String tableName,
                          java.lang.String columnName)
                   throws UnknownColumnNameException,
                          UnknownTableNameException,
                          AmbiguousTableNameException
Returns the policy used by DAOView query method for a giveen column.

Parameters:
tableName - The table name.
columnName - The column name.
Returns:
The policy used by DAOView query method for a column.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getQueryPolicy

public int getQueryPolicy(java.lang.String columnName)
                   throws UnknownColumnNameException,
                          AmbiguousColumnNameException
Returns the policy used by DAOView query method for a giveen column.

Specified by:
getQueryPolicy in interface DAOView
Parameters:
columnName - The column name.
Returns:
The policy used by DAOView query method for a column.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

getRecordSet

public RecordSet getRecordSet()
Return the RecordSet of the DataAccessObject.

Returns:
The RecordSet of the DataAccessObject.

getTableInfo

public DataTableInfo getTableInfo(java.lang.String tableName)
                           throws UnknownTableNameException,
                                  AmbiguousTableNameException
Return a DataTableInfo object with information about a giveen table of the DataAccessObject.

Parameters:
tableName - The name of the table.
Returns:
A DataTableInfo object with information about a giveen table of the DataAccessObject.
Throws:
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getTableInfo

public DataTableInfo getTableInfo()
                           throws AmbiguousTableException
Return a DataTableInfo object with information about the table of the DataAccessObject. If the DataAccessObject hás more than one table use the method getTableInfo(String tableName) instead.

Returns:
A DataTableInfo object with information about the table of the DataAccessObject.
Throws:
AmbiguousTableException - When the DataAccessObject has more than one table.

getUpdateType

public int getUpdateType()
Returns the update policy of the DataAccessObject.

Specified by:
getUpdateType in interface DAOView
Returns:
The update policy of the DataAccessObject.

getWhereStr

public java.lang.String getWhereStr()
Return the whereString clause to be used by the query method.

Returns:
The whereString clause to be used by the query method.

insert

public void insert(int rowNumber)
            throws RowIndexOutOfBoundsException,
                   WriterException
Insert a giveen row from the DataAccessObject into the repository.

Parameters:
rowNumber - The row number to be inserted.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
WriterException - When ther is an error writing to the repository.

query

public void query()
           throws ReaderException,
                  NoTableDefinedException,
                  NoColumnDefinedException,
                  NullDataSourceException
Query the repository and load the data into the DataaccessObject. The whereString property is used to limited the data read from the repository.

Throws:
ReaderException - If there was an error reported by the repository.
NoTableDefinedException - If there is no table defined.
NoColumnDefinedException - If there is no column defined.
NullDataSourceException - If there is no DataSource defined.

removeApplyListener

public void removeApplyListener(DAOApplyListener listener)
Removes a DAOApplyListener from this DataAccessObject.

Parameters:
listener - The listener to add.

removeColumn

public void removeColumn(java.lang.String tableName,
                         java.lang.String columnName)
                  throws UnknownTableNameException,
                         AmbiguousTableNameException,
                         UnknownColumnNameException
Remove a column from the DataAccessObject.

Parameters:
tableName - The table that owns the column.
columnName - The column name.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

removeColumn

public void removeColumn(java.lang.String columnName)
                  throws UnknownColumnNameException,
                         AmbiguousTableException
Remove a column from the DataAccessObject.

Parameters:
columnName - The column name.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousTableException - When the DataAccessObject has more than one table.

removeDeleteListener

public void removeDeleteListener(DAODeleteListener listener)
Removes a DAODeleteListener from this DataAccessObject.

Parameters:
listener - The listener to add.

removeInsertListener

public void removeInsertListener(DAOInsertListener listener)
Removes a DAOInsertListener from this DataAccessObject.

Parameters:
listener - The listener to add.

removeQueryListener

public void removeQueryListener(DAOQueryListener listener)
Removes a DAOQueryListener from this DataAccessObject.

Parameters:
listener - The listener to add.

removeRowAppliedListener

public void removeRowAppliedListener(DAORowAppliedListener listener)
Removes a DAORowAppliedListener from this DataAccessObject.

Parameters:
listener - The listener to add.

removeRowRetrivedListener

public void removeRowRetrivedListener(DAORowRetrivedListener listener)
Deprecated. This listener will be removed soon. With the introduction of the Reader interface, the data is no longer readed by the DataAcessObject, so ther is no way of fireing the even.

Removes a DAORowRetrevedListener from this DataAccessObject.

Parameters:
listener - The listener to add.

removeTable

public void removeTable(java.lang.String tableName)
                 throws AmbiguousTableNameException
Removes a table and the corresponding MetaField's from the DataAccessObject.

Parameters:
tableName - The name of the table to be removed.
Throws:
AmbiguousTableNameException - When the supplied tableName exists more than once.

removeUpdateListener

public void removeUpdateListener(DAOUpdateListener listener)
Removes a DAOUpdateListener from this DataAccessObject.

Parameters:
listener - The listener to add.

setCellAt

public void setCellAt(int rowNumber,
                      java.lang.String tableName,
                      java.lang.String columnName,
                      java.lang.Object obj)
               throws UnknownColumnNameException,
                      UnknownTableNameException,
                      AmbiguousTableNameException,
                      RowIndexOutOfBoundsException
Changes the value of a cell of the DataAccessObject.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
tableName - The table name.
columnName - The column name.
obj - The cell new value.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setCellAt

public void setCellAt(int rowNumber,
                      java.lang.String columnName,
                      java.lang.Object obj)
               throws UnknownColumnNameException,
                      AmbiguousColumnNameException,
                      RowIndexOutOfBoundsException
Changes the value of a cell of the DataAccessObject.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnName - The column name.
obj - The cell new value.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setCellAt

public void setCellAt(int rowNumber,
                      java.lang.String tableName,
                      java.lang.String columnName,
                      java.lang.Object obj,
                      boolean engineProcessed)
               throws UnknownColumnNameException,
                      UnknownTableNameException,
                      AmbiguousTableNameException,
                      RowIndexOutOfBoundsException
Changes the value of a cell of the DataAccessObject.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
tableName - The table name.
columnName - The column name.
obj - The cell new value.
engineProcessed - True if the content of the cell is to be processed by the database engine. This will force a query to update the value of the cell after the update or insert.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setCellAt

public void setCellAt(int rowNumber,
                      java.lang.String columnName,
                      java.lang.Object obj,
                      boolean engineProcessed)
               throws UnknownColumnNameException,
                      AmbiguousColumnNameException,
                      RowIndexOutOfBoundsException
Changes the value of a cell of the DataAccessObject.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnName - The column name.
obj - The cell new value.
engineProcessed - True if the content of the cell is to be processed by the database engine. This will force a query to update the value of the cell after the update or insert.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setDataSource

public void setDataSource(DataSource dataSource)
Change the DataSource object used to interact with the repository.

Parameters:
dataSource - The new DataSource object.

setDeleted

public void setDeleted(int rowNumber,
                       boolean deleted)
                throws RowIndexOutOfBoundsException
Change the deleted property of a row.

Parameters:
deleted - True to change the row to deleted, false otherwise.
rowNumber - The row number.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setDistinctQuery

public void setDistinctQuery(boolean distinctQuery)
If true the «distinct» keyword will be used in a query sql command.

Parameters:
distinctQuery - New value of property distinctQuery.

setDefaultValue

public void setDefaultValue(java.lang.String tableName,
                            java.lang.String columnName,
                            java.lang.Object value)
                     throws UnknownColumnNameException,
                            UnknownTableNameException,
                            AmbiguousTableNameException
Change the default value to be used in a insert statement when a cell value of a giveen column is null.

Parameters:
tableName - The name of the table.
columnName - The name of the column.
value - The value to use by default.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

setDefaultValue

public void setDefaultValue(java.lang.String columnName,
                            java.lang.Object value)
                     throws UnknownColumnNameException,
                            AmbiguousColumnNameException
Change the default value to be used in a insert statement when a cell value of a giveen column is null.

Parameters:
columnName - The name of the column.
value - The value to use by default.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

setNewRow

public void setNewRow(int rowNumber,
                      boolean newRow)
               throws RowIndexOutOfBoundsException
Change the newRow property of a row.

Parameters:
rowNumber - The row number.
newRow - True if the row is a new row, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setOrderBy

public void setOrderBy(int index,
                       java.lang.String columnName)
Change a column name at a specific index of the orderby list.

Parameters:
index - The index of the column name to be change.
columnName - The new name of the column to be set in the orderby list.

setOrderBy

public void setOrderBy(java.lang.String[] columnNames)
Rebuild the orderby list with a set of column names. The order of column names in the array is preserved.

Parameters:
columnNames - An array with the new orderby column names.

setQueryPolicy

public void setQueryPolicy(java.lang.String tableName,
                           java.lang.String columnName,
                           int queryPolicy)
                    throws UnknownColumnNameException,
                           UnknownTableNameException,
                           AmbiguousTableNameException
Changes the query policy for a column of a giveen table. Query policys could be SNAPSHOT or DYNASET.

Parameters:
tableName - The table name.
columnName - The column name.
queryPolicy - New value of property queryPolicy.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.
See Also:
pt.moredata.dao.DAOView.SNAPSHOT, pt.moredata.dao.DAOView.DYNASET

setQueryPolicy

public void setQueryPolicy(java.lang.String columnName,
                           int queryPolicy)
                    throws UnknownColumnNameException,
                           AmbiguousColumnNameException
Change the query policy for a column of the DAOView table. Query policys could be SNAPSHOT or DYNASET.

Specified by:
setQueryPolicy in interface DAOView
Parameters:
columnName - The column name.
queryPolicy - New value of property queryPolicy.
Throws:
UnknownColumnNameException - When the supplied column name is invalid.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.
See Also:
pt.moredata.dao.DAOView.SNAPSHOT, pt.moredata.dao.DAOView.DYNASET

setUpdateType

public void setUpdateType(int policy)
Set the update policy of the DataAccessObject.

Parameters:
policy - The new update policy.

setWhereStr

public void setWhereStr(java.lang.String whereString)
Change the whereString clause used by the query method. Unlike the joinClause property, the whereString is not presistent. Calling this method will delete the previous whereString.

Parameters:
whereString - The whereString clause to be used by the query method.

update

public void update(int rowNumber)
            throws NoTableDefinedException,
                   NoColumnDefinedException,
                   NoPrimaryKeyDefinedException,
                   WriterException,
                   RowIndexOutOfBoundsException
Update a repository row with data from the DataAccessObject.

Parameters:
rowNumber - The DataAccessObject row to be updated.
Throws:
NoTableDefinedException - If there is no table defined.
NoColumnDefinedException - If there is no column defined.
NoPrimaryKeyDefinedException - If there is no primary key defined.
WriterException - If there was an error reported by the repository.
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

addDescColumn

public void addDescColumn(java.lang.String descColumn)

addMetaField

public void addMetaField(MetaField metaField)
Deprecated. This method will be removed and will not have a replacment.

Add a new meta field in the end of the vector

Parameters:
metaField - Coluna a adicionar

addPkColumn

public void addPkColumn(java.lang.String pkColumn)
Deprecated. Use method addColumn(String tableName, String columnName, isPKPart) instead.

Adiciona nova coluna a utilizar como chave primaria

Parameters:
pkColumn - Nome da coluna a adicionar
Throws:
DAORuntimeException - se tabela principal não definida

addPkColumn

public void addPkColumn(java.lang.String tableName,
                        java.lang.String pkColumn)
Deprecated. Use method addColumn(String tableName, String columnName, isPKPart) instead.

Adiciona uma nova coluna como pertencente ao data control e fazendo parte da chave primária.

Parameters:
tableName - Nome da tabela
pkColumn - Nome da coluna

addPkToListMap

public void addPkToListMap(java.util.Collection pKey,
                           int rowNumber)
Deprecated. This method will be removed and will not have a replacment.

Adiciona uma correspondencia entre o valor da chave primaria e uma linha do recordset.

Parameters:
pKey - O valor da chave primaria.
rowNumber - O numero da linha no recordset.

addSecTable

public void addSecTable(java.lang.String tableName)
Deprecated. Use addTable(String tableName) instead.

Adiciona uma tabela secundária

Parameters:
tableName - Nome da tabela a utilizar

addSecTable

public void addSecTable(java.lang.String tableName,
                        java.lang.String tableAlias)
Deprecated. Use addTable(String tableName) instead.

Adiciona uma tabela secundária

Parameters:
tableName - Nome da tabela a utilizar
tableAlias - Nome alternativo para a tabela.

addSecTable

public void addSecTable(DataBaseTable table)
Deprecated. Use addTable(String tableName) instead.

Adiciona uma tabela secundária à lista de tabelas secundárias

Parameters:
table - Objecto que identifica totalmente a tabela

backupPk

public void backupPk(int rowNum)
Deprecated. This method will be removed and will not have a replacment.

Faz backup completo da chave primaria existente no recordSet
Fundamental para que as alteracoes se sincronizem com a informacao que esta no DataSource.

Parameters:
rowNum - Nº da linha que se pretende copiar

clearAllSecTables

public void clearAllSecTables()
Deprecated. Use method removeTable(String tableName) instead.

Clear all elements of secondary tables


clearMetaFieldAt

public void clearMetaFieldAt(int index)
Deprecated. This method will be removed and will not have a replacment.

Clear a meta field at a specified position


clearMetaFields

public void clearMetaFields()
Deprecated. This method will be removed and will not have a replacment.

Remove todas as colunas do recordset.


clearRecordSet

public void clearRecordSet()
Deprecated. Use method clear() instead.

Limpa todos os dados existentes no record set


clearSecTable

public void clearSecTable(java.lang.String tableName)
Deprecated. Use method removeTable(String tableName) instead.

Remove secondary table by its name


clearSecTableAt

public void clearSecTableAt(int index)
Deprecated. Use method removeTable(String tableName) instead.

Remove a secondary table in specified index


delete

public void delete()
Deprecated. Use method clear() instead.

Apaga todas as linhas do recordSet.


delete

public void delete(int rowNumber)
Deprecated. Use deleteFromDataSource(int rowNumber) instead.

Apaga do dataSource a linha que se envia como parametro

Parameters:
rowNumber - Número da linha que se pretende apagar

deleteRow

public void deleteRow(int rowNumber)
Deprecated. Use deleteFromDAO(int rowNumber) instead.

Remove no recordSet a linha enviada como parametro
A remoção no recordSet não implica a remoção no data Source
Eventualmente poderia existir um método que tratasse de tudo de uma vez.

Parameters:
rowNumber - Nº de linha a remover

getDataMetaField

public DataMetaField getDataMetaField(int numField)
Deprecated. Use method getMetaField(int numField) instead.

Devolve a informação relativa a um campo

Parameters:
numField - Nº de ordem do campo no data control
Returns:
Informação do campo

getDataMetaField

public DataMetaField getDataMetaField(java.lang.String fieldName)
Deprecated. Use method getMetaField(String fieldName) instead.

Devolve a informação relativa a um campo

Parameters:
fieldName - Nome do campo no data control.
Returns:
Informação do campo.
Throws:
DAORuntimeException - Caso nao exista nenhum campo com o nome mencionado.

isDescColumn

public boolean isDescColumn(java.lang.String descColumn)
Deprecated. Use the method isColumn(String columnName) instead.

Verifica se uma coluna faz parte das colunas de descricao.

Parameters:
descColumn - Nome da coluna.

queryByPk

public java.util.ArrayList queryByPk(java.util.List selectList,
                                     java.util.List pk)
                              throws DAORuntimeException
Deprecated. This method will be removed and will not have a replacment.

Faz um query ao data source pela chave primária.

Devolve um array list das colunas pretendidas.

Se existir duplicação da chave "atira" uma excepção.

Não está terminado ?

Mas testado, já está. PVP Sex Out 19 16:46:05 WEST 2001

Tambem é chamado do objecto ddataSwingControl. PVP

Podia ser partido em vários métodos para maior clareza

Tem de se por o swing data control a usa-lo para validar duplicações da PK

Falta implementação para outros tipos de data source

Parameters:
selectList - Lista de campos para select
pk - Lista de campos que constituem a chave primária
Throws:
DAORuntimeException

setCellAt

public void setCellAt(int rowNum,
                      int columnNum,
                      java.lang.Object obj)
Deprecated. Use the method setCellAt(int rowNum, String name, Object obj) instead.

Grava um valor numa célula do recordSet
Tanto as colunas como linhas começam em zero

Parameters:
rowNum - Número da linha a alterar
columnNum - Número da coluna a alterar
obj - Valor a colocar na célula

setCellAt

public void setCellAt(int rowNum,
                      int columnNum,
                      java.lang.Object obj,
                      boolean engineProcessed)
Deprecated. Use the method setCellAt(int rowNum, String name, Object obj,boolean engineProcessed) instead.

Grava um valor numa célula do recordSet.
Se a coluna em alteração fizer parte da chave primária e se o resto estiver preenchido reactualiza a hash de chaves primárias.
Tanto as colunas como linhas começam em zero.
???? A gestão dos backups ainda não está perfeita
???? Os backups da chave primária deveriam ser à parte

Parameters:
rowNum - Número da linha a alterar
columnNum - Número da coluna a alterar
obj - Valor a colocar na célula
engineProcessed - O valor contem uma instrução a ser processada no servidor para obter o valor explicito

setCounterColumn

public void setCounterColumn(int column,
                             boolean value)
Deprecated. This method will be removed and will not have a replacment.

Define uma coluna como sendo contador indexado à linha onde esta está armazenada

Parameters:
column - Coluna a definir como contador
value - Valor da flag

setFixedValue

public void setFixedValue(int column,
                          java.lang.Object value)
Deprecated. Use method setDefaultValue(String columnName, Object value) instead.

Define uma coluna do data control como contendo um valor fixo.
Utiliza-se na definição de chaves estrangeiras quando um data control contem os dados de um detalhe (ex: em linhas de factura a chave primária da factura é uma valor fixo)

Parameters:
column - Coluna do data control a fixar
value - Valor que é fixado na coluna
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

setMainTable

public void setMainTable(java.lang.String tableName)
Deprecated. Use method addTableName(String tableName) instead.

Afecta o nome da tabela principal

Parameters:
tableName - Nome da tabela principal

setMainTable

public void setMainTable(java.lang.String tableName,
                         java.lang.String tableAlias)
Deprecated. Use method addTableName(String tableName) instead.

Afecta a tabela principal por nome com um alias

Parameters:
tableName - Nome da tabela
tableAlias - Alias da tabela

setMainTable

public void setMainTable(DataBaseTable mainTable)
Deprecated. Use method addTableName(String tableName) instead.

Set main table by reference to object of type DataBaseTable


setNewRow

public void setNewRow(boolean _newRow,
                      int rowNum)
Deprecated. Use method setNewRow(int rowNumber , boolean newRow) instead.

Afecta a flag que indica que esta linha eh nova e como tal tem de ser inserida


setTableName

public void setTableName(java.lang.String _tableName)
Deprecated. Use method addTableName(String tableName) instead.

Afecta a tabela principal e unica


sort

public void sort()
Deprecated. This method will be removed and will not have a replacment. Use class DAOSort to sort a DataAccessObject.

Ordena o DataAccessObject de acordo com a ordem definida com setOrderBy