Class TablesDependencyHelper

java.lang.Object
org.dbunit.database.search.TablesDependencyHelper

public class TablesDependencyHelper extends Object
Helper for the graph-search based classes used to calculate dependency among tables.
Since:
Aug 26, 2005
Version:
$Revision$ $Date$
Author:
Felipe Leme (dbunit@felipeal.net), Last changed by: $Author$
  • Method Details

    • getDependentTables

      public static String[] getDependentTables(IDatabaseConnection connection, String rootTable) throws SearchException
      Get the name of all tables that depend on the root tables (i.e, all tables that have FKs pointing to the PK of the root table).
      Parameters:
      connection - database connection
      rootTable - root table described above
      Returns:
      name of all tables that depend on the root table (including the root table), in the right order for insertions
      Throws:
      SearchException - if an exception occurred while calculating the order
    • getDependentTables

      public static String[] getDependentTables(IDatabaseConnection connection, String[] rootTables) throws SearchException
      Get the name of all tables that depend on the root tables (i.e, all tables that have FKs pointing to the PK of one of the root tables).
      Parameters:
      connection - database connection
      rootTables - array of root tables described above
      Returns:
      name of all tables that depend on the root tables (including the root tables), in the right order for insertions
      Throws:
      SearchException - if an exception occurred while calculating the order
    • getDependsOnTables

      public static String[] getDependsOnTables(IDatabaseConnection connection, String rootTable) throws SearchException
      Get the name of all tables that the given rootTable depends on (i.e, all tables whose PK is a FK for the root table).
      Parameters:
      connection - database connection
      rootTable - root table described above
      Returns:
      name of all tables that the rootTable depends on (including the rootTable itself), in the right order for insertions
      Throws:
      SearchException - if an exception occurred while calculating the order
      Since:
      2.4
    • getAllDependentTables

      public static String[] getAllDependentTables(IDatabaseConnection connection, String rootTable) throws SearchException
      Get the name of all tables that depend on a root table ( i.e, all tables whose PK is a FK for the root table) and also the tables the root table depends on (i.e., all tables which have a FK for the root table's PK).
      Parameters:
      connection - database connection
      rootTable - root table described above
      Returns:
      name of all tables that depend on the root table (including the root table), in the right order for insertions
      Throws:
      SearchException - if an exception occurred while calculating the order
    • getAllDependentTables

      public static String[] getAllDependentTables(IDatabaseConnection connection, String[] rootTables) throws SearchException
      Get the name of all tables that depend on the root tables ( i.e, all tables whose PK is a FK for any of the root tables) and also the tables the root tables depends on (i.e., all tables which have a FK for any of the root table's PK).
      Parameters:
      connection - database connection
      rootTables - root tables described above
      Returns:
      name of all tables that depend on the root tables (including the root tables), in the right order for insertions
      Throws:
      SearchException - if an exception occurred while calculating the order
    • getDataset

      public static IDataSet getDataset(IDatabaseConnection connection, String rootTable, Set allowedIds) throws SearchException, SQLException, DataSetException
      Throws:
      SearchException
      SQLException
      DataSetException
    • getDataset

      public static IDataSet getDataset(IDatabaseConnection connection, PrimaryKeyFilter.PkTableMap rootTables) throws SearchException, SQLException, DataSetException
      Throws:
      SearchException
      SQLException
      DataSetException
    • getAllDataset

      public static IDataSet getAllDataset(IDatabaseConnection connection, String rootTable, Set allowedPKs) throws SearchException, SQLException, DataSetException
      Throws:
      SearchException
      SQLException
      DataSetException
    • getAllDataset

      public static IDataSet getAllDataset(IDatabaseConnection connection, PrimaryKeyFilter.PkTableMap rootTables) throws SearchException, SQLException, DataSetException
      Throws:
      SearchException
      SQLException
      DataSetException
    • getDirectDependsOnTables

      public static Set getDirectDependsOnTables(IDatabaseConnection connection, String tableName) throws SearchException
      Returns a set of tables on which the given table directly depends on.
      Parameters:
      connection - The connection to be used for the database lookup.
      tableName -
      Returns:
      a set of tables on which the given table directly depends on.
      Throws:
      SearchException
      Since:
      2.4
    • getDirectDependentTables

      public static Set getDirectDependentTables(IDatabaseConnection connection, String tableName) throws SearchException
      Returns a set of tables which directly depend on the given table.
      Parameters:
      connection - The connection to be used for the database lookup.
      tableName -
      Returns:
      a set of tables on which the given table directly depends on.
      Throws:
      SearchException
      Since:
      2.4