KickJava   Java API By Example, From Geeks To Geeks.

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


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: UniqueConstraintException </p>
9 * <p>Description: Unique constraint Exception has a super class Constraint Exception which in turn extends
10  * DException, and helps in throwing an exception corresponding to sqlCode and the paramaters passed.</p>
11  */

12
13 public class UniqueConstraintException extends ConstraintException{
14
15    QualifiedIdentifier table ;
16    String JavaDoc[] uniqueColumns;
17    transient _Record record ;
18
19
20    /**
21     * Used to construct a new instance of unique constraint exception with the given parameters.
22     * @param sqlCode code of exception in the sql statement
23     * @param parameters parameters passed to the exception
24     * @param temp previous exception
25     */

26    public UniqueConstraintException(String JavaDoc sqlCode, Object JavaDoc[] parameters, DException temp) {
27       super(sqlCode, parameters);
28       this.prevException = temp;
29    }
30
31
32    /**
33     * returns Previous exception if it is not null
34     * @return DException
35     */

36
37    public DException getPreviousException(){
38         return (prevException==null) ? null : prevException;
39    }
40
41    public UniqueConstraintException(String JavaDoc sqlcode, Object JavaDoc[] parameters) {
42       super( sqlcode, parameters );
43    }
44
45    /**
46     * used to get the message when the exception is thrown
47     * @param locale locale of JVM
48     * @return message of the exception
49     */

50    public String JavaDoc getMessage(java.util.Locale JavaDoc locale) {
51         return super.getMessage(locale);
52    }
53
54    /**
55     * set the name of the table
56     * @param tableName name of the table.
57     */

58
59    public void setCorrespondingTable( QualifiedIdentifier tableName ) {
60         table = tableName;
61    }
62
63    /**
64     * returns table name.
65     * @return name of the table
66     */

67
68    public QualifiedIdentifier getTable() {
69         return table ;
70    }
71
72    /**
73     * set the primary columns in array of String
74     * @param columns primary columns of the table.
75     */

76
77    public void setUniqueColumns( String JavaDoc[] columns ) {
78         uniqueColumns = columns ;
79    }
80
81
82    /**
83     * used to retreive the array of strings containing primary columns.
84     * @return the array returned by the method
85     */

86
87    public String JavaDoc[] getUniqueColumns () {
88         return uniqueColumns ;
89    }
90
91    /**
92     * sets the value of Record.
93     * @param record that has been passed to the method.
94     */

95
96    public void setRecord( _Record record ) {
97         this.record = record ;
98    }
99
100    /**
101     * used to retreive the Record
102     * @return record that is returned by the method.
103     */

104
105    public _Record getProblematicRecord() {
106         return record;
107    }
108
109
110 }
111
Popular Tags