01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc.sql.diff;
12:
13: import com.versant.core.jdbc.metadata.JdbcColumn;
14: import com.versant.core.jdbc.metadata.JdbcConstraint;
15:
16: import java.util.ArrayList;
17:
18: /**
19: * @keep-all
20: */
21: public class PKDiff {
22: boolean extraPKCol = false;
23: boolean missingPKCol = false;
24: boolean missingPK = false;
25: private JdbcColumn ourCol;
26: private JdbcColumn dbCol;
27: private ArrayList dropConstraintsRefs = new ArrayList();
28: private ArrayList addConstraintsRefs = new ArrayList();
29:
30: public PKDiff(JdbcColumn ourCol, JdbcColumn dbCol) {
31: this .ourCol = ourCol;
32: this .dbCol = dbCol;
33: }
34:
35: public boolean isExtraPKCol() {
36: return extraPKCol;
37: }
38:
39: public void setExtraPKCol(boolean extraPK) {
40: this .extraPKCol = extraPK;
41: }
42:
43: public boolean isMissingPKCol() {
44: return missingPKCol;
45: }
46:
47: public void setMissingPKCol(boolean missingPK) {
48: this .missingPKCol = missingPK;
49: }
50:
51: public boolean isMissingPK() {
52: return missingPK;
53: }
54:
55: public void setMissingPK(boolean missingPK) {
56: this .missingPK = missingPK;
57: }
58:
59: public JdbcColumn getOurCol() {
60: return ourCol;
61: }
62:
63: public JdbcColumn getDbCol() {
64: return dbCol;
65: }
66:
67: public ArrayList getDropConstraintsRefs() {
68: return dropConstraintsRefs;
69: }
70:
71: public void setDropConstraintsRefs(JdbcConstraint constraint) {
72: this .dropConstraintsRefs.add(constraint);
73: }
74:
75: public ArrayList getAddConstraintsRefs() {
76: return addConstraintsRefs;
77: }
78:
79: public void setAddConstraintsRefs(JdbcConstraint constraint) {
80: this .addConstraintsRefs.add(constraint);
81: }
82:
83: public boolean hasErrors() {
84: if (missingPK || extraPKCol || missingPKCol) {
85: return true;
86: } else {
87: return false;
88: }
89: }
90:
91: }
|