Class PrimaryKeyFilter

All Implemented Interfaces:
ITableFilter, ITableFilterSimple

public class PrimaryKeyFilter extends AbstractTableFilter
Filter a table given a map of the allowed rows based on primary key values.
It uses a depth-first algorithm (although not recursive - it might be refactored in the future) to define which rows are allowed, as well which rows are necessary (and hence allowed) because of dependencies with the allowed rows.
NOTE: multi-column primary keys are not supported at the moment. TODO: test cases
Since:
Sep 9, 2005
Version:
$Revision$ $Date$
Author:
Felipe Leme (dbunit@felipeal.net), Last changed by: $Author$
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
  • Constructor Details

    • PrimaryKeyFilter

      public PrimaryKeyFilter(IDatabaseConnection connection, PrimaryKeyFilter.PkTableMap allowedPKs, boolean reverseDependency)
      Default constructor, it takes as input a map with desired rows in a final dataset; the filter will ensure that the rows necessary by these initial rows are also allowed (and so on...).
      Parameters:
      connection - database connection
      allowedPKs - map of allowed rows, based on the primary keys (key is the name of a table; value is a Set with allowed primary keys for that table)
      reverseDependency - flag indicating if the rows that depend on a row should also be allowed by the filter
  • Method Details