View Javadoc
1   /*
2    *
3    * The DbUnit Database Testing Framework
4    * Copyright (C)2002-2004, DbUnit.org
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 2.1 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   *
20   */
21  package org.dbunit.dataset.filter;
22  
23  import org.dbunit.database.AmbiguousTableNameException;
24  import org.dbunit.dataset.DataSetException;
25  import org.dbunit.dataset.IDataSet;
26  import org.dbunit.dataset.ITable;
27  import org.dbunit.dataset.ITableIterator;
28  
29  import java.util.Collection;
30  
31  /**
32   * Represents a strategy used by {@link org.dbunit.dataset.FilteredDataSet} to
33   * exposes only some tables from a dataset.
34   *
35   * @author Manuel Laflamme
36   * @since Mar 7, 2003
37   * @version $Revision$
38   */
39  public interface ITableFilter extends ITableFilterSimple
40  {
41      /**
42       * Returns the table names allowed by this filter from the specified dataset.
43       *
44       * @param dataSet the filtered dataset
45       */
46      public String[] getTableNames(IDataSet dataSet) throws DataSetException;
47  
48      /**
49       * Returns iterator of tables allowed by this filter from the specified dataset.
50       *
51       * @param dataSet the filtered dataset
52       */
53      public ITableIterator iterator(IDataSet dataSet, boolean reversed)
54              throws DataSetException;
55  
56      /**
57       * Add a {@link org.dbunit.dataset.ITable} to the filter.
58       *
59       * @param table {@link ITable} to add to the filter.
60       * @throws AmbiguousTableNameException
61       */
62      public void addTable(ITable table) throws AmbiguousTableNameException;
63  
64      /**
65       * Add all {@link ITable} stored in a {@link java.util.Collection} to the filter.
66       *
67       * @param tables Collection of @link(org.dbunit.dataset.ITable) to add to the filter.
68       * @throws AmbiguousTableNameException
69       */
70      public void addTables(Collection<ITable> tables) throws AmbiguousTableNameException;
71  
72      /**
73       * Add all {@link org.dbunit.dataset.ITable} stored in a {@link org.dbunit.dataset.IDataSet} to the filter.
74       *
75       * @param dataSet {@link org.dbunit.dataset.IDataSet} from which all tables will be added to the filter.
76       * @throws AmbiguousTableNameException
77       */
78      public void addTables(IDataSet dataSet) throws DataSetException;
79  }