|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ModuleDataException.java | - | 78,6% | 83,3% | 80% |
|
1 | /* $Id: ModuleDataException.java,v 1.3 2007/04/12 23:50:04 m31 Exp $ | |
2 | * | |
3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
4 | * | |
5 | * Copyright 2000-2007, Michael Meyling <mime@qedeq.org>. | |
6 | * | |
7 | * "Hilbert II" is free software; you can redistribute | |
8 | * it and/or modify it under the terms of the GNU General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2 of the License, or (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | */ | |
17 | ||
18 | package org.qedeq.kernel.bo.module; | |
19 | ||
20 | import org.qedeq.kernel.common.QedeqException; | |
21 | ||
22 | ||
23 | /** | |
24 | * Data validation error for a QEDEQ module. An error has always a reference to its | |
25 | * location. Maybe an additional reference for another location is provided. | |
26 | * | |
27 | * @version $Revision: 1.3 $ | |
28 | * @author Michael Meyling | |
29 | */ | |
30 | public abstract class ModuleDataException extends QedeqException { | |
31 | ||
32 | /** Error location. */ | |
33 | private ModuleContext context; | |
34 | ||
35 | /** Reference location to explain the error. */ | |
36 | private ModuleContext referenceContext; | |
37 | ||
38 | /** | |
39 | * Constructor. | |
40 | * | |
41 | * @param errorCode Error code of this message. | |
42 | * @param message Error message. | |
43 | * @param context Error location. | |
44 | * @param referenceContext Reference location. | |
45 | * @param cause Detailed exception information. | |
46 | */ | |
47 | 2 | public ModuleDataException(final int errorCode, final String message, |
48 | final ModuleContext context, final ModuleContext referenceContext, | |
49 | final Exception cause) { | |
50 | 2 | super(errorCode, message, cause); |
51 | 2 | this.context = context; |
52 | 2 | this.referenceContext = referenceContext; |
53 | } | |
54 | ||
55 | /** | |
56 | * Constructor. | |
57 | * | |
58 | * @param errorCode Error code of this message. | |
59 | * @param message Error message. | |
60 | * @param context Error location. | |
61 | * @param referenceContext Reference location. | |
62 | */ | |
63 | 1 | public ModuleDataException(final int errorCode, final String message, |
64 | final ModuleContext context, final ModuleContext referenceContext) { | |
65 | 1 | super(errorCode, message); |
66 | 1 | this.context = context; |
67 | 1 | this.referenceContext = referenceContext; |
68 | } | |
69 | ||
70 | /** | |
71 | * Constructor. | |
72 | * | |
73 | * @param errorCode Error code of this message. | |
74 | * @param message Error message. | |
75 | * @param context Error location. | |
76 | * @param cause Detailed exception information. | |
77 | */ | |
78 | 0 | public ModuleDataException(final int errorCode, final String message, |
79 | final ModuleContext context, final Exception cause) { | |
80 | 0 | super(errorCode, message, cause); |
81 | 0 | this.context = context; |
82 | 0 | this.referenceContext = null; |
83 | } | |
84 | ||
85 | /** | |
86 | * Constructor. | |
87 | * | |
88 | * @param errorCode Error code of this message. | |
89 | * @param message Error message. | |
90 | * @param context Error location. | |
91 | */ | |
92 | 29078 | public ModuleDataException(final int errorCode, final String message, |
93 | final ModuleContext context) { | |
94 | 29078 | super(errorCode, message); |
95 | 29078 | this.context = context; |
96 | 29078 | this.referenceContext = null; |
97 | } | |
98 | ||
99 | /** | |
100 | * Get context information about error location. | |
101 | * | |
102 | * @return Error location context. | |
103 | */ | |
104 | 11 | public final ModuleContext getContext() { |
105 | 11 | return context; |
106 | } | |
107 | ||
108 | /** | |
109 | * Get additional context information about another associated location. | |
110 | * | |
111 | * @return Additional error location context. | |
112 | */ | |
113 | 8 | public final ModuleContext getReferenceContext() { |
114 | 8 | return referenceContext; |
115 | } | |
116 | ||
117 | } |
|