1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.contract.model.validation; |
17 |
|
|
18 |
|
import org.kuali.student.contract.model.OrchObj; |
19 |
|
|
20 |
|
import java.util.ArrayList; |
21 |
|
import java.util.Collection; |
22 |
|
import java.util.List; |
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
@author |
27 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 6 |
Complexity Density: 0.55 |
|
28 |
|
public class OrchObjValidator implements ModelValidator { |
29 |
|
|
30 |
|
private OrchObj orch; |
31 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
32 |
0
|
public OrchObjValidator(OrchObj orch) {... |
33 |
0
|
this.orch = orch; |
34 |
|
} |
35 |
|
private Collection errors; |
36 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
37 |
0
|
@Override... |
38 |
|
public Collection<String> validate() { |
39 |
0
|
this.errors = new ArrayList(); |
40 |
0
|
if (orch.getXmlType().equals("")) { |
41 |
0
|
this.addError("XML Type is required"); |
42 |
|
} |
43 |
|
|
44 |
0
|
return this.errors; |
45 |
|
} |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
47 |
0
|
private void addError(String msg) {... |
48 |
0
|
String key = orch.getId(); |
49 |
0
|
if (key.equals("")) { |
50 |
0
|
key = ""; |
51 |
|
} |
52 |
0
|
String error = "Error in: " + key + ": " + msg; |
53 |
0
|
if (!errors.contains(error)) { |
54 |
0
|
errors.add(error); |
55 |
|
} |
56 |
|
} |
57 |
|
} |