View Javadoc
1   /*
2   Copyright (c) 2007 Health Market Science, Inc.
3   
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7   
8       http://www.apache.org/licenses/LICENSE-2.0
9   
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16  
17  package com.healthmarketscience.jackcess.util;
18  
19  import java.io.IOException;
20  import java.sql.ResultSetMetaData;
21  import java.sql.SQLException;
22  import java.util.List;
23  import com.healthmarketscience.jackcess.ColumnBuilder;
24  
25  /**
26   * Interface which allows customization of the behavior of the
27   * {@link ImportUtil} import methods.
28   *
29   * @author James Ahlborn
30   * @usage _general_class_
31   */
32  public interface ImportFilter {
33  
34    /**
35     * The columns that should be used to create the imported table.
36     * @param destColumns the columns as determined by the import code, may be
37     *                    directly modified and returned
38     * @param srcColumns the sql metadata, only available if importing from a
39     *                   JDBC source
40     * @return the columns to use when creating the import table
41     */
42    public List<ColumnBuilder> filterColumns(List<ColumnBuilder> destColumns,
43                                             ResultSetMetaData srcColumns)
44       throws SQLException, IOException;
45  
46    /**
47     * The desired values for the row.
48     * @param row the row data as determined by the import code, may be directly
49     *            modified
50     * @return the row data as it should be written to the import table.  if
51     *         {@code null}, the row will be skipped
52     */
53    public Object[] filterRow(Object[] row)
54      throws SQLException, IOException;
55  
56  }