01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/publishing/markups/db/TKMarkupParamCallTableData.java,v 1.7 2001/06/11 09:14:10 alex Exp $
03: *
04: */
05: package com.teamkonzept.publishing.markups.db;
06:
07: import java.sql.*;
08:
09: import com.teamkonzept.db.*;
10: import com.teamkonzept.lib.*;
11: import com.teamkonzept.publishing.markups.*;
12: import org.apache.log4j.Category;
13:
14: public class TKMarkupParamCallTableData extends TKDBTableData {
15: private static final Category cat = Category
16: .getInstance(TKMarkupParamCallTableData.class);
17:
18: public int markupId;
19: public int paramId;
20: public TKMarkupParamCall param;
21:
22: public TKMarkupParamCallTableData() {
23:
24: this .markupId = -1;
25: this .paramId = -1;
26: this .param = null;
27: }
28:
29: public TKMarkupParamCallTableData(int markupId,
30: TKMarkupParamCall param) {
31:
32: this .markupId = markupId;
33: this .paramId = param.param.id;
34: this .param = param;
35: }
36:
37: public TKMarkupParamCallTableData(ResultSet r) throws SQLException {
38:
39: try {
40: this .markupId = r.getInt("ATTRIBUTE_ID");
41: this .paramId = r.getInt("PARAMETER_ID");
42:
43: String name = r.getString("NAME");
44: boolean isOptional = r.getBoolean("IS_OPTIONAL");
45: boolean useDefault = r.getBoolean("USE_DEFAULT");
46: boolean editable = r.getBoolean("EDIT");
47: String defaultValue = r.getString("DEFAULT_VALUE");
48:
49: this .param = new TKMarkupParamCall(name, paramId,
50: isOptional, useDefault, editable, defaultValue);
51:
52: } catch (Exception ex) {
53: cat
54: .error(
55: "TKMarkupParamCallTableData.newCallFromResultSet() failed",
56: ex);
57: }
58: }
59:
60: public TKDBTableData newFromResultSet(ResultSet r)
61: throws SQLException {
62:
63: return new TKMarkupParamCallTableData(r);
64: }
65:
66: public void insertIntoQuery(TKQuery query) throws SQLException {
67:
68: query
69: .setQueryParams("ATTRIBUTE_ID", new Integer(
70: this .markupId));
71: query.setQueryParams("PARAMETER_ID", new Integer(this .paramId));
72:
73: query.setQueryParams("NAME", param.name);
74: query.setQueryParams("IS_OPTIONAL", new Integer(
75: param.isOptional ? 1 : 0));
76: query.setQueryParams("USE_DEFAULT", new Integer(
77: param.useDefault ? 1 : 0));
78: query.setQueryParams("EDIT",
79: new Integer(param.editable ? 1 : 0));
80: query.setQueryParams("DEFAULT_VALUE", param.defaultValue());
81: }
82:
83: public String toString() {
84:
85: return "(MARKUP_ID=" + markupId + ", PARAM_ID=" + paramId
86: + ", " + param + ")";
87: }
88: }
|