1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.datadictionary.validation.result; |
17 | |
|
18 | |
import org.kuali.rice.krad.datadictionary.validation.ErrorLevel; |
19 | |
import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint; |
20 | |
import org.kuali.rice.krad.datadictionary.validation.processor.ConstraintProcessor; |
21 | |
|
22 | |
import java.util.LinkedList; |
23 | |
import java.util.List; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class ConstraintValidationResult { |
32 | |
|
33 | |
private String entryName; |
34 | |
private String attributeName; |
35 | |
private String attributePath; |
36 | |
private String constraintName; |
37 | |
private ErrorLevel level; |
38 | |
|
39 | |
private String errorKey; |
40 | |
private String[] errorParameters; |
41 | |
private String constraintLabelKey; |
42 | |
|
43 | |
private List<ConstraintValidationResult> children; |
44 | |
|
45 | |
|
46 | 155 | public ConstraintValidationResult(String constraintName) { |
47 | 155 | this.constraintName = constraintName; |
48 | 155 | this.children = new LinkedList<ConstraintValidationResult>(); |
49 | 155 | this.level = ErrorLevel.OK; |
50 | 155 | } |
51 | |
|
52 | 0 | public ConstraintValidationResult(String constraintName, ErrorLevel level) { |
53 | 0 | this.constraintName = constraintName; |
54 | 0 | this.children = new LinkedList<ConstraintValidationResult>(); |
55 | 0 | this.level = level; |
56 | 0 | } |
57 | |
|
58 | |
public void addChild(ConstraintValidationResult child) { |
59 | 12 | this.children.add(child); |
60 | 12 | } |
61 | |
|
62 | |
public void setError(String errorKey, String... errorParameters) { |
63 | 75 | this.level = ErrorLevel.ERROR; |
64 | 75 | this.errorKey = errorKey; |
65 | 75 | this.errorParameters = errorParameters; |
66 | 75 | } |
67 | |
|
68 | |
public void setWarning(String errorKey, String... errorParameters) { |
69 | 0 | this.level = ErrorLevel.WARN; |
70 | 0 | this.errorKey = errorKey; |
71 | 0 | this.errorParameters = errorParameters; |
72 | 0 | } |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
public ErrorLevel getStatus() { |
78 | 285 | return this.level; |
79 | |
} |
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
public void setStatus(ErrorLevel level) { |
85 | 19 | this.level = level; |
86 | 19 | } |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
public String getErrorKey() { |
92 | 1 | return this.errorKey; |
93 | |
} |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
public void setErrorKey(String errorKey) { |
99 | 0 | this.errorKey = errorKey; |
100 | 0 | } |
101 | |
|
102 | |
|
103 | |
|
104 | |
|
105 | |
public String[] getErrorParameters() { |
106 | 0 | return this.errorParameters; |
107 | |
} |
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
public void setErrorParameters(String[] errorParameters) { |
113 | 0 | this.errorParameters = errorParameters; |
114 | 0 | } |
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
public String getEntryName() { |
120 | 66 | return this.entryName; |
121 | |
} |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
public void setEntryName(String entryName) { |
127 | 143 | this.entryName = entryName; |
128 | 143 | } |
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
public String getAttributeName() { |
134 | 66 | return this.attributeName; |
135 | |
} |
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
public void setAttributeName(String attributeName) { |
141 | 144 | this.attributeName = attributeName; |
142 | 144 | } |
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
public String getConstraintName() { |
148 | 207 | return this.constraintName; |
149 | |
} |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
public void setConstraintName(String constraintName) { |
155 | 0 | this.constraintName = constraintName; |
156 | 0 | } |
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
public List<ConstraintValidationResult> getChildren() { |
162 | 0 | return this.children; |
163 | |
} |
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
public String getConstraintLabelKey() { |
169 | 0 | return this.constraintLabelKey; |
170 | |
} |
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
public void setConstraintLabelKey(String constraintLabelKey) { |
176 | 3 | this.constraintLabelKey = constraintLabelKey; |
177 | 3 | } |
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
public String getAttributePath() { |
183 | 66 | return this.attributePath; |
184 | |
} |
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
public void setAttributePath(String attributePath) { |
190 | 143 | this.attributePath = attributePath; |
191 | 143 | } |
192 | |
|
193 | |
} |