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: /**
24: * Indicates a referential integrity problem has occured with the database.
25: * Either a required row is missing in a parent table (foreign key) during an
26: * attempted row insert or update OR a table has rows where the primary key is
27: * still being used in child tables during an attempted row deletion.
28: * @author Tyler Williams http://www.dataterrace.com
29: */
30: public class IntegrityException extends DataStoreException {
31:
32: private IntegrityMessage _integrityMessage = null;
33: private int _row = -1;
34:
35: /**
36: * Constructs an Exception with no specified detail message.
37: */
38: public IntegrityException() {
39: super ();
40: }
41:
42: /**
43: * Constructs an Exception with the specified detail message.
44: * @param msg the detail message.
45: */
46: public IntegrityException(String msg) {
47: super (msg);
48: }
49:
50: /**
51: * Constructs an Exception with an IntegrityMessage containing details.
52: * @param im The IntegrityMessage that contains details of the error.
53: */
54: public IntegrityException(IntegrityMessage im) {
55: _integrityMessage = im;
56: }
57:
58: /**
59: * Constructs an Exception with the specified detail message.
60: * @param msg the detail message.
61: * @param im The IntegrityMessage that contains details of the error.
62: */
63: public IntegrityException(String msg, IntegrityMessage im) {
64: this (msg);
65: _integrityMessage = im;
66: }
67:
68: /**
69: * Constructs an Exception with the specified detail message.
70: * @param msg the detail message.
71: * @param im The IntegrityMessage that contains details of the error.
72: * @param row The dataStore row number that caused the error.
73: */
74: public IntegrityException(String msg, IntegrityMessage im, int row) {
75: this (msg);
76: _integrityMessage = im;
77: _row = row;
78: }
79:
80: /**
81: * Returns the IntegrityMessage that excapsulates cause of the error.
82: * @return IntegrityMessage
83: */
84: public IntegrityMessage getIntegrityMessage() {
85: return _integrityMessage;
86: }
87:
88: /**
89: * Returns the DataStore's row number that caused the error.
90: * @return int
91: */
92: public int getRow() {
93: return _row;
94: }
95:
96: } // end of class
|