01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/webman/refsel/db/queries/TKWMDBRSMother.java,v 1.7 2001/09/18 15:27:28 markus Exp $
03: *
04: */
05: package com.teamkonzept.webman.refsel.db.queries;
06:
07: import java.sql.*;
08:
09: import com.teamkonzept.db.*;
10:
11: /*
12: * TKWMDBRSMother
13: * @author
14: * @version
15: */
16: public class TKWMDBRSMother extends TKPrepQuery {
17:
18: public final static boolean IS_PREPARED = true;
19:
20: public final static String[] PARAM_ORDER = { SITE_NODE_ID,
21: SITE_NODE_ID, SITE_NODE_ID };
22:
23: public final static Object[][] PARAM_TYPES = null;
24:
25: public final static boolean[] SET_RELEVANTS = { true };
26:
27: public final static String SQL_STRING = " SELECT INNER.LEFT_NR LEFT_NR, INNER.DOCUMENT_SHORTNAME DOCUMENT_SHORTNAME, OUTER.DOCUMENT_NAME DOCUMENT_NAME "
28: + " FROM "
29: + " ( "
30: + " SELECT MAX(ST.LEFT_NR) LEFT_NR, SD.DOCUMENT_SHORTNAME "
31: + " FROM SITE_TREE ST, SITE_DOCUMENT SD "
32: + " WHERE "
33: + " ST.SITE_NODE_ID = SD.SITE_NODE_ID "
34: + " AND "
35: + " ( "
36: + " ST.LEFT_NR < (SELECT LEFT_NR FROM SITE_TREE WHERE SITE_NODE_ID = ?) " /* SITE_NODE_ID */
37: + " AND "
38: + " ST.RIGHT_NR > (SELECT RIGHT_NR FROM SITE_TREE WHERE SITE_NODE_ID =?) " /* SITE_NODE_ID */
39: + " ) "
40: + " AND "
41: + " ( "
42: + " SD.INHERITABLE = 1 "
43: + " OR "
44: + " SD.SITE_NODE_ID = (SELECT SITE_NODE_PARENT FROM SITE_TREE WHERE SITE_NODE_ID = ?) " /* SITE_NODE_ID */
45: + " ) "
46: + " GROUP BY SD.DOCUMENT_SHORTNAME "
47: + " ) "
48: + " INNER, SITE_DOCUMENT OUTER "
49: + " WHERE "
50: + " INNER.DOCUMENT_SHORTNAME = OUTER.DOCUMENT_SHORTNAME "
51: + " ORDER BY LEFT_NR ";
52:
53: public void initQuery(Connection con) {
54: super.initQuery(con, IS_PREPARED, PARAM_ORDER, PARAM_TYPES,
55: SET_RELEVANTS, SQL_STRING);
56: }
57: }
|