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