Package org.dbunit.util.search

Examples of org.dbunit.util.search.DepthFirstSearch.search()


    {
        logger.debug("getDependentTables(connection={}, rootTables={}) - start", connection, rootTables);

        ImportedKeysSearchCallback callback = new ImportedKeysSearchCallback(connection);
        DepthFirstSearch search = new DepthFirstSearch();
        Set tables = search.search( rootTables, callback );
        return CollectionsHelper.setToStrings( tables );
    }

    /**
     * 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).
View Full Code Here


    {
        logger.debug("getDependsOnTables(connection={}, rootTable={}) - start", connection, rootTable);

        ExportedKeysSearchCallback callback = new ExportedKeysSearchCallback(connection);
        DepthFirstSearch search = new DepthFirstSearch();
        Set tables = search.search( new String[]{rootTable}, callback );
        return CollectionsHelper.setToStrings( tables );
    }

    /**
     * Get the name of all tables that depend on a root table ( i.e, all tables whose PK
View Full Code Here

    {
        logger.debug("getAllDependentTables(connection={}, rootTables={}) - start",connection, rootTables);

        ImportedAndExportedKeysSearchCallback callback = new ImportedAndExportedKeysSearchCallback(connection);
        DepthFirstSearch search = new DepthFirstSearch();
        Set tables = search.search(rootTables, callback);
        return CollectionsHelper.setToStrings(tables);
    }

    // TODO: javadoc (and unit tests) from down here...
View Full Code Here

        ImportedKeysSearchCallbackFilteredByPKs callback = new ImportedKeysSearchCallbackFilteredByPKs(connection, rootTables);
        ITableFilter filter = callback.getFilter();
        DepthFirstSearch search = new DepthFirstSearch();
        String[] tableNames = rootTables.getTableNames();
        ListOrderedSet tmpTables = search.search( tableNames, callback );
        String[] dependentTables  = CollectionsHelper.setToStrings( tmpTables );
        IDataSet tmpDataset = connection.createDataSet( dependentTables );
        FilteredDataSet dataset = new FilteredDataSet(filter, tmpDataset);
        return dataset;
    }
View Full Code Here

        ImportedAndExportedKeysSearchCallbackFilteredByPKs callback = new ImportedAndExportedKeysSearchCallbackFilteredByPKs(connection, rootTables);   
        ITableFilter filter = callback.getFilter();
        DepthFirstSearch search = new DepthFirstSearch();
        String[] tableNames = rootTables.getTableNames();
        Set tmpTables = search.search( tableNames, callback );
        String[] dependentTables  = CollectionsHelper.setToStrings( tmpTables );
        IDataSet tmpDataset = connection.createDataSet( dependentTables );
        FilteredDataSet dataset = new FilteredDataSet(filter, tmpDataset);
        return dataset;
    }
View Full Code Here

                    connection, tableName);
       
        ExportedKeysSearchCallback callback = new ExportedKeysSearchCallback(connection);
        // Do a depthFirstSearch with a recursion depth of 1
        DepthFirstSearch search = new DepthFirstSearch(1);
        Set tables = search.search( new String[]{tableName}, callback );
        return tables;
    }

    /**
     * Returns a set of tables which directly depend on the given table.
View Full Code Here

                    connection, tableName);

        ImportedKeysSearchCallback callback = new ImportedKeysSearchCallback(connection);
        // Do a depthFirstSearch with a recursion depth of 1
        DepthFirstSearch search = new DepthFirstSearch(1);
        Set tables = search.search( new String[]{tableName}, callback );
        return tables;
    }

}
View Full Code Here

   * @throws SearchException if an exception occurred while calculating the order
   */
  public static String[] getDependentTables( IDatabaseConnection connection, String[] rootTables ) throws SearchException {
    ImportedKeysSearchCallback callback = new ImportedKeysSearchCallback(connection);
    DepthFirstSearch search = new DepthFirstSearch();
    Set tables = search.search( rootTables, callback );
    return (String[]) CollectionsHelper.setToStrings( tables );
  }
 
  /**
   * Get the name of all tables that depend on a root table ( i.e, all tables whose PK
View Full Code Here

   * @throws SearchException if an exception occurred while calculating the order
   */
  public static String[] getAllDependentTables( IDatabaseConnection connection, String[] rootTables ) throws SearchException {
    ImportedAndExportedKeysSearchCallback callback = new ImportedAndExportedKeysSearchCallback(connection);
    DepthFirstSearch search = new DepthFirstSearch();
    Set tables = search.search( rootTables, callback );
    return (String[]) CollectionsHelper.setToStrings( tables );
  }

  // TODO: javadoc (and unit tests) from down here...

View Full Code Here

  public static IDataSet getDataset( IDatabaseConnection connection, Map rootTables ) throws SearchException, SQLException {
    ImportedKeysSearchCallbackFilteredByPKs callback = new ImportedKeysSearchCallbackFilteredByPKs(connection, rootTables);
    ITableFilter filter = callback.getFilter();
    DepthFirstSearch search = new DepthFirstSearch();
    String[] tableNames = CollectionsHelper.setToStrings( rootTables.keySet() );
    Set tmpTables = search.search( tableNames, callback );
    String[] dependentTables  = CollectionsHelper.setToStrings( tmpTables );
    IDataSet tmpDataset = connection.createDataSet( dependentTables );
    FilteredDataSet dataset = new FilteredDataSet(filter, tmpDataset);
    return dataset;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.