01: package com.teamkonzept.field.db;
02:
03: import com.teamkonzept.db.*;
04: import java.sql.*;
05:
06: public class TKContentNodeTableData extends TKDBTableData {
07: public int content_id;
08: public int content_node_id;
09: public int left_nr;
10: public int right_nr;
11: public String name;
12:
13: public TKContentNodeTableData() {
14: }
15:
16: public TKContentNodeTableData(int content_id, int content_node_id,
17: int left_nr, int right_nr, String name) {
18: this .content_id = content_id;
19: this .content_node_id = content_node_id;
20: this .left_nr = left_nr;
21: this .right_nr = right_nr;
22: this .name = name;
23: }
24:
25: public TKContentNodeTableData(ResultSet r) throws SQLException {
26: this .content_id = r.getInt("CONTENT_ID");
27: this .content_node_id = r.getInt("CONTENT_NODE_ID");
28: this .left_nr = r.getInt("LEFT_NR");
29: this .right_nr = r.getInt("RIGHT_NR");
30: this .name = r.getString("NAME");
31: if (name.equals(QueryConstants.EMPTY_STRING_VALUE)) {
32: name = "";
33: }
34: }
35:
36: public void updatePrimary(TKDBVectorData dbData) {
37:
38: TKContentDBData cdata = (TKContentDBData) dbData;
39: content_id = cdata.content_id;
40: }
41:
42: public TKDBTableData newFromResultSet(ResultSet r)
43: throws SQLException {
44: return new TKContentNodeTableData(r);
45: }
46:
47: public void insertIntoQuery(TKQuery query) throws SQLException {
48: query.setQueryParams("CONTENT_ID", new Integer(content_id));
49: query.setQueryParams("CONTENT_NODE_ID", new Integer(
50: content_node_id));
51: query.setQueryParams("LEFT_NR", new Integer(left_nr));
52: query.setQueryParams("RIGHT_NR", new Integer(right_nr));
53: if (name == null || name.length() == 0) {
54: name = QueryConstants.EMPTY_STRING_VALUE;
55: }
56: query.setQueryParams("NAME", name);
57: }
58:
59: public String toString() {
60: return "( CONTENT_ID=" + String.valueOf(content_id)
61: + ", CONTENT_NODE_ID="
62: + String.valueOf(content_node_id) + ", LEFT_NR="
63: + String.valueOf(left_nr) + ", RIGHT_NR="
64: + String.valueOf(right_nr) + ", NAME=" + name + ")<BR>";
65: }
66: }
|