pt.moredata.xml2db
Class Table

java.lang.Object
  extended bypt.moredata.xml2db.Table

public class Table
extends java.lang.Object


Constructor Summary
Table(java.lang.String _name)
          Creates a table model for name without base xPath and without multi record
Table(java.lang.String _name, java.lang.String _xPath)
          Creates a table model for name with base xPath and without multi record
Table(java.lang.String _name, java.lang.String _xPath, java.lang.String _recordTag)
          Creates a table model for name with base xPath and with multi record
 
Method Summary
 void addColumn(Column c)
          Add a column definition to the table
 void addKey(Column c)
          Add a column definition to the table keys
 void afterGroupInsertAction()
          Method that is executed by ReadXML2DB once for each record to be inserted after the insertAction, you'll have to rewrite this if you need something to hapen after the insert, i.e. update a char field to lower
 void afterInsertAction()
          Method that is executed by ReadXML2DB once for each record to be inserted after the insertAction, you'll have to rewrite this if you need something to hapen after the insert, i.e. update a char field to lower
 void beforeGroupInsertAction()
          Method that is executed by ReadXML2DB before any record is inserted and before the beforeInsertAction, you'll have to rewrite this if you need something to hapen before the insert, i.e. get a FK
 void beforeInsertAction()
          Method that is executed by ReadXML2DB once for each record to be inserted before the insertAction, you'll have to rewrite this if you need something to hapen before the insert, i.e. get a FK
 void changeInsertToUpdate()
          Method that changes action from insert to update, and there is no turning back
 void defaultInsertAction()
          Method that executs the default insertAction
 void defaultUpdateAction()
          Method that executs the default updateAction
 Column getColumn(java.lang.String _name)
          Return a column reference
 java.util.Iterator getColumns()
          Return an iterator for the column definitions of the table
 boolean getDisposable()
          Method that sets disposabilaty of the table
 java.sql.PreparedStatement getInsertAction()
          Method that returns the default insert prepared statement, with the fields set for the values of the current column values
 java.util.Iterator getKeys()
          Return an iterator for the key definitions of the table
 java.lang.String getName()
          Returns the name of the table
 java.lang.String getRecordTag()
          Returns the tag that defines a record
 java.sql.PreparedStatement getUpdateAction()
          Method that returns the default update prepared statement, with the fields set for the values of the current column values
 java.lang.Object getValue(java.lang.String _name)
          Gets the value of column name, null if doesn't exist(or if is realy null)
 java.lang.String getXPath()
          Return the xPath
 void insertAction()
          Method that is executed by ReadXML2DB once for each record to be inserted, you'll have to rewrite this if you need something to happen imediately be- fore or after de insert command, i.e. get a serial
 boolean isMultiRecord()
          Returns true if this table was defined as multi record table
 void setConnection(java.sql.Connection _con)
          Method that sets the connection, and gets the classes of the fields from de DB
 void setDisposable(boolean _disposable)
          Method that sets disposabilaty of the table
 void setKeyValue(java.lang.String _name, java.lang.Object _value)
          Sets the value of key column name, if the column definition doesn't exists it creates it
 void setValue(java.lang.String _name, java.lang.Object _value)
          Sets the value of column name, if the column definition doesn't exists it creates it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table(java.lang.String _name)
Creates a table model for name without base xPath and without multi record

Parameters:
_name -

Table

public Table(java.lang.String _name,
             java.lang.String _xPath)
Creates a table model for name with base xPath and without multi record

Parameters:
_name -
_xPath -

Table

public Table(java.lang.String _name,
             java.lang.String _xPath,
             java.lang.String _recordTag)
Creates a table model for name with base xPath and with multi record

Parameters:
_name -
_xPath -
_recordTag -
Method Detail

beforeGroupInsertAction

public void beforeGroupInsertAction()
                             throws java.sql.SQLException
