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