01: package com.teamkonzept.webman.refsel;
02:
03: import java.sql.*;
04:
05: import com.teamkonzept.db.*;
06: import com.teamkonzept.lib.*;
07: import com.teamkonzept.webman.refsel.db.queries.*;
08:
09: public class TKWMGrandMotherRS extends TKWMAllNodesSelector {
10:
11: public boolean checkSelection() {
12: return false;
13: }
14:
15: public String getSelectionData(TKHashtable params) {
16: return "";
17: }
18:
19: public TKVector getSelectionNodes(String selectionData,
20: int siteNodeId) throws SQLException {
21: TKVector nodes = new TKVector();
22: int grandMotherNodeId;
23: TKQuery query;
24: ResultSet rs;
25:
26: // Hole den Mutterknoten
27: query = TKDBManager.newQuery(TKWMDBGrandMotherNode.class);
28: query.setQueryParams("SITE_NODE_ID", new Integer(siteNodeId));
29: query.execute();
30: rs = query.fetchResultSet();
31:
32: if (rs != null) {
33: if (rs.next()) {
34: grandMotherNodeId = rs.getInt("SITE_NODE_PARENT");
35: } else {
36: return nodes;
37: }
38: } else {
39: return nodes;
40: }
41:
42: // Mit dem Mutterknoten hole die SisterKnoten
43: query = TKDBManager.newQuery(TKWMDBSisterNodes.class);
44: query.setQueryParams("SITE_NODE_ID", new Integer(
45: grandMotherNodeId));
46: query.execute();
47: rs = query.fetchResultSet();
48:
49: if (rs != null) {
50: while (rs.next()) {
51: nodes
52: .addElement(new Integer(rs
53: .getInt("SITE_NODE_ID")));
54: }
55: }
56: return nodes;
57: }
58:
59: public TKDBResult getSelectionValues(String selectionData,
60: int siteNodeId) throws SQLException {
61: TKDBResult values = null;
62: int grandMotherNodeId = 0;
63: TKQuery query;
64: ResultSet rs;
65: // Hole den Mutterknoten
66: query = TKDBManager.newQuery(TKWMDBGrandMotherNode.class);
67: query.setQueryParams("SITE_NODE_ID", new Integer(siteNodeId));
68: query.execute();
69: rs = query.fetchResultSet();
70:
71: if (rs != null) {
72: if (rs.next()) {
73: grandMotherNodeId = rs.getInt("SITE_NODE_PARENT");
74: } else {
75: ;// return new TKDBResult(rs);
76: }
77: } else {
78: return values;
79: }
80:
81: query = TKDBManager.newQuery(TKWMDBRSSisters.class);
82: query.setQueryParams("SITE_NODE_ID", new Integer(
83: grandMotherNodeId));
84: query.execute();
85: rs = query.fetchResultSet();
86:
87: if (rs != null) {
88: values = new TKDBResult(rs);
89: }
90: return values;
91:
92: }
93:
94: }
|