pt.moredata.dao
Class AbstractUtilStuff

java.lang.Object
  extended bypt.moredata.dao.AbstractUtilStuff
Direct Known Subclasses:
InformixUtilStuff, OracleUtilStuff

public abstract class AbstractUtilStuff
extends java.lang.Object

UtilStuff.java Company MoreData

Version:
$Revision: 1.3 $
Author:
Paulo Carmo, Ricardo Amaro

Field Summary
static int CONTACTO_ROWS
          Description of the Field
 
Constructor Summary
AbstractUtilStuff()
           
 
Method Summary
 void createSyscolumnextTable(java.sql.Connection connection)
          Cria a tabela syscolumnext na base de dados
 void createSystableextTable(java.sql.Connection connection)
          Cria a tabela systableext na base de dados
 void createTableOrigin(java.sql.Connection connection, java.lang.String origin, java.lang.String target)
          Cria uma tabela na base de dados com uma chave estrangeira para outra tabela.
 void createTables(java.sql.Connection connection, java.lang.String targetName, java.lang.String originName)
          Cria duas tabelas na base de dados.
abstract  void createTableTarget(java.sql.Connection connection, java.lang.String target)
          Cria uma tabela na base de dados.
 void destroySyscolumnextTable(java.sql.Connection connection)
          Remove a tabela syscolumnext da base de dados.
 void destroySystableextTable(java.sql.Connection connection)
          Remove a tabela systableext da base de dados.
 void destroyTable(java.sql.Connection connection, java.lang.String nome)
          Remove uma tabela da base de dados.
abstract  java.sql.Connection getConnection()
          Cria uma coneccao a base de dados.
 DataSource getDataSource()
          Cria um DataSource com uma coneccao a base de dados.
 java.lang.String getTableName(java.lang.String name)
          Devolve o nome de uma tabela, gerado com base no nome recebido e com base na data.
 java.lang.Object getValueContacto(int rowNum, int colNum)
           
 int insertValueContacto(java.sql.Connection connection, java.lang.String table)
          Insere dados na tabela referenciada
 int insertValueEntidade(java.sql.Connection connection, java.lang.String table)
          Insere dados na tabela que referencia
 void insertValuesSyscolumnext(java.sql.Connection connection, java.lang.String nome)
          Insere dados na tabela syscolumnext
 void insertValuesSystableext(java.sql.Connection connection, java.lang.String nome)
          Insere dados na tabela systableext
 void makeJarFile(java.lang.String jarName, java.lang.String serName)
          Funcao auxiliar para construir ficheiros jar com tabelas serializadas
 void removeValues(java.sql.Connection connection, java.lang.String table)
          Remove os dados na tabela que referencia
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTACTO_ROWS

public static final int CONTACTO_ROWS
Description of the Field

See Also:
Constant Field Values
Constructor Detail

AbstractUtilStuff

public AbstractUtilStuff()
Method Detail

createTableOrigin

public void createTableOrigin(java.sql.Connection connection,
                              java.lang.String origin,
                              java.lang.String target)
                       throws java.sql.SQLException
Cria uma tabela na base de dados com uma chave estrangeira para outra tabela.

Parameters:
connection - Ligacao a base de dados.
origin - Nome da tabela a criar.
target - Nome da tabela que exporta a chave.
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

createTableTarget

public abstract void createTableTarget(java.sql.Connection connection,
                                       java.lang.String target)
                                throws java.sql.SQLException
Cria uma tabela na base de dados.

Parameters:
connection - Ligacao a base de dados.
target - Nome da tabela a criar.
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

createTables

public void createTables(java.sql.Connection connection,
                         java.lang.String targetName,
                         java.lang.String originName)
                  throws java.sql.SQLException
Cria duas tabelas na base de dados. Uma das tabelas e criada com uma chave estrangeira para a outra tabela.

Parameters:
connection - Ligacao a base de dados.
targetName - Description of the Parameter
originName - Description of the Parameter
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

createSyscolumnextTable

public void createSyscolumnextTable(java.sql.Connection connection)
                             throws java.sql.SQLException
Cria a tabela syscolumnext na base de dados

