KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > field > db > TKContentDBData


1 package com.teamkonzept.field.db;
2
3 import com.teamkonzept.lib.*;
4 import com.teamkonzept.db.*;
5 import de.webman.util.legacy.Legacy;
6 import java.sql.*;
7
8 public class TKContentDBData extends TKDBVectorData {
9
10     public int version_id;
11     public int instance_id;
12     public int content_id;
13     public int status_id;
14
15     public String JavaDoc instance_name;
16     public String JavaDoc version_info;
17     public String JavaDoc version_author;
18
19     public TKVector content_node = new TKVector(); // of TKContentNodeTableData
20
public TKVector content_value = new TKVector(); // of TKContentValueTableData
21
public TKVector content_attribute = new TKVector(); // of TKContentAttributeTableData
22

23     public boolean ignore_content_node = false;
24     public boolean ignore_content_value = false;
25     public boolean ignore_content_attribute = false;
26
27     public TKContentDBData()
28     {
29         this (-1,-1);
30     }
31
32
33     public TKContentDBData(
34         int instance_id, String JavaDoc version_info, String JavaDoc version_author)
35     {
36         this (instance_id, -1);
37         this.version_info = version_info;
38         this.version_author = version_author;
39     }
40
41     public TKContentDBData(int instance_id, int version_id)
42     {
43         this.instance_id = instance_id;
44         this.version_id = version_id;
45
46         this.content_id = -1;
47         this.status_id = -1;
48
49         this.instance_name = null;;
50         this.version_info = null;;
51         this.version_author = null;;
52     }
53
54     public void insertPrimaryIntoQuery(TKQuery query)
55         throws SQLException
56     {
57         query.setQueryParams("INSTANCE_ID", new Integer JavaDoc(instance_id));
58         query.setQueryParams("VERSION_ID", new Integer JavaDoc(version_id));
59         query.setQueryParams("CONTENT_ID", new Integer JavaDoc(content_id));
60         query.setQueryParams("VERS_INFO", version_info);
61         query.setQueryParams("VERS_AUTHOR", version_author);
62         query.setQueryParams("STATUS_ID", new Integer JavaDoc(status_id));
63     }
64
65     public void insertInitialIntoQuery(TKQuery query)
66         throws SQLException
67     {
68         query.setQueryParams("INSTANCE_ID", new Integer JavaDoc(instance_id));
69         query.setQueryParams("VERSION_ID", new Integer JavaDoc(version_id));
70         query.setQueryParams("CONTENT_ID", new Integer JavaDoc(content_id));
71         query.setQueryParams("VERS_INFO", version_info);
72         query.setQueryParams("VERS_AUTHOR", version_author);
73         query.setQueryParams("STATUS_ID", new Integer JavaDoc(status_id));
74     }
75
76     public void insertIntoQuery(TKQuery query)
77         throws SQLException
78     {
79         insertPrimaryIntoQuery(query);
80         insertInitialIntoQuery(query);
81     }
82
83     public void fill(ResultSet r)
84         throws SQLException
85     {
86         this.version_id = r.getInt("VERSION_ID");
87         this.content_id = r.getInt("CONTENT_ID");
88         this.instance_id = r.getInt("INSTANCE_ID");
89         this.instance_name = r.getString("NAME");
90         this.version_info = r.getString("INFO");
91         this.version_author = r.getString("AUTHOR");
92     }
93
94     public TKVector getVector(String JavaDoc table)
95     {
96         if( table.equals("CONTENT_VALUE") ) {
97             return content_value;
98         }
99         else if ( table.equals("CONTENT_NODE") ) {
100             return content_node;
101         }
102         else if ( table.equals("CONTENT_ATTRIBUTE") ) {
103             return content_attribute;
104         }
105         return null;
106     }
107
108     public boolean isIgnoreTable (String JavaDoc table) {
109
110         if( table.equals("CONTENT_VALUE") ) {
111             return ignore_content_value;
112         }
113         else if ( table.equals("CONTENT_NODE") ) {
114             return ignore_content_node;
115         }
116         else if ( table.equals("CONTENT_ATTRIBUTE") ) {
117             return ignore_content_attribute;
118         }
119
120         return false;
121     }
122
123     public void setIgnoreTable (String JavaDoc table, boolean ignore) {
124
125         if( table.equals("CONTENT_VALUE") ) {
126             ignore_content_value = ignore;
127         }
128         else if ( table.equals("CONTENT_NODE") ) {
129             ignore_content_node = ignore;
130         }
131         else if ( table.equals("CONTENT_ATTRIBUTE") ) {
132             ignore_content_attribute = ignore;
133         }
134     }
135
136     public TKDBTableData getProtoType(String JavaDoc table)
137     {
138         if( table.equals("CONTENT_VALUE") ) {
139             return new TKContentValueTableData();
140         }
141         else if ( table.equals("CONTENT_NODE") ) {
142             return new TKContentNodeTableData();
143         }
144         else if ( table.equals("CONTENT_ATTRIBUTE") ) {
145             return new TKContentAttributeTableData();
146         }
147         return null;
148     }
149
150
151     public String JavaDoc toString()
152     {
153         return "( CONTENT := "
154                 + "(CONTENT_ID = " + String.valueOf( content_id )
155                 + ", VERSION_ID = " + String.valueOf( version_id )
156                 + ", INSTANCE_ID = " + String.valueOf( instance_id )
157                 + ", INST_NAME = " + instance_name
158                 + ", VERS_INFO = " + version_info
159                 + ", VERS_AUTHOR = " + version_author
160                 + "),<BR>"
161             + ",<BR>CONTENT_NODE := " + content_node.toString()
162             + ",<BR>CONTENT_VALUE := " + content_value.toString()
163             + ")<BR>";
164     }
165 }
166
Popular Tags