pt.moredata.dao
Interface DAOFieldsInfo


public interface DAOFieldsInfo

This is the interface used for representing information about all columns of the DataAccessObject. Company MoreData

Version:
$Revision: 1.7 $
Author:
pcarmo

Field Summary
static int SORT_FOR_DELETE
          Type of sort to sort the tables names for delete.
static int SORT_FOR_INSERT
          Type of sort to sort the tables names for insert.
static int SORT_FOR_UPDATE
          Type of sort to sort the tables names for update.
 
Method Summary
 void addMetaField(MetaField metaField)
          Add a new MetaField to the end of the metafield list.
 void addTable(DataBaseTable dataBaseTable)
          Adds a new table to the DAOFieldsInfo.
 void clear()
          Remove all meta fields from the meta fields list and from the primary key meta fields list.
 java.lang.String getColumnName(int columnNumber)
          Return a column name of a MetaField at a specific index.
 int getColumnNumber(java.lang.String columnName)
          Return the index of a column inside DAO.
 int getColumnNumber(java.lang.String tableName, java.lang.String columnName)
          Return the index of a column inside DAO for a giveen table.
 int getColumns()
          Return the number of columns of the DAOFieldsInfo.
 int getColumns(java.lang.String tableName)
          Return the number of columns of the DAOFieldsInfo for a giveen table.
 java.util.ArrayList getColumnsNames()
          Return a list with the column names for all the columns of the RecordSet.
 java.util.ArrayList getColumnsNames(java.lang.String tableName)
          Return a list with the column names for all the columns of the giveen table of the RecordSet.
 DataBaseTable getDataBaseTable(java.lang.String tableName)
          Return a DataBaseTable for a giveen table.
 java.util.List getJoinColumns(java.lang.String tableName, java.lang.String columnName)
          Return a list of ColumnId objects representing all the columns that are equal to the one passing by argument.
 MetaField getMetaField(int columnNumber)
          Return a MetaField for a specific column number.
 MetaField getMetaField(java.lang.String columnName)
          Return a MetaField for a specific column name.
 MetaField getMetaField(java.lang.String tableName, java.lang.String columnName)
          Return a MetaField for a specific column name of a giveen table.
 java.util.Iterator getMetaFields()
          Return a list with MetaFields Objects for all columns of the RecordSet.
 java.util.Iterator getMetaFields(java.lang.String tableName)
          Return a list with MetaFields Objects for all columns of one table of the RecordSet.
 MetaField getPKMetaField(int index)
          Return a list of MetaField objects for the primary key columns.
 java.util.Iterator getPKMetaFields()
          Return a list with MetaFields Objects for all primary key columns of the RecordSet.
 java.util.Iterator getPKMetaFields(java.lang.String tableName)
          Return a list with MetaFields Objects for all primary key columns of one table of the RecordSet.
 int getPKSize()
          Return the number of metafields int the primary key meta fileds list.
 int getPKSize(java.lang.String tableName)
          Return the number of metafields in the primary key meta fileds list for a specific table.
 java.util.Iterator getTablesNames()
          Return a list with the names of all DAOFieldsInfo tables.
 java.util.Iterator getTablesNames(int sortType)
          Return a list with the names of all DAOFieldsInfo tables sort for insert, update or delete.
 boolean isColumn(java.lang.String columnName)
          Check if a column with a giveen name has allready added.
 boolean isColumn(java.lang.String tableName, java.lang.String columnName)
          Check if a column with a giveen name has allready added.
 boolean isPKPart(int columnNumber)
          Check if a column is a primary key column.
 boolean isTable(java.lang.String tableName)
          Check if a table was already added to the DAOFieldsInfo.
 void removeMetaField(int columnNumber)
          Remove a MetaField at a specific index from the MetaFields list.
 void removeMetaField(java.lang.String columnName)
          Remove a MetaField with a specific name from the MetaFields list.
 void removeMetaField(java.lang.String tableName, java.lang.String columnName)
          Remove a MetaField with a specific name from the MetaFields list.
 void removeTable(java.lang.String tableName)
          Remove a table from the DAOFieldsInfo.
 void setPKFlag(int columnNumber, boolean isPK)
          Marca uma determinada coluna do recordset como sendo uma coluna que comp?
 void setUpdateOrder(java.lang.String[] tablesNames)
          Chage the order of the tables used in a update.
 

