KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > content > db > queries > XMLContentRetrieve


1 package de.webman.content.db.queries;
2
3 import java.sql.Connection JavaDoc;
4 import java.sql.Types JavaDoc;
5 import com.teamkonzept.db.TKPrepQuery;
6 import de.webman.content.db.ContentConstants;
7 import de.webman.content.db.ContentInstanceConstants;
8 import de.webman.content.db.ContentTreeConstants;
9 import de.webman.content.db.ContentVersionConstants;
10
11 /**
12  * Retrieves an existing content from the database.
13  * <TABLE>
14  * <TR>
15  * <TD><B>Order</B></TD>
16  * <TD><B>Name</B></TD>
17  * <TD><B>Type</B></TD>
18  * </TR>
19  * <TR>
20  * <TD COLSPAN="3"><I>Parameters<I/></TD>
21  * </TR>
22  * <TR>
23  * <TD><TT>1</TT></TD>
24  * <TD><TT>de.webman.content.db.ContentConstants.CONTENT_ID</TT></TD>
25  * <TD><TT>java.lang.Integer</TT></TD>
26  * </TR>
27  * <TR>
28  * <TD COLSPAN="3"><I>Results<I/></TD>
29  * </TR>
30  * <TR>
31  * <TD><TT>1</TT></TD>
32  * <TD><TT>de.webman.content.db.ContentConstants.XML_TEXT</TT></TD>
33  * <TD><TT>java.lang.String</TT></TD>
34  * </TR>
35  * <TR>
36  * <TD><TT>2</TT></TD>
37  * <TD><TT>de.webman.content.db.ContentTreeConstants.CONTENT_FORM</TT></TD>
38  * <TD><TT>java.lang.Integer</TT></TD>
39  * </TR>
40  * <TR>
41  * <TD><TT>3</TT></TD>
42  * <TD><TT>de.webman.content.db.ContentTreeConstants.CONTENT_NODE_SHORTNAME</TT></TD>
43  * <TD><TT>java.lang.String</TT></TD>
44  * </TR>
45  * <TR>
46  * <TD><TT>4</TT></TD>
47  * <TD><TT>de.webman.content.db.ContentTreeConstants.CONTENT_NODE_NAME</TT></TD>
48  * <TD><TT>java.lang.String</TT></TD>
49  * </TR>
50  * </TABLE>
51  *
52  * @author <A HREF="mailto:unl@webman.de">Ulrich Nicolas Liss&eacute;</A>,
53  * &copy; 2001 Webman AG.
54  * @version $Revision: 1.4 $
55  */

56 public class XMLContentRetrieve
57     extends TKPrepQuery
58 {
59     // $Id: XMLContentRetrieve.java,v 1.4 2001/09/11 12:27:34 uli Exp $
60

61     // Constants.
62

63     /**
64      * The preparation state.
65      */

66     private final static boolean IS_PREPARED = true;
67
68     /**
69      * The parameter order.
70      */

71     private final static String JavaDoc[] PARAMETER_ORDER =
72     {
73         ContentConstants.CONTENT_ID
74     };
75
76     /**
77      * The parameter types.
78      */

79     private final static Object JavaDoc[][] PARAMETER_TYPES =
80     {
81         {ContentConstants.CONTENT_ID, new Integer JavaDoc(Types.INTEGER)}
82     };
83
84     /**
85      * The relevance state.
86      */

87     private final static boolean[] SET_RELEVANTS =
88     {
89         true
90     };
91
92     /**
93      * The SQL statement.
94      */

95 // private final static String SQL_STRING = "SELECT XML_TEXT FROM CONTENT WHERE CONTENT_ID = ?";
96

97     private final static String JavaDoc SQL_STRING = (new StringBuffer JavaDoc()).append("SELECT CONTENT.XML_TEXT, CONTENT_TREE.CONTENT_FORM, CONTENT_TREE.CONTENT_NODE_SHORTNAME, CONTENT_TREE.CONTENT_NODE_NAME ")
98                                                                  .append("FROM CONTENT, CONTENT_VERSION, CONTENT_INSTANCE, CONTENT_TREE ")
99                                                                  .append("WHERE CONTENT.CONTENT_ID = ? ")
100                                                                  .append("AND CONTENT.CONTENT_ID = CONTENT_VERSION.CONTENT_ID ")
101                                                                  .append("AND CONTENT_VERSION.INSTANCE_ID = CONTENT_INSTANCE.INSTANCE_ID ")
102                                                                  .append("AND CONTENT_INSTANCE.CONTENT_NODE_ID = CONTENT_TREE.CONTENT_NODE_ID")
103                                                                  .toString();
104
105
106     // Implementation of 'com.teamkonzept.db.TKQuery'
107

108     /**
109      * Initializes the query with the given connection.
110      *
111      * @param connection the connection.
112      */

113     public void initQuery (Connection JavaDoc connection)
114     {
115         super.initQuery(connection,
116                         IS_PREPARED,
117                         PARAMETER_ORDER,
118                         PARAMETER_TYPES,
119                         SET_RELEVANTS,
120                         SQL_STRING);
121     }
122
123 }
124
Popular Tags