1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.validation.dto; |
17 |
|
|
18 |
|
import java.io.Serializable; |
19 |
|
|
20 |
|
import javax.xml.bind.annotation.XmlAccessType; |
21 |
|
import javax.xml.bind.annotation.XmlAccessorType; |
22 |
|
import javax.xml.bind.annotation.XmlElement; |
23 |
|
|
24 |
|
@XmlAccessorType(XmlAccessType.FIELD) |
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 16 |
Complexity Density: 0.73 |
|
25 |
|
public class ValidationResultInfo implements Serializable{ |
26 |
|
|
27 |
|
private static final long serialVersionUID = 1L; |
28 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 6 |
Complexity Density: 1.5 |
|
29 |
|
public enum ErrorLevel { |
30 |
|
OK(0), WARN(1), ERROR(2); |
31 |
|
|
32 |
|
int level; |
33 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
34 |
0
|
private ErrorLevel(int level) {... |
35 |
0
|
this.level = level; |
36 |
|
} |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
0
|
public int getLevel() {... |
39 |
0
|
return level; |
40 |
|
} |
41 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
42 |
0
|
public static ErrorLevel min(ErrorLevel e1, ErrorLevel e2) {... |
43 |
0
|
return e1.ordinal() < e2.ordinal() ? e1 : e2; |
44 |
|
} |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
45 |
0
|
public static ErrorLevel max(ErrorLevel e1, ErrorLevel e2) {... |
46 |
0
|
return e1.ordinal() > e2.ordinal() ? e1 : e2; |
47 |
|
} |
48 |
|
} |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
50 |
0
|
public ValidationResultInfo() {... |
51 |
0
|
super(); |
52 |
0
|
this.level = ErrorLevel.OK; |
53 |
|
} |
54 |
|
|
55 |
|
private transient Object invalidData = null; |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
57 |
0
|
public ValidationResultInfo(String element) {... |
58 |
0
|
super(); |
59 |
0
|
this.level = ErrorLevel.OK; |
60 |
0
|
this.element = element; |
61 |
|
} |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
63 |
0
|
public ValidationResultInfo(String element, Object invalidData) {... |
64 |
0
|
this(element); |
65 |
0
|
this.invalidData = invalidData; |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
@XmlElement |
70 |
|
protected String element; |
71 |
|
|
72 |
|
@XmlElement |
73 |
|
protected ErrorLevel level = ErrorLevel.OK; |
74 |
|
|
75 |
|
@XmlElement |
76 |
|
protected String message; |
77 |
|
|
78 |
|
|
79 |
|
@return |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0
|
public ErrorLevel getLevel() {... |
82 |
0
|
return level; |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0
|
public void setLevel(ErrorLevel level) {... |
89 |
0
|
this.level = level; |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
@return |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0
|
public String getMessage() {... |
96 |
0
|
return message; |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
@param |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0
|
public void setMessage(String message) {... |
103 |
0
|
this.message = message; |
104 |
|
} |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0
|
public String getElement() {... |
107 |
0
|
return element; |
108 |
|
} |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
0
|
public void setElement(String element) {... |
111 |
0
|
this.element = element; |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@return |
118 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
0
|
public ErrorLevel getErrorLevel() {... |
120 |
0
|
return level; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
@param |
127 |
|
|
128 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
129 |
0
|
public void setWarning(String message) {... |
130 |
0
|
this.level = ErrorLevel.WARN; |
131 |
0
|
this.message = message; |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
@param |
138 |
|
|
139 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
140 |
0
|
public void setError(String message) {... |
141 |
0
|
this.level = ErrorLevel.ERROR; |
142 |
0
|
this.message = message; |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
@return |
149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0
|
public boolean isOk() {... |
151 |
0
|
return getErrorLevel() == ErrorLevel.OK; |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
@return |
158 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
0
|
public boolean isWarn() {... |
160 |
0
|
return getErrorLevel() == ErrorLevel.WARN; |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
@return |
167 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
0
|
public boolean isError() {... |
169 |
0
|
return getErrorLevel() == ErrorLevel.ERROR; |
170 |
|
} |
171 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
172 |
0
|
public String toString(){... |
173 |
0
|
return "[" + level + "] Path: [" + element + "] - " + message + " data=[" + invalidData + "]"; |
174 |
|
} |
175 |
|
|
176 |
|
} |