01: package net.sourceforge.squirrel_sql.plugins.mssql.sql.constraint;
02:
03: /*
04: * Copyright (C) 2004 Ryan Walberg <generalpf@yahoo.com>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20:
21: import java.util.ArrayList;
22:
23: public class MssqlConstraint {
24:
25: /**
26: * Holds value of property constraintName.
27: */
28: private String _constraintName;
29: private ArrayList<String> _constraintColumns;
30:
31: /** Creates a new instance of MssqlConstraint */
32: public MssqlConstraint() {
33: _constraintColumns = new ArrayList<String>();
34: }
35:
36: /**
37: * Getter for property constraintName.
38: * @return Value of property constraintName.
39: */
40: public String getConstraintName() {
41: return this ._constraintName;
42: }
43:
44: /**
45: * Setter for property constraintName.
46: * @param constraintName New value of property constraintName.
47: */
48: public void setConstraintName(String constraintName) {
49: this ._constraintName = constraintName;
50: }
51:
52: public void addConstraintColumn(String columnName) {
53: _constraintColumns.add(columnName);
54: }
55:
56: public Object[] getConstraintColumns() {
57: return _constraintColumns.toArray();
58: }
59:
60: public boolean constrainsColumn(String columnName) {
61: for (int i = 0; i < _constraintColumns.size(); i++)
62: if (columnName.equals(_constraintColumns.get(i)))
63: return true;
64: return false;
65: }
66:
67: }
|