KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > sqls > impl > JoinReferenceImpl


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.impl;
18
19 import org.apache.ws.jaxme.sqls.CombinedConstraint;
20 import org.apache.ws.jaxme.sqls.JoinReference;
21 import org.apache.ws.jaxme.sqls.ObjectFactory;
22 import org.apache.ws.jaxme.sqls.SelectTableReference;
23 import org.apache.ws.jaxme.sqls.Table;
24
25
26 /**
27  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
28  */

29 public class JoinReferenceImpl extends SelectTableReferenceImpl implements JoinReference {
30     private boolean outerJoin;
31     private SelectTableReference leftTableReference;
32     private CombinedConstraint onClause;
33     
34     /** <p>Creates a new instance of JoinReferenceImpl.</p>
35      */

36     protected JoinReferenceImpl(SelectTableReference pLeftTableReference, Table pRightTable,
37             boolean pOuterJoin) {
38         super(pLeftTableReference.getSelectStatement(), pRightTable);
39         leftTableReference = pLeftTableReference;
40         outerJoin = pOuterJoin;
41     }
42     
43     public boolean isJoin() {
44         return !outerJoin;
45     }
46     
47     public boolean isLeftOuterJoin() {
48         return outerJoin;
49     }
50     
51     public SelectTableReference getLeftJoinedTableReference() {
52         return leftTableReference;
53     }
54     
55     public CombinedConstraint getOn() {
56         if (onClause == null) {
57             ObjectFactory f = getSelectStatement().getSQLFactory().getObjectFactory();
58             onClause = f.newCombinedConstraint(getSelectStatement(), CombinedConstraint.Type.AND);
59         }
60         return onClause;
61     }
62 }
63
Popular Tags