01: package com.teamkonzept.webman.mainint.db.queries;
02:
03: import com.teamkonzept.db.*;
04: import java.sql.*;
05: import com.teamkonzept.lib.templates.*;
06:
07: /**
08: * TKDBGetAllTreeNodeContentVersions
09: * Holt alle versionen aller aktuellen Contents eines Content-Tree-Knotens
10: *
11: * @author $Author: alex $
12: * @version $Revision: 1.19 $
13: */
14: public class TKDBGetAllTreeContentVersions extends TKUnprepQuery {
15:
16: public static Object[][] paramTypes = { { "SEARCH",
17: new Integer(Types.VARCHAR) } };
18:
19: public static boolean[] setRelevants = { true };
20: /** die Query */
21: public static String sqlString = "SELECT "
22: + " CV.VERSION_ID, CV.INSTANCE_ID, CI.CONTENT_NODE_ID, CV.CONTENT_ID, CV.STATUS_ID, CV.VERSION_DATE, CV.AUTHOR, CV.INFO, VS.STATUS, "
23: + " CT.CONTENT_NODE_NAME, CT2.CONTENT_NODE_TYPE AS PARENT_TYPE, CT.CONTENT_NODE_PARENT, CT.CONTENT_NODE_SHORTNAME, CT.CONTENT_FORM, CT.CONTENT_NODE_TYPE, CI.NAME "
24: + "FROM "
25: + " CONTENT C,<TK_CASE:KENNUNG> CONTENT_VALUE CVALUE,</TK_CASE> CONTENT_TREE CT, CONTENT_TREE CT2, CONTENT_VERSION CV, VERSION_STATUS VS, CONTENT_INSTANCE CI "
26: + "WHERE "
27: +
28:
29: " CT.LEFT_NR > (SELECT LEFT_NR FROM CONTENT_TREE WHERE CONTENT_NODE_ID = <TK_CONTENT_NODE_ID>) AND "
30: + " CT.RIGHT_NR < (SELECT RIGHT_NR FROM CONTENT_TREE WHERE CONTENT_NODE_ID = <TK_CONTENT_NODE_ID>) AND "
31: +
32:
33: " CI.CONTENT_NODE_ID = CT.CONTENT_NODE_ID AND "
34: + " CV.INSTANCE_ID = CI.INSTANCE_ID AND "
35: + " C.CONTENT_ID = CV.CONTENT_ID AND "
36: + " CV.STATUS_ID = VS.STATUS_ID AND "
37: + " CT2.CONTENT_NODE_ID = CT.CONTENT_NODE_PARENT "
38: +
39:
40: " <TK_CASE:KENNUNG> AND "
41: + " CVALUE.CONTENT_ID = CV.CONTENT_ID "
42: + " <TK_IF:KENNUNG=0> "
43: + " AND (<TK_LIST:SEARCH_STRING>(CVALUE.VALUE LIKE <TK:SEARCH> "
44: + DBStringFactory.escape()
45: + " ) <TK:CONN> </TK_LIST>) "
46: + " </TK_IF:KENNUNG=0> "
47: + " <TK_IF:KENNUNG=1> "
48: + " AND "
49: + " ((<TK_LIST:SEARCH_STRING>(CT.CONTENT_NODE_NAME LIKE <TK:SEARCH> "
50: + DBStringFactory.escape()
51: + " ) <TK:CONN> </TK_LIST>) "
52: + " OR "
53: + " (<TK_LIST:SEARCH_STRING>(CT.CONTENT_NODE_SHORTNAME LIKE <TK:SEARCH> "
54: + DBStringFactory.escape() + " ) <TK:CONN> </TK_LIST>)) "
55: + " </TK_IF> " + " </TK_CASE> " +
56:
57: "ORDER BY "
58: + " CV.INSTANCE_ID, CV.CONTENT_ID, CV.VERSION_ID ";
59:
60: public static TKTemplateSyntax sqlTmplSyntax;
61:
62: public void initQuery(Connection con) {
63: try {
64: sqlTmplSyntax = new TKTemplateSyntax(sqlString, "");
65: } catch (com.teamkonzept.lib.TKTemplateSyntaxException e) {
66: sqlString = sqlString; // für JTest
67: }
68:
69: super.initQuery(con, paramTypes, setRelevants, sqlTmplSyntax);
70: }
71: }
|