1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.assembly.data; |
17 |
|
|
18 |
|
import java.io.Serializable; |
19 |
|
import java.util.ArrayList; |
20 |
|
import java.util.HashMap; |
21 |
|
import java.util.LinkedHashMap; |
22 |
|
import java.util.List; |
23 |
|
import java.util.Map; |
24 |
|
import java.util.Map.Entry; |
25 |
|
|
|
|
| 68.8% |
Uncovered Elements: 48 (154) |
Complexity: 54 |
Complexity Density: 0.59 |
|
26 |
|
public class Metadata implements Serializable { |
27 |
|
|
28 |
|
private static final long serialVersionUID = 1L; |
29 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
30 |
|
public enum WriteAccess { |
31 |
|
ON_CREATE, |
32 |
|
ALWAYS, NEVER, WHEN_NULL, REQUIRED |
33 |
|
} |
34 |
|
|
35 |
|
private String name; |
36 |
|
private String labelKey; |
37 |
|
private WriteAccess writeAccess; |
38 |
|
|
39 |
|
private boolean canUnmask = false; |
40 |
|
private boolean canView = true; |
41 |
|
private boolean canEdit = true; |
42 |
|
private boolean dynamic = false; |
43 |
|
|
44 |
|
protected String partialMaskFormatter; |
45 |
|
protected String maskFormatter; |
46 |
|
|
47 |
|
private boolean onChangeRefreshMetadata; |
48 |
|
|
49 |
|
private Data.DataType dataType; |
50 |
|
|
51 |
|
private Data.Value defaultValue; |
52 |
|
|
53 |
|
private String defaultValuePath; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
private List<ConstraintMetadata> constraints; |
58 |
|
|
59 |
|
private LookupMetadata initialLookup; |
60 |
|
|
61 |
|
private String lookupContextPath; |
62 |
|
|
63 |
|
private List<LookupMetadata> additionalLookups; |
64 |
|
|
65 |
|
private Map<String, Metadata> childProperties; |
66 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
67 |
1000
|
public Metadata() {... |
68 |
|
|
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
@param |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 2 |
Complexity Density: 0.12 |
|
77 |
306
|
public Metadata(Metadata toClone) {... |
78 |
306
|
this.additionalLookups = toClone.additionalLookups; |
79 |
306
|
this.constraints = toClone.constraints; |
80 |
306
|
this.dataType = toClone.dataType; |
81 |
306
|
this.defaultValue = toClone.defaultValue; |
82 |
306
|
this.defaultValuePath = toClone.defaultValuePath; |
83 |
306
|
this.lookupContextPath = toClone.lookupContextPath; |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
306
|
this.initialLookup = toClone.initialLookup; |
88 |
306
|
this.onChangeRefreshMetadata = toClone.onChangeRefreshMetadata; |
89 |
306
|
this.name = toClone.name; |
90 |
306
|
this.writeAccess = toClone.writeAccess; |
91 |
306
|
this.canEdit = toClone.canEdit; |
92 |
306
|
this.canView = toClone.canView; |
93 |
306
|
this.canUnmask = toClone.canUnmask; |
94 |
306
|
if(toClone.childProperties != null) { |
95 |
88
|
this.childProperties = new HashMap<String, Metadata>(); |
96 |
88
|
for(Map.Entry<String, Metadata> childProperty : toClone.childProperties.entrySet()) { |
97 |
304
|
this.childProperties.put(childProperty.getKey(), new Metadata(childProperty.getValue())); |
98 |
|
} |
99 |
|
|
100 |
|
} |
101 |
|
} |
102 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
103 |
0
|
@Override... |
104 |
|
public String toString() { |
105 |
0
|
StringBuilder sb = new StringBuilder(); |
106 |
0
|
_toString(sb); |
107 |
0
|
return sb.toString(); |
108 |
|
} |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 33 (33) |
Complexity: 6 |
Complexity Density: 0.26 |
|
110 |
0
|
protected void _toString(StringBuilder sb) {... |
111 |
0
|
Data.DataType type = (null == dataType) ? Data.DataType.DATA : dataType; |
112 |
0
|
sb.append("type: " + type.toString()); |
113 |
0
|
sb.append(", canEdit: " + canEdit); |
114 |
0
|
sb.append(", canView: " + canView); |
115 |
0
|
sb.append(", defaultValue: "); |
116 |
0
|
sb.append(null == defaultValue ? "null" : defaultValue.toString()); |
117 |
0
|
sb.append(", constraints: {"); |
118 |
0
|
if (null != constraints) { |
119 |
0
|
for (ConstraintMetadata constraint : constraints) { |
120 |
0
|
sb.append(constraint.toString()); |
121 |
|
} |
122 |
|
} |
123 |
0
|
sb.append("}"); |
124 |
0
|
sb.append(", Properties: {"); |
125 |
0
|
if (null != childProperties) { |
126 |
0
|
for (Entry<String, Metadata> e : childProperties.entrySet()) { |
127 |
0
|
sb.append("("); |
128 |
0
|
sb.append(e.getKey()); |
129 |
0
|
sb.append(" = "); |
130 |
0
|
Metadata m = e.getValue(); |
131 |
0
|
if (m == null) { |
132 |
0
|
sb.append("null"); |
133 |
|
} else { |
134 |
0
|
m._toString(sb); |
135 |
|
} |
136 |
0
|
sb.append(");"); |
137 |
|
} |
138 |
|
} |
139 |
0
|
sb.append("}"); |
140 |
|
|
141 |
|
} |
142 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
143 |
276
|
public List<ConstraintMetadata> getConstraints() {... |
144 |
276
|
if (constraints == null) { |
145 |
8
|
constraints = new ArrayList<ConstraintMetadata>(); |
146 |
|
} |
147 |
276
|
return constraints; |
148 |
|
} |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
707
|
public void setConstraints(List<ConstraintMetadata> constraints) {... |
151 |
707
|
this.constraints = constraints; |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
@param |
158 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 5 |
Complexity Density: 0.83 |
|
159 |
149
|
public void setNonServerConstraints(List<ConstraintMetadata> constraints) {... |
160 |
149
|
if (constraints != null){ |
161 |
148
|
List<ConstraintMetadata> metadataConstraints = new ArrayList<ConstraintMetadata>(); |
162 |
148
|
for (ConstraintMetadata constraint:constraints){ |
163 |
508
|
if (!"single".equals(constraint.getId()) && |
164 |
|
!"optional".equals(constraint.getId()) && |
165 |
|
!constraint.isServerSide()){ |
166 |
193
|
metadataConstraints.add(constraint); |
167 |
|
} |
168 |
|
} |
169 |
148
|
this.constraints = metadataConstraints; |
170 |
|
} |
171 |
|
} |
172 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
1025
|
public Data.DataType getDataType() {... |
174 |
1025
|
return dataType; |
175 |
|
} |
176 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
177 |
1108
|
public void setDataType(Data.DataType dataType) {... |
178 |
1108
|
this.dataType = dataType; |
179 |
|
} |
180 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
181 |
30
|
public Data.Value getDefaultValue() {... |
182 |
30
|
return defaultValue; |
183 |
|
} |
184 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
185 |
852
|
public void setDefaultValue(Data.Value defaultValue) {... |
186 |
852
|
this.defaultValue = defaultValue; |
187 |
|
} |
188 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
0
|
public String getDefaultValuePath() {... |
190 |
0
|
return defaultValuePath; |
191 |
|
} |
192 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
193 |
707
|
public void setDefaultValuePath(String defaultValuePath) {... |
194 |
707
|
this.defaultValuePath = defaultValuePath; |
195 |
|
} |
196 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
197 |
54
|
public LookupMetadata getInitialLookup() {... |
198 |
54
|
return initialLookup; |
199 |
|
} |
200 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
154
|
public void setInitialLookup(LookupMetadata initialLookup) {... |
202 |
154
|
this.initialLookup = initialLookup; |
203 |
|
} |
204 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
205 |
0
|
public String getLookupContextPath() {... |
206 |
0
|
return lookupContextPath; |
207 |
|
} |
208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
209 |
145
|
public void setLookupContextPath(String lookupContextPath) {... |
210 |
145
|
this.lookupContextPath = lookupContextPath; |
211 |
|
} |
212 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
213 |
75
|
public List<LookupMetadata> getAdditionalLookups() {... |
214 |
75
|
if (additionalLookups == null) { |
215 |
25
|
additionalLookups = new ArrayList<LookupMetadata>(); |
216 |
|
} |
217 |
75
|
return additionalLookups; |
218 |
|
} |
219 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
220 |
146
|
public void setAdditionalLookups(List<LookupMetadata> additionalLookups) {... |
221 |
146
|
this.additionalLookups = additionalLookups; |
222 |
|
} |
223 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
224 |
131
|
public Map<String, Metadata> getProperties() {... |
225 |
131
|
if (childProperties == null) { |
226 |
14
|
childProperties = new LinkedHashMap<String, Metadata>(); |
227 |
|
} |
228 |
131
|
return childProperties; |
229 |
|
} |
230 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
231 |
277
|
public void setProperties(Map<String, Metadata> properties) {... |
232 |
277
|
this.childProperties = properties; |
233 |
|
} |
234 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
235 |
0
|
public WriteAccess getWriteAccess() {... |
236 |
0
|
return writeAccess; |
237 |
|
} |
238 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
239 |
987
|
public void setWriteAccess(WriteAccess writeAccess) {... |
240 |
987
|
this.writeAccess = writeAccess; |
241 |
|
} |
242 |
|
|
243 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
244 |
0
|
public boolean isOnChangeRefreshMetadata() {... |
245 |
0
|
return onChangeRefreshMetadata; |
246 |
|
} |
247 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
248 |
111
|
public void setOnChangeRefreshMetadata(boolean onChangeRefereshMetadata) {... |
249 |
111
|
this.onChangeRefreshMetadata = onChangeRefereshMetadata; |
250 |
|
} |
251 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
252 |
25
|
public boolean isCanUnmask() {... |
253 |
25
|
return canUnmask; |
254 |
|
} |
255 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
256 |
852
|
public void setCanUnmask(boolean canUnmask) {... |
257 |
852
|
this.canUnmask = canUnmask; |
258 |
|
} |
259 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
260 |
25
|
public boolean isCanView() {... |
261 |
25
|
return canView; |
262 |
|
} |
263 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
264 |
852
|
public void setCanView(boolean canView) {... |
265 |
852
|
this.canView = canView; |
266 |
|
} |
267 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
268 |
45
|
public boolean isCanEdit() {... |
269 |
45
|
return canEdit; |
270 |
|
} |
271 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
272 |
859
|
public void setCanEdit(boolean canEdit) {... |
273 |
859
|
this.canEdit = canEdit; |
274 |
|
} |
275 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
276 |
0
|
public String getName() {... |
277 |
0
|
return name; |
278 |
|
} |
279 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
280 |
145
|
public void setName(String name) {... |
281 |
145
|
this.name = name; |
282 |
|
} |
283 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
284 |
25
|
public boolean isDynamic() {... |
285 |
25
|
return dynamic; |
286 |
|
} |
287 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
288 |
707
|
public void setDynamic(boolean dynamic) {... |
289 |
707
|
this.dynamic = dynamic; |
290 |
|
} |
291 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
292 |
25
|
public String getLabelKey() {... |
293 |
25
|
return labelKey; |
294 |
|
} |
295 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
296 |
707
|
public void setLabelKey(String labelKey) {... |
297 |
707
|
this.labelKey = labelKey; |
298 |
|
} |
299 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
300 |
3
|
public String getPartialMaskFormatter() {... |
301 |
3
|
return partialMaskFormatter; |
302 |
|
} |
303 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
304 |
11
|
public void setPartialMaskFormatter(String partialMaskFormatter) {... |
305 |
11
|
this.partialMaskFormatter = partialMaskFormatter; |
306 |
|
} |
307 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
308 |
4
|
public String getMaskFormatter() {... |
309 |
4
|
return maskFormatter; |
310 |
|
} |
311 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
312 |
12
|
public void setMaskFormatter(String maskFormatter) {... |
313 |
12
|
this.maskFormatter = maskFormatter; |
314 |
|
} |
315 |
|
} |