KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > form > db > queries > SelectReferencedContents


1 package de.webman.form.db.queries;
2
3 import java.sql.Connection JavaDoc;
4 import com.teamkonzept.db.TKPrepQuery;
5 import com.teamkonzept.webman.mainint.DatabaseDefaults;
6 import de.webman.form.db.FormConstants;
7
8 /**
9  * 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
44     extends TKPrepQuery
45 {
46
47     // Constants.
48

49     /**
50      * The preparation state.
51      */

52     private final static boolean IS_PREPARED = true;
53
54     /**
55      * The parameter order.
56      */

57     private final static String JavaDoc[] PARAMETER_ORDER =
58     {
59         FormConstants.COLUMN_NAMES[FormConstants.FORM_ID]
60     };
61
62     /**
63      * The parameter types.
64      */

65     private final static Object JavaDoc[][] PARAMETER_TYPES =
66     {
67         {FormConstants.COLUMN_NAMES[FormConstants.FORM_ID], FormConstants.COLUMN_TYPES[FormConstants.FORM_ID]}
68     };
69
70     /**
71      * The relevance state.
72      */

73     private final static boolean[] SET_RELEVANTS =
74     {
75         true
76     };
77
78     /**
79      * The SQL statement.
80      */

81     private final static String JavaDoc SQL_STRING = "SELECT CT1.CONTENT_NODE_ID, CT1.CONTENT_NODE_TYPE, CT1.CONTENT_NODE_NAME, CT1.CONTENT_NODE_PARENT " +
82                                              "FROM CONTENT_TREE CT1, CONTENT_TREE CT2 " +
83                                              "WHERE CT1.CONTENT_FORM = ? " +
84                                              "AND CT1.CONTENT_NODE_PARENT = CT2.CONTENT_NODE_ID " +
85                                              "AND CT2.CONTENT_NODE_TYPE = " + DatabaseDefaults.DIRECTORY_NODE;
86
87
88     // Implementation of 'com.teamkonzept.db.TKQuery'
89

90     /**
91      * Initializes the query with the given connection.
92      *
93      * @param connection the connection.
94      */

95     public void initQuery (Connection JavaDoc connection)
96     {
97         super.initQuery(connection,
98                         IS_PREPARED,
99                         PARAMETER_ORDER,
100                         PARAMETER_TYPES,
101                         SET_RELEVANTS,
102                         SQL_STRING);
103     }
104
105 }
106
Popular Tags