Package org.dbunit.database
Class PrimaryKeyFilter
java.lang.Object
org.dbunit.dataset.filter.AbstractTableFilter
org.dbunit.database.PrimaryKeyFilter
- All Implemented Interfaces:
ITableFilter,ITableFilterSimple
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
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$
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMap that associates a table with a set of primary key objects. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPrimaryKeyFilter(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...). -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanisValidName(String tableName) Returnstrueif specified table is allowed by this filter.Returns iterator of tables allowed by this filter from the specified dataset.voidtoString()Methods inherited from class org.dbunit.dataset.filter.AbstractTableFilter
accept, getTableNames
-
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 connectionallowedPKs- 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
-
nodeAdded
-
edgeAdded
-
isValidName
Description copied from class:AbstractTableFilterReturnstrueif specified table is allowed by this filter. This legacy method, now replaced by accept, still exist for compatibily with older environment- Specified by:
isValidNamein classAbstractTableFilter- Throws:
DataSetException- See Also:
-
iterator
Description copied from interface:ITableFilterReturns iterator of tables allowed by this filter from the specified dataset.- Specified by:
iteratorin interfaceITableFilter- Overrides:
iteratorin classAbstractTableFilter- Parameters:
dataSet- the filtered dataset- Throws:
DataSetException
-
toString
-