1   /*
2    * Copyright 2003 - 2014 The eFaps Team
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   * Revision:        $Rev$
17   * Last Changed:    $Date$
18   * Last Changed By: $Author$
19   */
20  
21  package org.efaps.db.print;
22  
23  import java.sql.SQLException;
24  
25  import org.efaps.admin.datamodel.Type;
26  import org.efaps.db.wrapper.SQLSelect;
27  import org.efaps.util.EFapsException;
28  
29  /**
30   * Interface used for the different Select parts.
31   *
32   * @author The eFaps Team
33   * @version $Id$
34   */
35  public interface ISelectPart
36  {
37      /**
38       * Method to join a table to the given from select statement.
39       *
40       * @param _oneselect    oneselect this select part must be joined to
41       * @param _select       SQL select statement wrapper
42       * @param _relIndex     relation index
43       * @return table index of the joint table
44       * @throws EFapsException on error
45       */
46      int join(final OneSelect _oneselect,
47               final SQLSelect _select,
48               final int _relIndex)
49          throws EFapsException;
50  
51      /**
52       * Method to get the Type the part belongs to.
53       *
54       * @return type
55       */
56      Type getType();
57  
58  
59      /**
60       * Add an Object.
61       * @param _row values
62       * @throws SQLException on error
63       */
64      void addObject(final Object[] _row)
65          throws SQLException;
66  
67      /**
68       * Get the Object that was added using {@link #addObject(ResultSet)}.
69       * @return Object
70       */
71      Object getObject();
72  
73  
74      /**
75       * Add something to the where part of the SQL select.
76       * @param _oneselect    oneselect this select part must be joined to
77       * @param _select       SQL select statement wrapper
78       */
79      void add2Where(final OneSelect _oneselect,
80                     final SQLSelect _select);
81  
82  
83      /**
84       * Move the SelectPart one step forward.
85       * @throws EFapsException on error
86       */
87      void next()
88          throws EFapsException;
89  }