001: /*
002: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
007: *
008: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
009: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
010: * the license for the specific language governing your rights and limitations.
011: *
012: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
013: */
014: package org.pentaho.reportdesigner.crm.report.datasetplugin.composer;
015:
016: import org.jetbrains.annotations.NotNull;
017: import org.jetbrains.annotations.Nullable;
018:
019: import java.util.ArrayList;
020: import java.util.LinkedHashMap;
021:
022: /**
023: * User: Martin
024: * Date: 06.03.2006
025: * Time: 08:13:01
026: */
027: public class JDBCTableInfo {
028: @Nullable
029: private String catalog;
030: @Nullable
031: private String schema;
032: @NotNull
033: private String tableName;
034: @Nullable
035: private String type;
036: @Nullable
037: private String remarks;
038: @Nullable
039: private String typesCatalog;
040: @Nullable
041: private String typesSchema;
042: @Nullable
043: private String typeName;
044: @Nullable
045: private String selfReferencingColumnName;
046: @Nullable
047: private String refGeneration;
048: @Nullable
049: private LinkedHashMap<String, JDBCColumnInfo> columnInfos;
050:
051: public JDBCTableInfo() {
052: tableName = "";
053: }
054:
055: public JDBCTableInfo(@NotNull
056: String catalog, @NotNull
057: String schema, @NotNull
058: String name, @NotNull
059: String type, @NotNull
060: String remarks, @NotNull
061: String typesCatalog, @NotNull
062: String typesSchema, @NotNull
063: String typeName, @NotNull
064: String selfReferencingColumnName, @NotNull
065: String refGeneration, @NotNull
066: ArrayList<JDBCColumnInfo> columnInfos) {
067: this .catalog = catalog;
068: this .schema = schema;
069: this .tableName = name;
070: this .type = type;
071: this .remarks = remarks;
072: this .typesCatalog = typesCatalog;
073: this .typesSchema = typesSchema;
074: this .typeName = typeName;
075: this .selfReferencingColumnName = selfReferencingColumnName;
076: this .refGeneration = refGeneration;
077:
078: this .columnInfos = new LinkedHashMap<String, JDBCColumnInfo>();
079: for (JDBCColumnInfo jdbcColumnInfo : columnInfos) {
080: String columnName = jdbcColumnInfo.getColumnName();
081: if (this .columnInfos != null) {
082: this .columnInfos.put(columnName, jdbcColumnInfo);
083: }
084: }
085: }
086:
087: public void setCatalog(@NotNull
088: String catalog) {
089: this .catalog = catalog;
090: }
091:
092: public void setSchema(@NotNull
093: String schema) {
094: this .schema = schema;
095: }
096:
097: public void setTableName(@NotNull
098: String tableName) {
099: this .tableName = tableName;
100: }
101:
102: public void setType(@NotNull
103: String type) {
104: this .type = type;
105: }
106:
107: public void setRemarks(@NotNull
108: String remarks) {
109: this .remarks = remarks;
110: }
111:
112: public void setTypesCatalog(@NotNull
113: String typesCatalog) {
114: this .typesCatalog = typesCatalog;
115: }
116:
117: public void setTypesSchema(@NotNull
118: String typesSchema) {
119: this .typesSchema = typesSchema;
120: }
121:
122: public void setTypeName(@NotNull
123: String typeName) {
124: this .typeName = typeName;
125: }
126:
127: public void setSelfReferencingColumnName(@NotNull
128: String selfReferencingColumnName) {
129: this .selfReferencingColumnName = selfReferencingColumnName;
130: }
131:
132: public void setRefGeneration(@NotNull
133: String refGeneration) {
134: this .refGeneration = refGeneration;
135: }
136:
137: public void setColumnInfos(@NotNull
138: ArrayList<JDBCColumnInfo> columnInfos) {
139: this .columnInfos = new LinkedHashMap<String, JDBCColumnInfo>();
140: for (JDBCColumnInfo jdbcColumnInfo : columnInfos) {
141: String columnName = jdbcColumnInfo.getColumnName();
142: if (this .columnInfos != null) {
143: this .columnInfos.put(columnName, jdbcColumnInfo);
144: }
145: }
146: }
147:
148: @Nullable
149: public LinkedHashMap<String, JDBCColumnInfo> getColumnInfos() {
150: return columnInfos;
151: }
152:
153: @Nullable
154: public String getCatalog() {
155: return catalog;
156: }
157:
158: @Nullable
159: public String getSchema() {
160: return schema;
161: }
162:
163: @NotNull
164: public String getTableName() {
165: return tableName;
166: }
167:
168: @Nullable
169: public String getType() {
170: return type;
171: }
172:
173: @Nullable
174: public String getRemarks() {
175: return remarks;
176: }
177:
178: @Nullable
179: public String getTypesCatalog() {
180: return typesCatalog;
181: }
182:
183: @Nullable
184: public String getTypesSchema() {
185: return typesSchema;
186: }
187:
188: @Nullable
189: public String getTypeName() {
190: return typeName;
191: }
192:
193: @Nullable
194: public String getSelfReferencingColumnName() {
195: return selfReferencingColumnName;
196: }
197:
198: @Nullable
199: public String getRefGeneration() {
200: return refGeneration;
201: }
202:
203: public boolean equals(@Nullable
204: Object o) {
205: if (this == o)
206: return true;
207: if (o == null || getClass() != o.getClass())
208: return false;
209:
210: final JDBCTableInfo that = (JDBCTableInfo) o;
211:
212: if (catalog != null ? !catalog.equals(that.catalog)
213: : that.catalog != null)
214: return false;
215: if (!tableName.equals(that.tableName))
216: return false;
217: if (refGeneration != null ? !refGeneration
218: .equals(that.refGeneration)
219: : that.refGeneration != null)
220: return false;
221: if (remarks != null ? !remarks.equals(that.remarks)
222: : that.remarks != null)
223: return false;
224: if (schema != null ? !schema.equals(that.schema)
225: : that.schema != null)
226: return false;
227: if (selfReferencingColumnName != null ? !selfReferencingColumnName
228: .equals(that.selfReferencingColumnName)
229: : that.selfReferencingColumnName != null)
230: return false;
231: if (type != null ? !type.equals(that.type) : that.type != null)
232: return false;
233: if (typeName != null ? !typeName.equals(that.typeName)
234: : that.typeName != null)
235: return false;
236: if (typesCatalog != null ? !typesCatalog
237: .equals(that.typesCatalog) : that.typesCatalog != null)
238: return false;
239: return !(typesSchema != null ? !typesSchema
240: .equals(that.typesSchema) : that.typesSchema != null);
241:
242: }
243:
244: public int hashCode() {
245: int result;
246: result = (catalog != null ? catalog.hashCode() : 0);
247: result = 29 * result + (schema != null ? schema.hashCode() : 0);
248: result = 29 * result + tableName.hashCode();
249: result = 29 * result + (type != null ? type.hashCode() : 0);
250: result = 29 * result
251: + (remarks != null ? remarks.hashCode() : 0);
252: result = 29 * result
253: + (typesCatalog != null ? typesCatalog.hashCode() : 0);
254: result = 29 * result
255: + (typesSchema != null ? typesSchema.hashCode() : 0);
256: result = 29 * result
257: + (typeName != null ? typeName.hashCode() : 0);
258: result = 29
259: * result
260: + (selfReferencingColumnName != null ? selfReferencingColumnName
261: .hashCode()
262: : 0);
263: result = 29
264: * result
265: + (refGeneration != null ? refGeneration.hashCode() : 0);
266: return result;
267: }
268:
269: @NotNull
270: public String toString() {
271: return "JDBCTableInfo{" + "catalog='" + catalog + "'"
272: + ", schema='" + schema + "'" + ", tableName='"
273: + tableName + "'" + ", type='" + type + "'"
274: + ", remarks='" + remarks + "'" + ", typesCatalog='"
275: + typesCatalog + "'" + ", typesSchema='" + typesSchema
276: + "'" + ", typeName='" + typeName + "'"
277: + ", selfReferencingColumnName='"
278: + selfReferencingColumnName + "'" + ", refGeneration='"
279: + refGeneration + "'" + ", columnInfos=" + columnInfos
280: + "}";
281: }
282: }
|