01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: AbstractWhereGroup.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.database.queries;
09:
10: import com.uwyn.rife.database.Datasource;
11:
12: public abstract class AbstractWhereGroup<ParentType extends WhereQuery>
13: extends AbstractWhereQuery<AbstractWhereGroup<ParentType>>
14: implements Cloneable {
15: protected WhereQuery mParent = null;
16:
17: protected AbstractWhereGroup(Datasource datasource,
18: WhereQuery parent) {
19: super (datasource);
20:
21: mParent = parent;
22: }
23:
24: public ParentType end() {
25: mParent.whereAnd("(" + getSql() + ")");
26: mParent.addWhereParameters(getWhereParameters());
27:
28: return (ParentType) mParent;
29: }
30:
31: public String getSql() {
32: return mWhere.toString();
33: }
34:
35: public AbstractWhereGroup<ParentType> clone() {
36: return (AbstractWhereGroup<ParentType>) super.clone();
37: }
38: }
|