Field Detail

SORT_FOR_UPDATE

public static final int SORT_FOR_UPDATE
Type of sort to sort the tables names for update.

See Also:
Constant Field Values

SORT_FOR_INSERT

public static final int SORT_FOR_INSERT
Type of sort to sort the tables names for insert.

See Also:
Constant Field Values

SORT_FOR_DELETE

public static final int SORT_FOR_DELETE
Type of sort to sort the tables names for delete.

See Also:
Constant Field Values
Method Detail

addMetaField

public void addMetaField(MetaField metaField)
                  throws java.lang.NullPointerException,
                         UnknownTableNameException,
                         AmbiguousTableNameException,
                         DuplicatedColumnNameException
Add a new MetaField to the end of the metafield list. If the column represented by the MetaField is a primary key column The metafield is added to the primary key metafield list also.

Parameters:
metaField - The MetaField to be added.
Throws:
java.lang.NullPointerException - if the column name or the table name of the MetaField is null.
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.
DuplicatedColumnNameException - If a Metafield already exists with the same column name.

removeMetaField

public void removeMetaField(int columnNumber)
                     throws ColumnIndexOutOfBoundsException
Remove a MetaField at a specific index from the MetaFields list. If the MetaField represents a primary key column it is removed from the Primary key MetaFields list also.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

removeMetaField

public void removeMetaField(java.lang.String tableName,
                            java.lang.String columnName)
                     throws UnknownColumnNameException,
                            UnknownTableNameException,
                            AmbiguousTableNameException
Remove a MetaField with a specific name from the MetaFields list. If the MetaField represents a primary key column it is removed from the Primary key MetaFields list also.

Parameters:
tableName - The table name or table alias.
columnName - The name of the column.
Throws:
UnknownColumnNameException - When the supplied column name is unknown.
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

removeMetaField

public void removeMetaField(java.lang.String columnName)
                     throws UnknownColumnNameException,
                            AmbiguousColumnNameException
Remove a MetaField with a specific name from the MetaFields list. If the MetaField represents a primary key column it is removed from the Primary key MetaFields list also.

Parameters:
columnName - The name of the column.
Throws:
UnknownColumnNameException - When the supplied column name is unknown.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

clear

public void clear()
Remove all meta fields from the meta fields list and from the primary key meta fields list.


getColumnName

public java.lang.String getColumnName(int columnNumber)
                               throws ColumnIndexOutOfBoundsException
Return a column name of a MetaField at a specific index.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
The column name of a MetaField at a specific index.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

getColumns

public int getColumns()
Return the number of columns of the DAOFieldsInfo.

Returns:
The number of columns of the DAOFieldsInfo.

getColumns

public int getColumns(java.lang.String tableName)
               throws UnknownTableNameException,
                      AmbiguousTableNameException
Return the number of columns of the DAOFieldsInfo for a giveen table.

Parameters:
tableName - The table name or table alias.
Returns:
The number of columns of the DAOFieldsInfo.
Throws:
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getColumnsNames

public java.util.ArrayList getColumnsNames()
Return a list with the column names for all the columns of the RecordSet.

Returns:
A list with the column names for all the columns of the RecordSet.

getColumnsNames

public java.util.ArrayList getColumnsNames(java.lang.String tableName)
                                    throws UnknownTableNameException,
                                           AmbiguousTableNameException
Return a list with the column names for all the columns of the giveen table of the RecordSet.

Parameters:
tableName - The table name or table alias.
Returns:
A list with the column names for all the columns of the giveen table of the RecordSet.
Throws:
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getColumnNumber

public int getColumnNumber(java.lang.String tableName,
                           java.lang.String columnName)
                    throws UnknownColumnNameException,
                           UnknownTableNameException,
                           AmbiguousTableNameException
Return the index of a column inside DAO for a giveen table.

Parameters:
columnName - The name of the column.
tableName - The table name or table alias.
Returns:
The index of a column inside DAO.
Throws:
UnknownColumnNameException - When the supplied column name is unknown.
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getColumnNumber

public int getColumnNumber(java.lang.String columnName)
                    throws UnknownColumnNameException,
                           AmbiguousColumnNameException
Return the index of a column inside DAO.

Parameters:
columnName - The name of the column.
Returns:
The index of a column inside DAO.
Throws:
UnknownColumnNameException - When the supplied column name is unknown.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

getMetaField

public MetaField getMetaField(int columnNumber)
                       throws ColumnIndexOutOfBoundsException
Return a MetaField for a specific column number.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
A MetaField for a specific column number.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

getMetaField

public MetaField getMetaField(java.lang.String tableName,
                              java.lang.String columnName)
                       throws UnknownColumnNameException,
                              UnknownTableNameException,
                              AmbiguousTableNameException
Return a MetaField for a specific column name of a giveen table.

Parameters:
tableName - The name alias of the table that owns the column.
columnName - The column name.
Throws:
UnknownColumnNameException - If the columnName does not exist in the giveen table.
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getMetaField

public MetaField getMetaField(java.lang.String columnName)
                       throws UnknownColumnNameException,
                              AmbiguousColumnNameException
Return a MetaField for a specific column name.

Parameters:
columnName - The column name.
Returns:
A MetaField for a specific column name.
Throws:
UnknownColumnNameException - If the columnName does not exist.
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

getMetaFields

public java.util.Iterator getMetaFields()
Return a list with MetaFields Objects for all columns of the RecordSet. The order of the list is the same of the RecordSet.

Returns:
A list with MetaFields Objects for all columns of the RecordSet.

getMetaFields

public java.util.Iterator getMetaFields(java.lang.String tableName)
                                 throws UnknownTableNameException,
                                        AmbiguousTableNameException
Return a list with MetaFields Objects for all columns of one table of the RecordSet. The order of the list is the same of the RecordSet.

Parameters:
tableName - The table name or table alias.
Returns:
A list with MetaFields Objects for all columns of one table of the RecordSet.
Throws:
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getPKMetaField

public MetaField getPKMetaField(int index)
                         throws java.lang.IndexOutOfBoundsException
Return a list of MetaField objects for the primary key columns.

Parameters:
index - The index of the column in the primary key meta fileds list.
Returns:
A list of MetaField objects for the primary key columns. throws IndexOutOfBoundsException If the index < 0 or the index >= getPKSize().
Throws:
java.lang.IndexOutOfBoundsException

getPKMetaFields

public java.util.Iterator getPKMetaFields()
Return a list with MetaFields Objects for all primary key columns of the RecordSet.

Returns:
A list with MetaFields Objects for all primary key columns of the RecordSet.

getPKMetaFields

public java.util.Iterator getPKMetaFields(java.lang.String tableName)
                                   throws UnknownTableNameException,
                                          AmbiguousTableNameException
Return a list with MetaFields Objects for all primary key columns of one table of the RecordSet.

Parameters:
tableName - The table name or table alias.
Returns:
A list with MetaFields Objects for all primary key columns of one table of the RecordSet.
Throws:
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getPKSize

public int getPKSize()
Return the number of metafields int the primary key meta fileds list.

Returns:
The number of metafields int the primary key meta fileds list.

getPKSize

public int getPKSize(java.lang.String tableName)
              throws UnknownTableNameException,
                     AmbiguousTableNameException
Return the number of metafields in the primary key meta fileds list for a specific table.

