001: /* Copyright (C) 2003 Finalist IT Group
002: *
003: * This file is part of JAG - the Java J2EE Application Generator
004: *
005: * JAG is free software; you can redistribute it and/or modify
006: * it under the terms of the GNU General Public License as published by
007: * the Free Software Foundation; either version 2 of the License, or
008: * (at your option) any later version.
009: * JAG is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: * You should have received a copy of the GNU General Public License
014: * along with JAG; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
016: */
017:
018: package com.finalist.jaggenerator;
019:
020: import java.io.Serializable;
021:
022: /**
023: * This class is a bean that represents information concerning a foreign key column in a database table.
024: * For further javadoc concerning the fields of this bean,
025: * please see {@link java.sql.DatabaseMetaData#getImportedKeys(String, String, String)}.
026: *
027: * @author Michael O'Connor - Finalist IT Group
028: */
029: public class ForeignKey implements Serializable {
030:
031: private String pkTableCat;
032: private String pkTableSchem;
033: private String pkTableName;
034: private String pkColumnName;
035: private String fkTableCat;
036: private String fkTableSchem;
037: private String fkTableName;
038: private String fkColumnName;
039: private short keySeq;
040: private short updateRule;
041: private short deleteRule;
042: private String fkName;
043: private String pkName;
044: private short deferrability;
045:
046: public String getPkTableCat() {
047: return pkTableCat;
048: }
049:
050: public void setPkTableCat(String pkTableCat) {
051: this .pkTableCat = pkTableCat;
052: }
053:
054: public String getPkTableSchem() {
055: return pkTableSchem;
056: }
057:
058: public void setPkTableSchem(String pkTableSchem) {
059: this .pkTableSchem = pkTableSchem;
060: }
061:
062: public String getPkTableName() {
063: return pkTableName;
064: }
065:
066: public void setPkTableName(String pkTableName) {
067: this .pkTableName = pkTableName;
068: }
069:
070: public String getPkColumnName() {
071: return pkColumnName;
072: }
073:
074: public void setPkColumnName(String pkColumnName) {
075: this .pkColumnName = pkColumnName;
076: }
077:
078: public String getFkTableCat() {
079: return fkTableCat;
080: }
081:
082: public void setFkTableCat(String fkTableCat) {
083: this .fkTableCat = fkTableCat;
084: }
085:
086: public String getFkTableSchem() {
087: return fkTableSchem;
088: }
089:
090: public void setFkTableSchem(String fkTableSchem) {
091: this .fkTableSchem = fkTableSchem;
092: }
093:
094: public String getFkTableName() {
095: return fkTableName;
096: }
097:
098: public void setFkTableName(String fkTableName) {
099: this .fkTableName = fkTableName;
100: }
101:
102: public String getFkColumnName() {
103: return fkColumnName;
104: }
105:
106: public void setFkColumnName(String fkColumnName) {
107: this .fkColumnName = fkColumnName;
108: }
109:
110: public short getKeySeq() {
111: return keySeq;
112: }
113:
114: public void setKeySeq(short keySeq) {
115: this .keySeq = keySeq;
116: }
117:
118: public short getUpdateRule() {
119: return updateRule;
120: }
121:
122: public void setUpdateRule(short updateRule) {
123: this .updateRule = updateRule;
124: }
125:
126: public short getDeleteRule() {
127: return deleteRule;
128: }
129:
130: public void setDeleteRule(short deleteRule) {
131: this .deleteRule = deleteRule;
132: }
133:
134: public String getFkName() {
135: return fkName;
136: }
137:
138: public void setFkName(String fkName) {
139: this .fkName = fkName;
140: }
141:
142: public String getPkName() {
143: return pkName;
144: }
145:
146: public void setPkName(String pkName) {
147: this .pkName = pkName;
148: }
149:
150: public short getDeferrability() {
151: return deferrability;
152: }
153:
154: public void setDeferrability(short deferrability) {
155: this .deferrability = deferrability;
156: }
157:
158: public boolean equals(Object o) {
159: if (this == o)
160: return true;
161: if (!(o instanceof ForeignKey))
162: return false;
163:
164: final ForeignKey foreignKey = (ForeignKey) o;
165:
166: if (deferrability != foreignKey.deferrability)
167: return false;
168: if (deleteRule != foreignKey.deleteRule)
169: return false;
170: if (keySeq != foreignKey.keySeq)
171: return false;
172: if (updateRule != foreignKey.updateRule)
173: return false;
174: if (fkName != null ? !fkName.equals(foreignKey.fkName)
175: : foreignKey.fkName != null)
176: return false;
177: if (!fkColumnName.equals(foreignKey.fkColumnName))
178: return false;
179: if (fkTableCat != null ? !fkTableCat
180: .equals(foreignKey.fkTableCat)
181: : foreignKey.fkTableCat != null)
182: return false;
183: if (!fkTableName.equals(foreignKey.fkTableName))
184: return false;
185: if (fkTableSchem != null ? !fkTableSchem
186: .equals(foreignKey.fkTableSchem)
187: : foreignKey.fkTableSchem != null)
188: return false;
189: if (pkName != null ? !pkName.equals(foreignKey.pkName)
190: : foreignKey.pkName != null)
191: return false;
192: if (!pkColumnName.equals(foreignKey.pkColumnName))
193: return false;
194: if (pkTableCat != null ? !pkTableCat
195: .equals(foreignKey.pkTableCat)
196: : foreignKey.pkTableCat != null)
197: return false;
198: if (!pkTableName.equals(foreignKey.pkTableName))
199: return false;
200: if (pkTableSchem != null ? !pkTableSchem
201: .equals(foreignKey.pkTableSchem)
202: : foreignKey.pkTableSchem != null)
203: return false;
204:
205: return true;
206: }
207:
208: public int hashCode() {
209: int result;
210: result = (pkTableCat != null ? pkTableCat.hashCode() : 0);
211: result = 29 * result
212: + (pkTableSchem != null ? pkTableSchem.hashCode() : 0);
213: result = 29 * result + pkTableName.hashCode();
214: result = 29 * result + pkColumnName.hashCode();
215: result = 29 * result
216: + (fkTableCat != null ? fkTableCat.hashCode() : 0);
217: result = 29 * result
218: + (fkTableSchem != null ? fkTableSchem.hashCode() : 0);
219: result = 29 * result + fkTableName.hashCode();
220: result = 29 * result + fkColumnName.hashCode();
221: result = 29 * result + (int) keySeq;
222: result = 29 * result + (int) updateRule;
223: result = 29 * result + (int) deleteRule;
224: result = 29 * result + (fkName != null ? fkName.hashCode() : 0);
225: result = 29 * result + (pkName != null ? pkName.hashCode() : 0);
226: result = 29 * result + (int) deferrability;
227: return result;
228: }
229:
230: public String toString() {
231: return "ForeignKey[" + "pkTableCat=" + pkTableCat
232: + ", pkTableSchem=" + pkTableSchem + ", pkTableName="
233: + pkTableName + ", pkColumnName=" + pkColumnName
234: + ", fkTableCat=" + fkTableCat + ", fkTableSchem="
235: + fkTableSchem + ", fkTableName=" + fkTableName
236: + ", fkTableName=" + fkTableName + ", keySeq=" + keySeq
237: + ", updateRule=" + updateRule + ", deleteRule="
238: + deleteRule + ", fkName=" + fkName + ", pkName="
239: + pkName + ", deferrability=" + deferrability + ']';
240:
241: }
242: }
|