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