1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.bo.Exporter;
20 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
21 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
23 import org.kuali.rice.krad.datadictionary.validation.capability.MustOccurConstrainable;
24 import org.kuali.rice.krad.datadictionary.validation.constraint.MustOccurConstraint;
25 import org.kuali.rice.krad.datadictionary.validator.ValidationTrace;
26
27 import java.util.List;
28
29
30
31
32
33
34
35 @BeanTag(name = "dataObjectEntry")
36 public class DataObjectEntry extends DataDictionaryEntryBase implements MustOccurConstrainable {
37
38 protected String name;
39 protected Class<?> dataObjectClass;
40
41 protected String titleAttribute;
42 protected String objectLabel;
43 protected String objectDescription;
44
45 protected List<String> primaryKeys;
46 protected Class<? extends Exporter> exporterClass;
47
48 protected List<MustOccurConstraint> mustOccurConstraints;
49
50 protected List<String> groupByAttributesForEffectiveDating;
51
52 protected HelpDefinition helpDefinition;
53
54 protected boolean boNotesEnabled = false;
55
56 protected List<InactivationBlockingDefinition> inactivationBlockingDefinitions;
57
58 @Override
59 public void completeValidation() {
60
61 if (StringUtils.isBlank(getObjectLabel())) {
62 throw new AttributeValidationException(
63 "Object label cannot be blank for class " + dataObjectClass.getName());
64 }
65
66 super.completeValidation();
67 }
68
69
70
71
72
73
74 @Override
75 public void completeValidation(ValidationTrace tracer) {
76 tracer.addBean(this.getClass().getSimpleName(), dataObjectClass.getSimpleName());
77 if (StringUtils.isBlank(getObjectLabel())) {
78 String currentValues[] = {"objectLabel = " + getObjectLabel()};
79 tracer.createError("Object Label is not set", currentValues);
80 }
81
82 super.completeValidation(tracer.getCopy());
83 }
84
85
86
87
88 @Override
89 public String getJstlKey() {
90 if (dataObjectClass == null) {
91 throw new IllegalStateException("cannot generate JSTL key: dataObjectClass is null");
92 }
93
94 return (dataObjectClass != null) ? dataObjectClass.getSimpleName() : dataObjectClass.getSimpleName();
95 }
96
97
98
99
100 @Override
101 public String getFullClassName() {
102 return dataObjectClass.getName();
103 }
104
105
106
107
108 @Override
109 public Class<?> getEntryClass() {
110 return dataObjectClass;
111 }
112
113
114
115
116 @BeanTagAttribute(name = "dataObjectClass")
117 public Class<?> getDataObjectClass() {
118 return this.dataObjectClass;
119 }
120
121
122
123
124 public void setDataObjectClass(Class<?> dataObjectClass) {
125 this.dataObjectClass = dataObjectClass;
126 }
127
128
129
130
131 @BeanTagAttribute(name = "name")
132 public String getName() {
133 return this.name;
134 }
135
136
137
138
139 public void setName(String name) {
140 this.name = name;
141 }
142
143
144
145
146 @BeanTagAttribute(name = "objectLabel")
147 public String getObjectLabel() {
148 return objectLabel;
149 }
150
151
152
153
154
155
156
157 public void setObjectLabel(String objectLabel) {
158 this.objectLabel = objectLabel;
159 }
160
161
162
163
164 @BeanTagAttribute(name = "objectDescription")
165 public String getObjectDescription() {
166 return objectDescription;
167 }
168
169
170
171
172
173
174
175 public void setObjectDescription(String objectDescription) {
176 this.objectDescription = objectDescription;
177 }
178
179
180
181
182
183
184 @BeanTagAttribute(name = "helpDefintion", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
185 public HelpDefinition getHelpDefinition() {
186 return helpDefinition;
187 }
188
189
190
191
192
193
194
195
196
197
198
199
200
201 public void setHelpDefinition(HelpDefinition helpDefinition) {
202 this.helpDefinition = helpDefinition;
203 }
204
205
206
207
208 @Override
209 public String toString() {
210 return "DataObjectEntry for " + getDataObjectClass();
211 }
212
213
214
215
216 @BeanTagAttribute(name = "mustOccurConstraints", type = BeanTagAttribute.AttributeType.LISTBEAN)
217 public List<MustOccurConstraint> getMustOccurConstraints() {
218 return this.mustOccurConstraints;
219 }
220
221
222
223
224 public void setMustOccurConstraints(List<MustOccurConstraint> mustOccurConstraints) {
225 this.mustOccurConstraints = mustOccurConstraints;
226 }
227
228
229
230
231 @BeanTagAttribute(name = "titleAttribute")
232 public String getTitleAttribute() {
233 return this.titleAttribute;
234 }
235
236
237
238
239
240
241
242
243
244
245 public void setTitleAttribute(String titleAttribute) {
246 this.titleAttribute = titleAttribute;
247 }
248
249
250
251
252 @BeanTagAttribute(name = "primaryKeys", type = BeanTagAttribute.AttributeType.LISTVALUE)
253 public List<String> getPrimaryKeys() {
254 return this.primaryKeys;
255 }
256
257
258
259
260 public void setPrimaryKeys(List<String> primaryKeys) {
261 this.primaryKeys = primaryKeys;
262 }
263
264 @BeanTagAttribute(name = "exporterClass")
265 public Class<? extends Exporter> getExporterClass() {
266 return this.exporterClass;
267 }
268
269 public void setExporterClass(Class<? extends Exporter> exporterClass) {
270 this.exporterClass = exporterClass;
271 }
272
273
274
275
276
277
278
279 @BeanTagAttribute(name = "groupByAttributesForEffectiveDating", type = BeanTagAttribute.AttributeType.LISTVALUE)
280 public List<String> getGroupByAttributesForEffectiveDating() {
281 return this.groupByAttributesForEffectiveDating;
282 }
283
284
285
286
287
288
289 public void setGroupByAttributesForEffectiveDating(List<String> groupByAttributesForEffectiveDating) {
290 this.groupByAttributesForEffectiveDating = groupByAttributesForEffectiveDating;
291 }
292
293
294
295
296
297
298
299
300
301
302
303
304
305 @BeanTagAttribute(name = "boNotesEnabled")
306 public boolean isBoNotesEnabled() {
307 return boNotesEnabled;
308 }
309
310
311
312
313 public void setBoNotesEnabled(boolean boNotesEnabled) {
314 this.boNotesEnabled = boNotesEnabled;
315 }
316
317
318
319
320
321
322
323
324
325
326 @BeanTagAttribute(name = "inactivationBlockingDefinitions", type = BeanTagAttribute.AttributeType.LISTBEAN)
327 public List<InactivationBlockingDefinition> getInactivationBlockingDefinitions() {
328 return this.inactivationBlockingDefinitions;
329 }
330
331
332
333
334 public void setInactivationBlockingDefinitions(
335 List<InactivationBlockingDefinition> inactivationBlockingDefinitions) {
336 this.inactivationBlockingDefinitions = inactivationBlockingDefinitions;
337 }
338 }