Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ValidationResultInfc |
|
| 1.1818181818181819;1.182 | ||||
ValidationResultInfc$ErrorLevel |
|
| 1.1818181818181819;1.182 |
1 | /* | |
2 | * Copyright 2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.osedu.org/licenses/ECL-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.student.common.infc; | |
17 | ||
18 | public interface ValidationResultInfc { | |
19 | ||
20 | 0 | public enum ErrorLevel { |
21 | ||
22 | 0 | OK(0), WARN(1), ERROR(2); |
23 | int level; | |
24 | ||
25 | 0 | private ErrorLevel(int level) { |
26 | 0 | this.level = level; |
27 | 0 | } |
28 | ||
29 | public int getLevel() { | |
30 | 0 | return level; |
31 | } | |
32 | ||
33 | public static ErrorLevel min(ErrorLevel e1, ErrorLevel e2) { | |
34 | 0 | return e1.ordinal() < e2.ordinal() ? e1 : e2; |
35 | } | |
36 | ||
37 | public static ErrorLevel max(ErrorLevel e1, ErrorLevel e2) { | |
38 | 0 | return e1.ordinal() > e2.ordinal() ? e1 : e2; |
39 | } | |
40 | } | |
41 | ||
42 | ||
43 | /** | |
44 | * Get ???? | |
45 | * <p/> | |
46 | * Type: String | |
47 | * <p/> | |
48 | * ??? | |
49 | */ | |
50 | public String getMessage(); | |
51 | ||
52 | /** | |
53 | * Get ???? | |
54 | * <p/> | |
55 | * Type: String | |
56 | * <p/> | |
57 | * ??? | |
58 | */ | |
59 | public String getElement(); | |
60 | ||
61 | /** | |
62 | * Get ???? | |
63 | * <p/> | |
64 | * Type: Integer | |
65 | * <p/> | |
66 | * Returns the ValidationResult's error level | |
67 | */ | |
68 | public Integer getLevel(); | |
69 | ||
70 | /** | |
71 | * | |
72 | * Invalid data causing the error or warning | |
73 | * <p/> | |
74 | * Type: Object | |
75 | * <p/> | |
76 | * @return data causing the error or warning | |
77 | */ | |
78 | public Object getInvalidData(); | |
79 | ||
80 | /** | |
81 | * Get ???? | |
82 | * <p/> | |
83 | * Type: boolean | |
84 | * <p/> | |
85 | * Convenience method. Returns true if getErrorLevel() == ErrorLevel.OK | |
86 | */ | |
87 | public boolean isOk(); | |
88 | ||
89 | /** | |
90 | * Get ???? | |
91 | * <p/> | |
92 | * Type: boolean | |
93 | * <p/> | |
94 | * Convenience method. Returns true if getErrorLevel() == ErrorLevel.WARN | |
95 | */ | |
96 | public boolean isWarn(); | |
97 | ||
98 | /** | |
99 | * Get ???? | |
100 | * <p/> | |
101 | * Type: boolean | |
102 | * <p/> | |
103 | * Convenience method. Returns true if getErrorLevel() == ErrorLevel.ERROR | |
104 | */ | |
105 | public boolean isError(); | |
106 | } | |
107 |