KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > serversystem > dmlvalidation > constraintsystem > PrimaryConstraintException


1 package com.daffodilwoods.daffodildb.server.serversystem.dmlvalidation.constraintsystem;
2
3 import com.daffodilwoods.daffodildb.server.datasystem.utility._Record;
4 import com.daffodilwoods.database.general.*;
5 import com.daffodilwoods.database.resource.*;
6 /**
7  *
8  * <p>Title: PrimaryConstraintException </p>
9  * <p>Description: </p>
10 * <p>Description: Primary constraint Exception has a super class DException, which helps in
11  * throwing a exception corresponding to sqlCode and the paramaters passed.</p>
12  */

13
14 public class PrimaryConstraintException extends DException {
15
16    private DException prevException;
17    QualifiedIdentifier table ;
18    String JavaDoc[] primaryColumns;
19    transient _Record record ;
20
21    /**
22     * constructs an instance of primary constraint exception with the following arguments.
23     * @param sqlCode code of the exception in sql statement
24     * @param parameters parameters that are passed to the exception.
25     * @param temp previous exception
26     */

27    public PrimaryConstraintException(String JavaDoc sqlCode, Object JavaDoc[] parameters, DException temp) {
28       super(sqlCode, parameters);
29       this.prevException = temp;
30    }
31
32    /**
33     * set the name of the table
34     * @param tableName name of the table
35     */

36
37    public void setCorrespondingTable( QualifiedIdentifier tableName ) {
38         table = tableName;
39    }
40
41    /**
42     * retreives the name of table
43     * @return QualifiedIdentifier name of the table.
44     */

45
46    public QualifiedIdentifier getTable() {
47         return table ;
48    }
49
50    /**
51     * sets the primary columns in array of String
52     * @param columns columns on which primary constraint is applied.
53     */

54
55    public void setPrimaryColumns( String JavaDoc[] columns ) {
56         primaryColumns = columns ;
57    }
58
59
60    /**
61     * returns the array of strings containing primary columns.
62     * @return String[] array of columns retreived by the method.
63     */

64
65    public String JavaDoc[] getPrimaryColumns () {
66         return primaryColumns ;
67    }
68
69    /**
70     * sets the value of Record.
71     * @param record record that has been set.
72     */

73
74    public void setRecord( _Record record ) {
75         this.record = record ;
76    }
77
78    /**
79     * retuns a Record
80     * @return Record record returned by the method.
81     */

82
83    public _Record getProblematicRecord() {
84         return record;
85    }
86
87
88    /**
89     * throws Previous exception if it is not null
90     * @return DException
91     */

92
93    public DException getPreviousException(){
94         return (prevException==null) ? null : prevException;
95    }
96
97    public PrimaryConstraintException(String JavaDoc sqlcode, Object JavaDoc[] parameters) {
98       super( sqlcode, parameters );
99    }
100 }
101
Popular Tags