pt.moredata.dao.core
Class AbstractWriter

java.lang.Object
  extended bypt.moredata.dao.core.AbstractWriter
All Implemented Interfaces:
Writer

public abstract class AbstractWriter
extends java.lang.Object
implements Writer

Parcial implementation of the Writer interface. Company MoreData

Version:
$Revision: 1.5 $
Author:
pcarmo

Field Summary
protected  DAOFieldsInfo _fieldsInfo
          DAOFieldsInfo object with information about DAO columns and tables.
protected  WriterInformation _info
          Aditional information to build the SQL command.
protected  RecordSet _recordSet
          DAO RecordSet.
 
Constructor Summary
AbstractWriter(DAOFieldsInfo fieldsInfo, RecordSet recordSet)
          Creates a new instance of AbstractWriter
 
Method Summary
 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.
protected abstract  void write()
          Read all data from one table of the RecordSet and write it to the repository.
 void write(WriterInformation info)
          Read all data from one table of the RecordSet and write it to the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.moredata.dao.Writer
commit, delete, getAutoCommit, insert, rollback, setAutoCommit, update
 

Field Detail

_info

protected WriterInformation _info
Aditional information to build the SQL command.


_fieldsInfo

protected DAOFieldsInfo _fieldsInfo
DAOFieldsInfo object with information about DAO columns and tables.


_recordSet

protected RecordSet _recordSet
DAO RecordSet.

Constructor Detail

AbstractWriter

public AbstractWriter(DAOFieldsInfo fieldsInfo,
                      RecordSet recordSet)
Creates a new instance of AbstractWriter

Parameters:
fieldsInfo - The DAO fields information object.
recordSet - The DAO RecordSet object witch contains the DAO data.
Method Detail

write

protected abstract void write()
                       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.

Throws:
WriterException - If an error occur will writing data to the repository.

setDAOFieldsInfo

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

Specified by:
setDAOFieldsInfo in interface Writer
Parameters:
fieldsInfo - The DAOFieldInfo object.

setRecordSet

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

Specified by:
setRecordSet in interface Writer
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.

Specified by:
write in interface Writer
Parameters:
info - Adicional information to help writing to the Repository
Throws:
WriteException - If an error occur will writing data to the repository.
WriterException - If an error occur will writing data to the repository.