001: package com.teamkonzept.field.db;
002:
003: import com.teamkonzept.lib.*;
004: import com.teamkonzept.db.*;
005: import de.webman.util.legacy.Legacy;
006: import java.sql.*;
007:
008: public class TKContentDBData extends TKDBVectorData {
009:
010: public int version_id;
011: public int instance_id;
012: public int content_id;
013: public int status_id;
014:
015: public String instance_name;
016: public String version_info;
017: public String version_author;
018:
019: public TKVector content_node = new TKVector(); // of TKContentNodeTableData
020: public TKVector content_value = new TKVector(); // of TKContentValueTableData
021: public TKVector content_attribute = new TKVector(); // of TKContentAttributeTableData
022:
023: public boolean ignore_content_node = false;
024: public boolean ignore_content_value = false;
025: public boolean ignore_content_attribute = false;
026:
027: public TKContentDBData() {
028: this (-1, -1);
029: }
030:
031: public TKContentDBData(int instance_id, String version_info,
032: String version_author) {
033: this (instance_id, -1);
034: this .version_info = version_info;
035: this .version_author = version_author;
036: }
037:
038: public TKContentDBData(int instance_id, int version_id) {
039: this .instance_id = instance_id;
040: this .version_id = version_id;
041:
042: this .content_id = -1;
043: this .status_id = -1;
044:
045: this .instance_name = null;
046: ;
047: this .version_info = null;
048: ;
049: this .version_author = null;
050: ;
051: }
052:
053: public void insertPrimaryIntoQuery(TKQuery query)
054: throws SQLException {
055: query.setQueryParams("INSTANCE_ID", new Integer(instance_id));
056: query.setQueryParams("VERSION_ID", new Integer(version_id));
057: query.setQueryParams("CONTENT_ID", new Integer(content_id));
058: query.setQueryParams("VERS_INFO", version_info);
059: query.setQueryParams("VERS_AUTHOR", version_author);
060: query.setQueryParams("STATUS_ID", new Integer(status_id));
061: }
062:
063: public void insertInitialIntoQuery(TKQuery query)
064: throws SQLException {
065: query.setQueryParams("INSTANCE_ID", new Integer(instance_id));
066: query.setQueryParams("VERSION_ID", new Integer(version_id));
067: query.setQueryParams("CONTENT_ID", new Integer(content_id));
068: query.setQueryParams("VERS_INFO", version_info);
069: query.setQueryParams("VERS_AUTHOR", version_author);
070: query.setQueryParams("STATUS_ID", new Integer(status_id));
071: }
072:
073: public void insertIntoQuery(TKQuery query) throws SQLException {
074: insertPrimaryIntoQuery(query);
075: insertInitialIntoQuery(query);
076: }
077:
078: public void fill(ResultSet r) throws SQLException {
079: this .version_id = r.getInt("VERSION_ID");
080: this .content_id = r.getInt("CONTENT_ID");
081: this .instance_id = r.getInt("INSTANCE_ID");
082: this .instance_name = r.getString("NAME");
083: this .version_info = r.getString("INFO");
084: this .version_author = r.getString("AUTHOR");
085: }
086:
087: public TKVector getVector(String table) {
088: if (table.equals("CONTENT_VALUE")) {
089: return content_value;
090: } else if (table.equals("CONTENT_NODE")) {
091: return content_node;
092: } else if (table.equals("CONTENT_ATTRIBUTE")) {
093: return content_attribute;
094: }
095: return null;
096: }
097:
098: public boolean isIgnoreTable(String table) {
099:
100: if (table.equals("CONTENT_VALUE")) {
101: return ignore_content_value;
102: } else if (table.equals("CONTENT_NODE")) {
103: return ignore_content_node;
104: } else if (table.equals("CONTENT_ATTRIBUTE")) {
105: return ignore_content_attribute;
106: }
107:
108: return false;
109: }
110:
111: public void setIgnoreTable(String table, boolean ignore) {
112:
113: if (table.equals("CONTENT_VALUE")) {
114: ignore_content_value = ignore;
115: } else if (table.equals("CONTENT_NODE")) {
116: ignore_content_node = ignore;
117: } else if (table.equals("CONTENT_ATTRIBUTE")) {
118: ignore_content_attribute = ignore;
119: }
120: }
121:
122: public TKDBTableData getProtoType(String table) {
123: if (table.equals("CONTENT_VALUE")) {
124: return new TKContentValueTableData();
125: } else if (table.equals("CONTENT_NODE")) {
126: return new TKContentNodeTableData();
127: } else if (table.equals("CONTENT_ATTRIBUTE")) {
128: return new TKContentAttributeTableData();
129: }
130: return null;
131: }
132:
133: public String toString() {
134: return "( CONTENT := " + "(CONTENT_ID = "
135: + String.valueOf(content_id) + ", VERSION_ID = "
136: + String.valueOf(version_id) + ", INSTANCE_ID = "
137: + String.valueOf(instance_id) + ", INST_NAME = "
138: + instance_name + ", VERS_INFO = " + version_info
139: + ", VERS_AUTHOR = " + version_author + "),<BR>"
140: + ",<BR>CONTENT_NODE := " + content_node.toString()
141: + ",<BR>CONTENT_VALUE := " + content_value.toString()
142: + ")<BR>";
143: }
144: }
|