Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ValidatorClientUtils |
|
| 5.0;5 |
1 | package org.kuali.student.common.ui.client.validator; | |
2 | ||
3 | import java.util.List; | |
4 | ||
5 | import org.kuali.student.common.validation.dto.ValidationResultInfo; | |
6 | import org.kuali.student.common.validation.dto.ValidationResultInfo.ErrorLevel; | |
7 | ||
8 | 0 | public class ValidatorClientUtils { |
9 | ||
10 | /** | |
11 | * Inspect the validation result to determine if there are any errors. | |
12 | | |
13 | * | |
14 | * @param validationResults | |
15 | * @return true if at least one validation result is an error. | |
16 | */ | |
17 | public static boolean hasErrors(List<ValidationResultInfo> validationResults){ | |
18 | 0 | if (validationResults !=null){ |
19 | 0 | for (ValidationResultInfo vr:validationResults){ |
20 | 0 | if (vr.getErrorLevel() == ErrorLevel.ERROR){ |
21 | 0 | return true; |
22 | } | |
23 | } | |
24 | } | |
25 | ||
26 | 0 | return false; |
27 | } | |
28 | ||
29 | /** | |
30 | * Inspect the validation result to determine if there are any errors. | |
31 | * | |
32 | * @param validationResults | |
33 | * @return true if at least one validation result is an error. | |
34 | */ | |
35 | public static boolean hasWarnings(List<ValidationResultInfo> validationResults){ | |
36 | 0 | if (validationResults !=null){ |
37 | 0 | for (ValidationResultInfo vr:validationResults){ |
38 | 0 | if (vr.getErrorLevel() == ErrorLevel.WARN){ |
39 | 0 | return true; |
40 | } | |
41 | } | |
42 | } | |
43 | ||
44 | 0 | return false; |
45 | } | |
46 | ||
47 | } |