Method that is executed by ReadXML2DB before any record is inserted and before the beforeInsertAction, you'll have to rewrite this if you need something to hapen before the insert, i.e. get a FK

Throws:
java.sql.SQLException

beforeInsertAction

public void beforeInsertAction()
                        throws java.sql.SQLException
Method that is executed by ReadXML2DB once for each record to be inserted before the insertAction, you'll have to rewrite this if you need something to hapen before the insert, i.e. get a FK

Throws:
java.sql.SQLException

insertAction

public void insertAction()
                  throws java.sql.SQLException
Method that is executed by ReadXML2DB once for each record to be inserted, you'll have to rewrite this if you need something to happen imediately be- fore or after de insert command, i.e. get a serial

Throws:
java.sql.SQLException

afterGroupInsertAction

public void afterGroupInsertAction()
                            throws java.sql.SQLException
Method that is executed by ReadXML2DB once for each record to be inserted after the insertAction, you'll have to rewrite this if you need something to hapen after the insert, i.e. update a char field to lower

Throws:
java.sql.SQLException

afterInsertAction

public void afterInsertAction()
                       throws java.sql.SQLException
Method that is executed by ReadXML2DB once for each record to be inserted after the insertAction, you'll have to rewrite this if you need something to hapen after the insert, i.e. update a char field to lower

Throws:
java.sql.SQLException

defaultInsertAction

public void defaultInsertAction()
                         throws java.sql.SQLException
Method that executs the default insertAction

Throws:
java.sql.SQLException

defaultUpdateAction

public void defaultUpdateAction()
                         throws java.sql.SQLException
Method that executs the default updateAction

Throws:
java.sql.SQLException

getInsertAction

public java.sql.PreparedStatement getInsertAction()
                                           throws java.sql.SQLException
Method that returns the default insert prepared statement, with the fields set for the values of the current column values

Returns:
Throws:
java.sql.SQLException

getUpdateAction

public java.sql.PreparedStatement getUpdateAction()
                                           throws java.sql.SQLException
Method that returns the default update prepared statement, with the fields set for the values of the current column values

Returns:
Throws:
java.sql.SQLException

setConnection

public void setConnection(java.sql.Connection _con)
Method that sets the connection, and gets the classes of the fields from de DB

Parameters:
_con -

setDisposable

public void setDisposable(boolean _disposable)
Method that sets disposabilaty of the table


changeInsertToUpdate

public void changeInsertToUpdate()
Method that changes action from insert to update, and there is no turning back


getDisposable

public boolean getDisposable()
Method that sets disposabilaty of the table


getName

public java.lang.String getName()
Returns the name of the table

Returns:

isMultiRecord

public boolean isMultiRecord()
Returns true if this table was defined as multi record table

Returns:

getRecordTag

public java.lang.String getRecordTag()
Returns the tag that defines a record

Returns:

getXPath

public java.lang.String getXPath()
Return the xPath

Returns:

addColumn

public void addColumn(Column c)
Add a column definition to the table

Parameters:
c -

addKey

public void addKey(Column c)
Add a column definition to the table keys

Parameters:
c -

setValue

public void setValue(java.lang.String _name,
                     java.lang.Object _value)
Sets the value of column name, if the column definition doesn't exists it creates it

Parameters:
_name -
_value -

setKeyValue

public void setKeyValue(java.lang.String _name,
                        java.lang.Object _value)
Sets the value of key column name, if the column definition doesn't exists it creates it

Parameters:
_name -
_value -

getValue

public java.lang.Object getValue(java.lang.String _name)
Gets the value of column name, null if doesn't exist(or if is realy null)

Parameters:
_name -
Returns:

getColumns

public java.util.Iterator getColumns()
Return an iterator for the column definitions of the table

Returns:

getColumn

public Column getColumn(java.lang.String _name)
Return a column reference

Returns:

getKeys

public java.util.Iterator getKeys()
Return an iterator for the key definitions of the table

Returns: