* @throws Exception
*
*/
public List<String> getTableNamesOrdered() throws Exception {
IDatabaseConnection conn = null;
try{
//to prevent a double loading, because the table list can be loaded in many panels
if (tableNamesList == null)
{
ArrayList<String> tableListOrdered = new ArrayList<String>();
BasicDataSource ds = DatabaseConnectionFactory.getDataSource();
conn = new DatabaseConnection(ds.getConnection());
ITableFilter filter = new DatabaseSequenceFilter(conn);
//The dataSet: ie the list of ALL tables name
IDataSet dataSet = new FilteredDataSet(filter, conn.createDataSet());
ITableIterator iter = dataSet.iterator();
while(iter.next())
{
ITable tab = iter.getTable();
String tableName = tab.getTableMetaData().getTableName();
tableListOrdered.add(tableName);
}
tableNamesList = tableListOrdered;
return tableNamesList;
}else
return tableNamesList;
}catch (Exception e) {
if(Log4jManager.IS_LOGGING_CONFIGURED)
logger.fatal("Error loading tables names ordered, cause: ",e);
throw new Exception("Set a valid target Database and test the connection");
}finally{
if(conn != null)
conn.close();
}
}