KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > sqls > oracle > OraSelectStatementImpl


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

28 public class OraSelectStatementImpl extends SelectStatementImpl
29         implements OraSelectStatement {
30     /** Default implementation of
31      * {@link OraSelectStatement.OraOrderColumn}.
32      */

33     public static class OraOrderColumnImpl extends OrderColumnImpl
34             implements OraOrderColumn {
35         private final boolean nullsFirst;
36         /** Creates a new instance with the given values for
37          * {@link org.apache.ws.jaxme.sqls.SelectStatement.OrderColumn#getColumn()},
38          * {@link org.apache.ws.jaxme.sqls.SelectStatement.OrderColumn#isDescending()},
39          * and
40          * {@link OraSelectStatement.OraOrderColumn#isNullsFirst()}.
41          */

42         public OraOrderColumnImpl(Object JavaDoc pObject, boolean pDescending,
43                                   boolean pNullsFirst) {
44             super(pObject, pDescending);
45             nullsFirst = pNullsFirst;
46         }
47         public boolean isNullsFirst() { return nullsFirst; }
48     }
49     private CombinedConstraint startWith, connectByPrior;
50     
51     /** Creates a new instance with the given object factory.
52      */

53     public OraSelectStatementImpl(SQLFactory pFactory) {
54         super(pFactory);
55     }
56
57     public CombinedConstraint getStartWith() {
58         if (startWith == null) {
59             ObjectFactory f = getSQLFactory().getObjectFactory();
60             startWith = f.newCombinedConstraint(this, CombinedConstraint.Type.AND);
61         }
62         return startWith;
63     }
64
65     public CombinedConstraint getConnectBy() {
66         if (connectByPrior == null) {
67             ObjectFactory f = getSQLFactory().getObjectFactory();
68             connectByPrior = f.newCombinedConstraint(this, CombinedConstraint.Type.AND);
69         }
70         return connectByPrior;
71     }
72
73     /* (non-Javadoc)
74      * @see org.apache.ws.jaxme.sqls.oracle.OraSelectStatement#addOrderColumn(java.lang.Object, boolean, boolean)
75      */

76     public void addOrderColumn(Object JavaDoc pObject, boolean pDescending, boolean pNullsFirst) {
77         OraOrderColumn ooc = new OraOrderColumnImpl(pObject, pDescending, pNullsFirst);
78         super.addOrderColumn(ooc);
79     }
80 }
81
Popular Tags