KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > sqls > CombinedConstraint


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
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 org.apache.ws.jaxme.sqls;
18
19 import java.util.Iterator JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.apache.ws.jaxme.sqls.impl.CombinedConstraintImpl;
23
24
25 /** Interface of a <code>WHERE</code> or <code>ON</code>
26  * clause.
27  */

28 public interface CombinedConstraint extends Constraint {
29     /** Specifies, how the various boolean constraints are
30      * combined.
31      */

32     public interface Type {
33         /** Specifies, that boolean constraints are combined with a
34          * boolean <code>AND</code>.
35          */

36         public final static Type AND = new CombinedConstraintImpl.TypeImpl("AND");
37         /** Specifies, that boolean constraints are combined with a
38          * boolean <code>OR</code>.
39          */

40         public final static Type OR = new CombinedConstraintImpl.TypeImpl("OR");
41     }
42
43    /** Returns the type, either of
44     * {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type#AND} or
45     * {@link org.apache.ws.jaxme.sqls.CombinedConstraint.Type#OR}.
46     */

47    public CombinedConstraint.Type getType();
48
49    /** Creates an AndConstraint and inserts it at the current position.
50     */

51    public CombinedConstraint createAndConstraint();
52
53    /** Creates an OrConstraint and inserts it at the current position.
54     */

55    public CombinedConstraint createOrConstraint();
56
57    /** Creates an "equals" condition (=) and inserts it at the current position.
58     */

59    public BooleanConstraint createEQ();
60
61    /** Creates a "not equals" condition (<>) and inserts it at the current position.
62     */

63    public BooleanConstraint createNE();
64
65    /** Creates a "lower than" condition (<) and inserts it at the current position.
66     */

67    public BooleanConstraint createLT();
68
69    /** Creates a "greater than" condition (>) and inserts it at the current position.
70     */

71    public BooleanConstraint createGT();
72
73    /** Creates a "lower or equal" condition (<=) and inserts it at the current position.
74     */

75    public BooleanConstraint createLE();
76
77    /** Creates a "greater or equal" condition (>=) and inserts it at the current position.
78     */

79    public BooleanConstraint createGE();
80
81    /** Creates a "LIKE" condition and inserts it at the current position.
82     */

83    public BooleanConstraint createLIKE();
84
85    /** Creates an "IS NULL" condition and inserts it at the current position.
86     */

87    public BooleanConstraint createISNULL();
88
89    /** Creates an "IN" condition and inserts it at the current position.
90     */

91    public BooleanConstraint createIN();
92
93    /** Creates an "EXISTS" condition with the given select
94     * statement and inserts it at the current position.
95     */

96    public void createEXISTS(SelectStatement pStatement);
97
98    /** Creates a "BETWEEN" condition with the given select
99     * statement and inserts it at the current position.
100     */

101    public BooleanConstraint createBETWEEN();
102
103    /** Creates a JOIN condition matching the given foreign key. In other
104     * words, if the foreign key consists of the columns <code>A</code> and
105     * <code>B</code> referencing the columns <code>X</code> and <code>Y</code>,
106     * then the following will be added: <code>A=X AND B=Y</code>.
107     * @param pKey The foreign key being matched.
108     * @param pReferencingTable A reference to the table returned by the
109     * foreign keys {@link org.apache.ws.jaxme.sqls.ForeignKey#getTable()}
110     * method.
111     * @param pReferencedTable A reference to the table returned by the
112     * foreign keys {@link org.apache.ws.jaxme.sqls.ForeignKey#getReferencedTable()}
113     * method.
114     */

115    public void addJoin(ForeignKey pKey, TableReference pReferencingTable,
116                        TableReference pReferencedTable);
117
118    /** Creates a JOIN condition matching the given column reference.
119     * In other words, if the referencing
120     * {@link org.apache.ws.jaxme.sqls.ColumnSet} contains the
121     * columns A and B, and the referenced column set contains
122     * {@link org.apache.ws.jaxme.sqls.ColumnSet},
123     * X and Y, then the following will be added: <code>A=X AND B=Y</code>.
124     */

125    public void addJoin(TableReference pReferencingTable,
126                        ColumnSet pReferencingColumnSet,
127                        TableReference pReferencedTable,
128                        ColumnSet pReferencedColumnSet);
129
130    /** Clones the given {@link org.apache.ws.jaxme.sqls.Constraint},
131     * mapping the column references
132     * from the given constraint to the values in the given map.
133     * @param pMap A Map with the constraints <code>pConstraint</code> table
134     * references as keys. The values are table references of the current
135     * constraints statement.
136     * @param pConstraint The constraint being cloned.
137     */

138    public void addConstraint(Map JavaDoc pMap, Constraint pConstraint);
139
140    /** Adds a check for the columns of the given column set. For example,
141     * if the column set consists of the columns <code>A</code> and <code>B</code>,
142     * then the following will be added: <code>A=? AND B=?</code>.
143     */

144    public void addColumnSetQuery(ColumnSet pSet, TableReference pTableReference);
145
146    /** Returns the number of parts, that have been added with the
147     * various <code>createSomething()</code> methods.
148     */

149    public int getNumParts();
150
151    /** Returns an Iterator to the parts, that have been added with the
152     * various <code>createSomething()</code> methods.
153     */

154    public Iterator JavaDoc getParts();
155
156    /** Returns whether the combined constraint is inverted by adding
157     * a prepending <code>NOT</code>.
158     */

159    public boolean isNOT();
160
161    /** Sets whether the combined constraint is inverted by adding
162     * a prepending <code>NOT</code>.
163     */

164    public void setNOT(boolean pNOT);
165 }
166
Popular Tags