01: package com.salmonllc.sql;
02:
03: //** Copyright Statement ***************************************************
04: //The Salmon Open Framework for Internet Applications (SOFIA)
05: // Copyright (C) 1999 - 2002, Salmon LLC
06: //
07: // This program is free software; you can redistribute it and/or
08: // modify it under the terms of the GNU General Public License version 2
09: // as published by the Free Software Foundation;
10: //
11: // This program 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
14: // GNU General Public License for more details.
15: //
16: // You should have received a copy of the GNU General Public License
17: // along with this program; if not, write to the Free Software
18: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: //
20: // For more information please visit http://www.salmonllc.com
21: //** End Copyright Statement ***************************************************
22:
23: import java.util.Vector;
24:
25: /**
26: * @author Tyler Williams http://www.dataterrace.com
27: */
28: public class IntegrityMessage {
29: private boolean _integrityFlag = true;
30: // _violations will be null if _integrityFlag is true
31: private Vector _violations;
32:
33: /**
34: * Constructs a new empty integrity message.
35: */
36: public IntegrityMessage() {
37: }
38:
39: /**
40: * Constructs a new integrity message and adds a violation.
41: * @param tableName The name of the table that violated an integrity rule
42: * @param columnName The name of the column that violated an integrity rule
43: */
44: public IntegrityMessage(String tableName, String columnName) {
45: addViolation(tableName, columnName);
46: }
47:
48: /**
49: * Adds a a violation to an existing integrity message.
50: * @param tableName The name of the table that violated an integrity rule
51: * @param columnName The name of the column that violated an integrity rule
52: */
53: public void addViolation(String tableName, String columnName) {
54: if (_violations == null)
55: _violations = new Vector();
56: _integrityFlag = false;
57: _violations.add(new String[] { tableName, columnName });
58: }
59:
60: /**
61: * Returns true-good integrity, false-failed integrity check...violations available.
62: * @return boolean
63: */
64: public boolean getIntegrityFlag() {
65: return _integrityFlag;
66: }
67:
68: /**
69: * Returns vector of all rule violations.
70: * @return vector Each row in the vector contains a two string arrary (table name, column name)
71: */
72: public Vector getViolations() {
73: return _violations;
74: }
75: }
|