01: /*
02: * Geotools2 - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package org.geotools.arcsde.data.view;
18:
19: import net.sf.jsqlparser.statement.select.PlainSelect;
20: import net.sf.jsqlparser.statement.select.SelectBody;
21: import net.sf.jsqlparser.statement.select.SubSelect;
22:
23: import com.esri.sde.sdk.client.SeConnection;
24:
25: /**
26: * Qualifies a column reference in a subselect clause.
27: *
28: * @author Gabriel Roldan, Axios Engineering
29: * @version $Id: SubSelectQualifier.java 29135 2008-02-07 19:49:09Z desruisseaux $
30: *
31: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/arcsde/datastore/src/main/java/org/geotools/arcsde/data/view/SubSelectQualifier.java $
32: * @since 2.3.x
33: */
34: class SubSelectQualifier {
35: /**
36: * DOCUMENT ME!
37: *
38: * @param conn DOCUMENT ME!
39: * @param subSelect DOCUMENT ME!
40: *
41: * @return DOCUMENT ME!
42: */
43: public static SubSelect qualify(SeConnection conn,
44: SubSelect subSelect) {
45: String alias = subSelect.getAlias();
46: SelectBody select = subSelect.getSelectBody();
47:
48: SelectQualifier visitor = new SelectQualifier(conn);
49: select.accept(visitor);
50:
51: PlainSelect qualifiedSelect = visitor.getQualifiedQuery();
52:
53: SubSelect qualifiedSubSelect = new SubSelect();
54: qualifiedSubSelect.setAlias(alias);
55: qualifiedSubSelect.setSelectBody(qualifiedSelect);
56:
57: return qualifiedSubSelect;
58: }
59: }
|