01: package de.webman.form.db.queries;
02:
03: import java.sql.Connection;
04: import com.teamkonzept.db.TKPrepQuery;
05: import de.webman.form.db.FormConstants;
06:
07: /**
08: * Selects all document type components referenced by the specified form definition.
09: * <TABLE>
10: * <TR>
11: * <TD><B>Order</B></TD>
12: * <TD><B>Name</B></TD>
13: * <TD><B>Type</B></TD>
14: * </TR>
15: * <TR>
16: * <TD COLSPAN="3"><I>Parameters</I></TD>
17: * </TR>
18: * <TR>
19: * <TD><TT>1</TT></TD>
20: * <TD><TT>de.webman.form.db.FormConstants.FORM_ID</TT></TD>
21: * <TD><TT>java.lang.Integer</TT></TD>
22: * </TR>
23: * <TR>
24: * <TD COLSPAN="3"><I>Results</I></TD>
25: * </TR>
26: * <TR>
27: * <TD><TT>1</TT></TD>
28: * <TD><TT>SITE_TREE.SITE_NODE_ID</TT></TD>
29: * <TD><TT>java.lang.String</TT></TD>
30: * </TR>
31: * <TR>
32: * <TD><TT>2</TT></TD>
33: * <TD><TT>SITE_TREE.SITE_NODE_NAME</TT></TD>
34: * <TD><TT>java.lang.String</TT></TD>
35: * </TR>
36: * </TABLE>
37: *
38: * @author $Author: uli $
39: * @version $Revision: 1.3 $
40: */
41: public class SelectReferencedSiteNodes extends TKPrepQuery {
42:
43: // Constants.
44:
45: /**
46: * The preparation state.
47: */
48: private final static boolean IS_PREPARED = true;
49:
50: /**
51: * The parameter order.
52: */
53: private final static String[] PARAMETER_ORDER = { FormConstants.COLUMN_NAMES[FormConstants.FORM_ID] };
54:
55: /**
56: * The parameter types.
57: */
58: private final static Object[][] PARAMETER_TYPES = { {
59: FormConstants.COLUMN_NAMES[FormConstants.FORM_ID],
60: FormConstants.COLUMN_TYPES[FormConstants.FORM_ID] } };
61:
62: /**
63: * The relevance state.
64: */
65: private final static boolean[] SET_RELEVANTS = { true };
66:
67: /**
68: * The SQL statement.
69: */
70: private final static String SQL_STRING = "SELECT ST.SITE_NODE_ID, ST.SITE_NODE_NAME, ST.SITE_NODE_PARENT "
71: + "FROM FORM FO, STRUCTURED_CONTENT SC, SITE_TREE ST "
72: + "WHERE FO.FORM_ID = ? "
73: + "AND FO.FORM_ID = SC.FORM_ID "
74: + "AND SC.SITE_NODE_ID = ST.SITE_NODE_ID";
75:
76: // Implementation of 'com.teamkonzept.db.TKQuery'
77:
78: /**
79: * Initializes the query with the given connection.
80: *
81: * @param connection the connection.
82: */
83: public void initQuery(Connection connection) {
84: super.initQuery(connection, IS_PREPARED, PARAMETER_ORDER,
85: PARAMETER_TYPES, SET_RELEVANTS, SQL_STRING);
86: }
87:
88: }
|