1   /*
2    * Copyright 2003 - 2013 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  
22  package org.efaps.db.search.section;
23  
24  import org.efaps.db.AbstractObjectQuery;
25  import org.efaps.db.search.AbstractQPart;
26  import org.efaps.db.wrapper.SQLPart;
27  import org.efaps.db.wrapper.SQLSelect;
28  import org.efaps.util.EFapsException;
29  
30  
31  
32  /**
33   * TODO comment!
34   *
35   * @author The eFaps Team
36   * @version $Id$
37   */
38  public class QWhereSection
39      extends AbstractQSection
40  {
41  
42      /**
43       * Base part for this Where.
44       */
45      private AbstractQPart part;
46  
47      /**
48       * @param _part part for this where
49       */
50      public QWhereSection(final AbstractQPart _part)
51      {
52          this.part = _part;
53      }
54  
55      /**
56       * Getter method for the instance variable {@link #part}.
57       *
58       * @return value of instance variable {@link #part}
59       */
60      public AbstractQPart getPart()
61      {
62          return this.part;
63      }
64  
65      /**
66       * Setter method for instance variable {@link #part}.
67       *
68       * @param _part value for instance variable {@link #part}
69       */
70  
71      public void setPart(final AbstractQPart _part)
72      {
73          this.part = _part;
74      }
75  
76      /**
77       * {@inheritDoc}
78       */
79      @Override
80      public QWhereSection appendSQL(final SQLSelect _select)
81          throws EFapsException
82      {
83          _select.addPart(SQLPart.WHERE);
84          this.part.appendSQL(_select);
85          return this;
86      }
87  
88      /**
89       * {@inheritDoc}
90       */
91      @Override
92      public QWhereSection prepare(final AbstractObjectQuery<?> _query)
93          throws EFapsException
94      {
95          this.part.prepare(_query, null);
96          return this;
97      }
98  }