1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary;
17
18 import org.kuali.rice.kns.rule.PromptBeforeValidation;
19 import org.kuali.rice.kns.web.derivedvaluesetter.DerivedValuesSetter;
20 import org.kuali.rice.krad.bo.BusinessObject;
21 import org.kuali.rice.krad.datadictionary.DataDictionary;
22 import org.kuali.rice.krad.datadictionary.ReferenceDefinition;
23 import org.kuali.rice.krad.datadictionary.exception.AttributeValidationException;
24 import org.kuali.rice.krad.datadictionary.exception.ClassValidationException;
25 import org.kuali.rice.krad.datadictionary.exception.DuplicateEntryException;
26 import org.kuali.rice.krad.document.Document;
27 import org.kuali.rice.kns.document.MaintenanceDocumentBase;
28 import org.kuali.rice.krad.document.authorization.DocumentAuthorizer;
29 import org.kuali.rice.krad.document.authorization.DocumentPresentationController;
30 import org.kuali.rice.krad.document.authorization.MaintenanceDocumentAuthorizer;
31 import org.kuali.rice.kns.maintenance.Maintainable;
32
33 import java.util.ArrayList;
34 import java.util.LinkedHashMap;
35 import java.util.List;
36 import java.util.Map;
37
38
39
40
41 @Deprecated
42 public class MaintenanceDocumentEntry extends org.kuali.rice.krad.datadictionary.MaintenanceDocumentEntry implements KNSDocumentEntry {
43 protected List<MaintainableSectionDefinition> maintainableSections = new ArrayList<MaintainableSectionDefinition>();
44 protected List<String> lockingKeys = new ArrayList<String>();
45
46 protected Map<String, MaintainableSectionDefinition> maintainableSectionMap =
47 new LinkedHashMap<String, MaintainableSectionDefinition>();
48
49 protected boolean allowsNewOrCopy = true;
50 protected String additionalSectionsFile;
51
52
53 protected boolean preserveLockingKeysOnCopy = false;
54
55
56 protected boolean allowsRecordDeletion = false;
57
58 protected boolean translateCodes = false;
59
60 protected Class<? extends PromptBeforeValidation> promptBeforeValidationClass;
61 protected Class<? extends DerivedValuesSetter> derivedValuesSetterClass;
62 protected List<String> webScriptFiles = new ArrayList<String>(3);
63 protected List<HeaderNavigation> headerNavigationList = new ArrayList<HeaderNavigation>();
64
65 protected Class<? extends DocumentAuthorizer> documentAuthorizerClass;
66 protected Class<? extends DocumentPresentationController> documentPresentationControllerClass;
67
68 protected boolean sessionDocument = false;
69
70 public MaintenanceDocumentEntry() {
71 super();
72 }
73
74
75
76
77 public Class<? extends PromptBeforeValidation> getPromptBeforeValidationClass() {
78 return promptBeforeValidationClass;
79 }
80
81
82
83
84
85
86
87
88
89 public void setPromptBeforeValidationClass(Class<? extends PromptBeforeValidation> preRulesCheckClass) {
90 this.promptBeforeValidationClass = preRulesCheckClass;
91 }
92
93 @Override
94 public Class<? extends Document> getStandardDocumentBaseClass() {
95 return MaintenanceDocumentBase.class;
96 }
97
98
99
100
101
102 public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) {
103 if (businessObjectClass == null) {
104 throw new IllegalArgumentException("invalid (null) dataObjectClass");
105 }
106
107 setDataObjectClass(businessObjectClass);
108 }
109
110 public Class<? extends BusinessObject> getBusinessObjectClass() {
111 return (Class<? extends BusinessObject>) getDataObjectClass();
112 }
113
114
115
116
117 @SuppressWarnings("unchecked")
118 @Override
119 public Class getEntryClass() {
120 return getDataObjectClass();
121 }
122
123 public Class<? extends Maintainable> getMaintainableClass() {
124 return (Class<? extends Maintainable>) super.getMaintainableClass();
125 }
126
127
128
129
130 public List<MaintainableSectionDefinition> getMaintainableSections() {
131 return maintainableSections;
132 }
133
134
135
136
137
138 public List<String> getLockingKeyFieldNames() {
139 return lockingKeys;
140 }
141
142
143
144
145
146
147 public boolean getAllowsNewOrCopy() {
148 return allowsNewOrCopy;
149 }
150
151
152
153
154
155
156 public void setAllowsNewOrCopy(boolean allowsNewOrCopy) {
157 this.allowsNewOrCopy = allowsNewOrCopy;
158 }
159
160
161
162
163
164
165 public void completeValidation() {
166 super.completeValidation();
167
168 for (MaintainableSectionDefinition maintainableSectionDefinition : maintainableSections) {
169 maintainableSectionDefinition.completeValidation(getDataObjectClass(), null);
170 }
171 }
172
173
174
175
176 public String toString() {
177 return "MaintenanceDocumentEntry for documentType " + getDocumentTypeName();
178 }
179
180 @Deprecated
181 public String getAdditionalSectionsFile() {
182 return additionalSectionsFile;
183 }
184
185
186
187
188
189
190
191 @Deprecated
192 public void setAdditionalSectionsFile(String additionalSectionsFile) {
193 this.additionalSectionsFile = additionalSectionsFile;
194 }
195
196 public List<String> getLockingKeys() {
197 return lockingKeys;
198 }
199
200
201
202
203
204
205 public void setLockingKeys(List<String> lockingKeys) {
206 for (String lockingKey : lockingKeys) {
207 if (lockingKey == null) {
208 throw new IllegalArgumentException("invalid (null) lockingKey");
209 }
210 }
211 this.lockingKeys = lockingKeys;
212 }
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227 @Deprecated
228 public void setMaintainableSections(List<MaintainableSectionDefinition> maintainableSections) {
229 maintainableSectionMap.clear();
230 for (MaintainableSectionDefinition maintainableSectionDefinition : maintainableSections) {
231 if (maintainableSectionDefinition == null) {
232 throw new IllegalArgumentException("invalid (null) maintainableSectionDefinition");
233 }
234
235 String sectionTitle = maintainableSectionDefinition.getTitle();
236 if (maintainableSectionMap.containsKey(sectionTitle)) {
237 throw new DuplicateEntryException(
238 "section '" + sectionTitle + "' already defined for maintenanceDocument '" +
239 getDocumentTypeName() + "'");
240 }
241
242 maintainableSectionMap.put(sectionTitle, maintainableSectionDefinition);
243 }
244 this.maintainableSections = maintainableSections;
245 }
246
247
248
249
250 public boolean getPreserveLockingKeysOnCopy() {
251 return this.preserveLockingKeysOnCopy;
252 }
253
254
255
256
257 public void setPreserveLockingKeysOnCopy(boolean preserveLockingKeysOnCopy) {
258 this.preserveLockingKeysOnCopy = preserveLockingKeysOnCopy;
259 }
260
261
262
263
264 public boolean getAllowsRecordDeletion() {
265 return this.allowsRecordDeletion;
266 }
267
268
269
270
271 public void setAllowsRecordDeletion(boolean allowsRecordDeletion) {
272 this.allowsRecordDeletion = allowsRecordDeletion;
273 }
274
275 @Deprecated
276 public boolean isTranslateCodes() {
277 return this.translateCodes;
278 }
279
280 @Deprecated
281 public void setTranslateCodes(boolean translateCodes) {
282 this.translateCodes = translateCodes;
283 }
284
285
286
287
288
289
290 public void setDocumentAuthorizerClass(Class<? extends DocumentAuthorizer> documentAuthorizerClass) {
291 this.documentAuthorizerClass = documentAuthorizerClass;
292 }
293
294
295
296
297
298
299
300
301
302 public Class<? extends DocumentAuthorizer> getDocumentAuthorizerClass() {
303 return documentAuthorizerClass;
304 }
305
306 public List<HeaderNavigation> getHeaderNavigationList() {
307 return headerNavigationList;
308 }
309
310 public List<String> getWebScriptFiles() {
311 return webScriptFiles;
312 }
313
314
315
316
317
318
319 public void setWebScriptFiles(List<String> webScriptFiles) {
320 this.webScriptFiles = webScriptFiles;
321 }
322
323
324
325
326
327 public void setHeaderNavigationList(List<HeaderNavigation> headerNavigationList) {
328 this.headerNavigationList = headerNavigationList;
329 }
330
331 public boolean isSessionDocument() {
332 return this.sessionDocument;
333 }
334
335 public void setSessionDocument(boolean sessionDocument) {
336 this.sessionDocument = sessionDocument;
337 }
338
339
340
341
342
343
344
345
346
347
348 public Class<? extends DocumentPresentationController> getDocumentPresentationControllerClass() {
349 return this.documentPresentationControllerClass;
350 }
351
352
353
354
355 public void setDocumentPresentationControllerClass(
356 Class<? extends DocumentPresentationController> documentPresentationControllerClass) {
357 this.documentPresentationControllerClass = documentPresentationControllerClass;
358 }
359
360
361
362
363 public Class<? extends DerivedValuesSetter> getDerivedValuesSetterClass() {
364 return this.derivedValuesSetterClass;
365 }
366
367
368
369
370 public void setDerivedValuesSetterClass(Class<? extends DerivedValuesSetter> derivedValuesSetter) {
371 this.derivedValuesSetterClass = derivedValuesSetter;
372 }
373 }