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