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