Parameters:
connection - Ligacao a base de dados.
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

createSystableextTable

public void createSystableextTable(java.sql.Connection connection)
                            throws java.sql.SQLException
Cria a tabela systableext na base de dados

Parameters:
connection - Ligacao a base de dados.
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

insertValuesSyscolumnext

public void insertValuesSyscolumnext(java.sql.Connection connection,
                                     java.lang.String nome)
                              throws java.sql.SQLException
Insere dados na tabela syscolumnext

Parameters:
connection - Ligacao a base de dados
nome - Description of the Parameter
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

insertValuesSystableext

public void insertValuesSystableext(java.sql.Connection connection,
                                    java.lang.String nome)
                             throws java.sql.SQLException
Insere dados na tabela systableext

Parameters:
connection - Ligacao a base de dados
nome - Description of the Parameter
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

destroySyscolumnextTable

public void destroySyscolumnextTable(java.sql.Connection connection)
                              throws java.sql.SQLException
Remove a tabela syscolumnext da base de dados.

Parameters:
connection - Coneccao a base de dados
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

destroySystableextTable

public void destroySystableextTable(java.sql.Connection connection)
                             throws java.sql.SQLException
Remove a tabela systableext da base de dados.

Parameters:
connection - Coneccao a base de dados
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

getValueContacto

public java.lang.Object getValueContacto(int rowNum,
                                         int colNum)
Parameters:
rowNum - Description of the Parameter
colNum - Description of the Parameter
Returns:
The valueContacto value

insertValueContacto

public int insertValueContacto(java.sql.Connection connection,
                               java.lang.String table)
                        throws java.sql.SQLException
Insere dados na tabela referenciada

Parameters:
connection - Ligacao a base de dados
table - Nome da tabela onde vai inserir
Returns:
Description of the Return Value
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

insertValueEntidade

public int insertValueEntidade(java.sql.Connection connection,
                               java.lang.String table)
                        throws java.sql.SQLException
Insere dados na tabela que referencia

Parameters:
connection - Ligacao a base de dados
table - Nome da tabela onde vai inserir
Returns:
Description of the Return Value
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

removeValues

public void removeValues(java.sql.Connection connection,
                         java.lang.String table)
                  throws java.sql.SQLException
Remove os dados na tabela que referencia

Parameters:
connection - Ligacao a base de dados
table - Nome da tabela onde vai remover
Throws:
java.sql.SQLException - Description of the Exception

destroyTable

public void destroyTable(java.sql.Connection connection,
                         java.lang.String nome)
                  throws java.sql.SQLException
Remove uma tabela da base de dados.

Parameters:
nome - Nome da tabela a remover
connection - Description of the Parameter
Throws:
java.sql.SQLException - Se houver algum erro com a base de dados.

getConnection

public abstract java.sql.Connection getConnection()
                                           throws DAORuntimeException
Cria uma coneccao a base de dados. Para establecer a ligacao, e usado um ficheiro de configuracao que deve estar ter o seguinte nome 'user.home/.db.unstable.teste'.

Returns:
Uma conneccao valida a base de dados.
Throws:
DAORuntimeException - No caso de nao ser possivel efectuar a coneccao.

getDataSource

public DataSource getDataSource()
                         throws DAORuntimeException
Cria um DataSource com uma coneccao a base de dados. Para establecer a ligacao, e usado um ficheiro de configuracao que deve estar ter o seguinte nome 'user.home/.db.unstable.teste'.

Returns:
Um DdataSource com uma coneccao valida a base de dados.
Throws:
DAORuntimeException - No caso de nao ser possivel efectuar a coneccao.

getTableName

public java.lang.String getTableName(java.lang.String name)
Devolve o nome de uma tabela, gerado com base no nome recebido e com base na data.

Parameters:
name - Description of the Parameter
Returns:
Uma String com um nome valido para uma tabela.

makeJarFile

public void makeJarFile(java.lang.String jarName,
                        java.lang.String serName)
Funcao auxiliar para construir ficheiros jar com tabelas serializadas

Parameters:
jarName - O nome a dar ao ficheiro jar
serName - nome do ficheiro com a tabela serializada a ser incluido no ficheiro jar