Parameters:
tableName - The table name or table alias.
Returns:
The number of metafields in the primary key meta fileds list for a specific table.
Throws:
UnknownTableNameException - When the supplied table name is unknown.
AmbiguousTableNameException - When the supplied tableName exists more than once.

isColumn

public boolean isColumn(java.lang.String columnName)
                 throws AmbiguousColumnNameException
Check if a column with a giveen name has allready added.

Parameters:
columnName - The column name.
Returns:
True if the giveen column was already added, false otherwise.
Throws:
AmbiguousColumnNameException - When the supplied columnName exists in more than one table.

isColumn

public boolean isColumn(java.lang.String tableName,
                        java.lang.String columnName)
                 throws UnknownTableNameException,
                        AmbiguousTableNameException
Check if a column with a giveen name has allready added.

Parameters:
tableName - The table name or table alias.
columnName - The column name.
Returns:
True if the giveen column was already, false otherwise.
Throws:
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

isPKPart

public boolean isPKPart(int columnNumber)
                 throws ColumnIndexOutOfBoundsException
Check if a column is a primary key column.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
True if the column is part of the primary key, false otherwise.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

setPKFlag

public void setPKFlag(int columnNumber,
                      boolean isPK)
               throws ColumnIndexOutOfBoundsException
Marca uma determinada coluna do recordset como sendo uma coluna que comp?em a chave primaria.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
isPK - O valor a atribuir a flag, true para o caso da coluna ser chave primaria, false caso contrario.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

addTable

public void addTable(DataBaseTable dataBaseTable)
Adds a new table to the DAOFieldsInfo.

Parameters:
dataBaseTable - The DataBaseTable object to be added.

removeTable

public void removeTable(java.lang.String tableName)
                 throws UnknownTableNameException,
                        AmbiguousTableNameException
Remove a table from the DAOFieldsInfo. All Metafields of the giveen table are removed from DAOFieldsInfo.

Parameters:
tableName - The table name or table alias.
Throws:
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getDataBaseTable

public DataBaseTable getDataBaseTable(java.lang.String tableName)
                               throws UnknownTableNameException,
                                      AmbiguousTableNameException
Return a DataBaseTable for a giveen table.

Parameters:
tableName - The table name or table alias.
Returns:
A DataBaseTable for the giveen table.
Throws:
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

isTable

public boolean isTable(java.lang.String tableName)
                throws AmbiguousTableNameException
Check if a table was already added to the DAOFieldsInfo.

Parameters:
tableName - The table name or table alias.
Throws:
AmbiguousTableNameException - When the supplied tableName exists more than once.

getTablesNames

public java.util.Iterator getTablesNames()
Return a list with the names of all DAOFieldsInfo tables. If a table has a alias, the alias is return insted the table name.

Returns:
A list with the names of all DAOFieldsInfo tables.

getTablesNames

public java.util.Iterator getTablesNames(int sortType)
Return a list with the names of all DAOFieldsInfo tables sort for insert, update or delete. The type of sort is specified by the sortType parameter. If a table has a alias, the alias is return insted the table name.

Parameters:
sortType - The type of sort to be used. The suported types are : SORT_FOR_UPDATE, SORT_FOR_INSERT or SORT_FOR_DELETE.
Returns:
A list with the names of all DAOFieldsInfo tables or null if the sort type is unknown.

setUpdateOrder

public void setUpdateOrder(java.lang.String[] tablesNames)
Chage the order of the tables used in a update.

Parameters:
tablesNames - A array of tables names in the request order to be used in a update.
Throws:
UnknownTableNameException - If the array contains a unknown table name.

getJoinColumns

public java.util.List getJoinColumns(java.lang.String tableName,
                                     java.lang.String columnName)
                              throws AmbiguousTableNameException
Return a list of ColumnId objects representing all the columns that are equal to the one passing by argument.

Parameters:
tableName - The table name or table alias of the column.
columnName - The column name.
Returns:
A list of ColumnId objects one for each column equal to the one passed to the method.
Throws:
AmbiguousTableNameException - When the supplied tableName exists more than once.