pt.moredata.dao
Interface Writer

All Known Implementing Classes:
AbstractWriter

public interface Writer

This is the interface used for writing data to the repository. Company MoreData

Version:
$Revision: 1.7 $
Author:
pcarmo

Method Summary
 void commit()
          Makes all changes made since the previous commit/rollback permanent and releases any repository locks currently held by this Writer Connection object.
 void delete(java.lang.String tableName, int rowNumber)
          Delete one row of data in the repository.
 boolean getAutoCommit()
          Retrieves the current auto-commit mode for the Connection object of this Writer.
 void insert(java.lang.String tableName, int rowNumber)
          Insert a row of data from one table of the DAO and write it to the repository.
 void rollback()
          Undoes all changes made in the current transaction and releases any database locks currently held by this Writer Connection object.
 void setAutoCommit(boolean autoCommit)
          Sets this Writer connection's auto-commit mode to the given state.
 void setDAOFieldsInfo(DAOFieldsInfo fieldsInfo)
          Set the DAOFieldsInfo object with information about the columns of the RecordSet.
 void setRecordSet(RecordSet recordSet)
          Set the RecordSet that contains the data to be written to the repository.
 void update(java.lang.String tableName, int rowNumber, int updateType)
          Update data on the repository from one table row of the DAO.
 void write(WriterInformation info)
          Read all data from one table of the RecordSet and write it to the repository.
 

Method Detail

setDAOFieldsInfo

public void setDAOFieldsInfo(DAOFieldsInfo fieldsInfo)
Set the DAOFieldsInfo object with information about the columns of the RecordSet.

Parameters:
fieldsInfo - The DAOFieldInfo object.

setRecordSet

public void setRecordSet(RecordSet recordSet)
Set the RecordSet that contains the data to be written to the repository.

Parameters:
recordSet - The RecorSet object with information to be written.

write

public void write(WriterInformation info)
           throws WriterException
Read all data from one table of the RecordSet and write it to the repository. Only the rows of the recordSet marked as modified are written to the repository. Tha action take on each row depends on the state of the row, if the row is new, it is inserted in the repository. If the row is change in the DAO is data is updated in the repository. If the data was deleted in the DAO it is deleted from the repository.

Parameters:
info - Adicional information to help writing to the Repository
Throws:
WriterException - If an error occur will writing data to the repository.

insert

public void insert(java.lang.String tableName,
                   int rowNumber)
            throws WriterException
Insert a row of data from one table of the DAO and write it to the repository.

Parameters:
tableName - The table name.
rowNumber - The row number to be insert.
Throws:
WriterException - If there is an error inserting the row in the repository

update

public void update(java.lang.String tableName,
                   int rowNumber,
                   int updateType)
            throws WriterException
Update data on the repository from one table row of the DAO.

Parameters:
tableName - The table name.
rowNumber - The row number to be update.
updateType - The type of update to be executed. It could be DataAccessObject.SUPERSET_UPDATE or DataAccessObject.INDIVIDUAL_UPDATE.
Throws:
WriterException - If there is an error updating the row in the repository

delete

public void delete(java.lang.String tableName,
                   int rowNumber)
            throws WriterException
Delete one row of data in the repository.

Parameters:
tableName - The table name.
rowNumber - The row number to be deleted.
Throws:
WriterException - If there is an error deleting the row from the repository

getAutoCommit

public boolean getAutoCommit()
                      throws WriterException
Retrieves the current auto-commit mode for the Connection object of this Writer.

Returns:
the current state of the Connection object's auto-commit mode for this Writer.
Throws:
WriterException - if a repository access error occurs
See Also:
setAutoCommit(boolean)

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws WriterException
Sets this Writer connection's auto-commit mode to the given state. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either the method commit or the method rollback.

The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet object, the statement completes when the last row of the ResultSet object has been retrieved or the ResultSet object has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. In these cases, the commit occurs when all results and output parameter values have been retrieved.

NOTE: If this method is called during a transaction, the transaction is committed.

Parameters:
autoCommit - true to enable auto-commit mode; false to disable it
Throws:
WriterException - if a database access error occurs
See Also:
getAutoCommit()

commit

public void commit()
            throws WriterException
Makes all changes made since the previous commit/rollback permanent and releases any repository locks currently held by this Writer Connection object. This method should be used only when auto-commit mode has been disabled.

Throws:
WriterException - if a database access error occurs or this Writer Connection object is in auto-commit mode
See Also:
setAutoCommit(boolean)

rollback

public void rollback()
              throws WriterException
Undoes all changes made in the current transaction and releases any database locks currently held by this Writer Connection object. This method should be used only when auto-commit mode has been disabled.

Throws:
WriterException - if a database access error occurs or this Writer Connection object is in auto-commit mode
See Also:
setAutoCommit(boolean)