1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.krad.rules; |
18 | |
|
19 | |
import org.apache.commons.lang.StringUtils; |
20 | |
import org.kuali.rice.core.api.config.property.ConfigurationService; |
21 | |
import org.kuali.rice.core.api.datetime.DateTimeService; |
22 | |
import org.kuali.rice.core.util.RiceKeyConstants; |
23 | |
import org.kuali.rice.core.web.format.Formatter; |
24 | |
import org.kuali.rice.kew.api.WorkflowDocument; |
25 | |
import org.kuali.rice.kim.api.role.RoleService; |
26 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
27 | |
import org.kuali.rice.krad.bo.GlobalBusinessObject; |
28 | |
import org.kuali.rice.core.api.CoreApiServiceLocator; |
29 | |
import org.kuali.rice.krad.bo.Inactivatable; |
30 | |
import org.kuali.rice.krad.bo.PersistableBusinessObject; |
31 | |
import org.kuali.rice.krad.datadictionary.InactivationBlockingMetadata; |
32 | |
import org.kuali.rice.krad.document.Document; |
33 | |
import org.kuali.rice.krad.document.MaintenanceDocument; |
34 | |
import org.kuali.rice.krad.document.authorization.MaintenanceDocumentAuthorizer; |
35 | |
import org.kuali.rice.krad.exception.ValidationException; |
36 | |
import org.kuali.rice.krad.maintenance.Maintainable; |
37 | |
import org.kuali.rice.krad.rule.event.ApproveDocumentEvent; |
38 | |
import org.kuali.rice.krad.service.BusinessObjectService; |
39 | |
import org.kuali.rice.krad.service.DataDictionaryService; |
40 | |
import org.kuali.rice.krad.service.DataObjectAuthorizationService; |
41 | |
import org.kuali.rice.krad.service.DataObjectMetaDataService; |
42 | |
import org.kuali.rice.krad.service.DictionaryValidationService; |
43 | |
import org.kuali.rice.krad.service.DocumentDictionaryService; |
44 | |
import org.kuali.rice.krad.service.DocumentHelperService; |
45 | |
import org.kuali.rice.krad.service.InactivationBlockingDetectionService; |
46 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
47 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
48 | |
import org.kuali.rice.krad.service.PersistenceStructureService; |
49 | |
import org.kuali.rice.krad.util.ErrorMessage; |
50 | |
import org.kuali.rice.krad.util.ForeignKeyFieldsPopulationState; |
51 | |
import org.kuali.rice.krad.util.GlobalVariables; |
52 | |
import org.kuali.rice.krad.util.KRADConstants; |
53 | |
import org.kuali.rice.krad.util.KRADPropertyConstants; |
54 | |
import org.kuali.rice.krad.util.ObjectUtils; |
55 | |
import org.kuali.rice.krad.util.UrlFactory; |
56 | |
import org.kuali.rice.krad.workflow.service.WorkflowDocumentService; |
57 | |
import org.springframework.util.AutoPopulatingList; |
58 | |
|
59 | |
import java.security.GeneralSecurityException; |
60 | |
import java.util.ArrayList; |
61 | |
import java.util.Iterator; |
62 | |
import java.util.List; |
63 | |
import java.util.Map; |
64 | |
import java.util.Properties; |
65 | |
import java.util.Set; |
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
public class MaintenanceDocumentRuleBase extends DocumentRuleBase implements MaintenanceDocumentRule { |
73 | 0 | protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(MaintenanceDocumentRuleBase.class); |
74 | |
|
75 | |
|
76 | |
|
77 | |
public static final String MAINTAINABLE_ERROR_PREFIX = KRADConstants.MAINTENANCE_NEW_MAINTAINABLE; |
78 | |
public static final String DOCUMENT_ERROR_PREFIX = "document."; |
79 | |
public static final String MAINTAINABLE_ERROR_PATH = DOCUMENT_ERROR_PREFIX + "newMaintainableObject"; |
80 | |
|
81 | |
private PersistenceStructureService persistenceStructureService; |
82 | |
private DataDictionaryService ddService; |
83 | |
private DocumentHelperService documentHelperService; |
84 | |
private BusinessObjectService boService; |
85 | |
private DictionaryValidationService dictionaryValidationService; |
86 | |
private ConfigurationService configService; |
87 | |
private WorkflowDocumentService workflowDocumentService; |
88 | |
private org.kuali.rice.kim.service.PersonService personService; |
89 | |
private RoleService roleService; |
90 | |
private DataObjectMetaDataService dataObjectMetaDataService; |
91 | |
private DataObjectAuthorizationService dataObjectAuthorizationService; |
92 | |
private DocumentDictionaryService documentDictionaryService; |
93 | |
|
94 | |
private Object oldDataObject; |
95 | |
private Object newDataObject; |
96 | |
private Class dataObjectClass; |
97 | |
|
98 | |
protected List priorErrorPath; |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | 0 | public MaintenanceDocumentRuleBase() { |
104 | 0 | priorErrorPath = new ArrayList(); |
105 | 0 | } |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
@Override |
111 | |
public boolean processSaveDocument(Document document) { |
112 | 0 | MaintenanceDocument maintenanceDocument = (MaintenanceDocument) document; |
113 | |
|
114 | |
|
115 | |
|
116 | 0 | clearErrorPath(); |
117 | |
|
118 | |
|
119 | 0 | setupBaseConvenienceObjects(maintenanceDocument); |
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | 0 | if (!isDocumentValidForSave(maintenanceDocument)) { |
126 | 0 | resumeErrorPath(); |
127 | 0 | return false; |
128 | |
} |
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | 0 | processCustomSaveDocumentBusinessRules(maintenanceDocument); |
134 | |
|
135 | |
|
136 | 0 | resumeErrorPath(); |
137 | |
|
138 | |
|
139 | |
|
140 | 0 | return true; |
141 | |
} |
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
@Override |
147 | |
public boolean processRouteDocument(Document document) { |
148 | 0 | LOG.info("processRouteDocument called"); |
149 | |
|
150 | 0 | MaintenanceDocument maintenanceDocument = (MaintenanceDocument) document; |
151 | |
|
152 | |
|
153 | 0 | MaintenanceDocumentAuthorizer documentAuthorizer = |
154 | |
(MaintenanceDocumentAuthorizer) getDocumentHelperService().getDocumentAuthorizer(document); |
155 | |
|
156 | |
|
157 | |
|
158 | 0 | clearErrorPath(); |
159 | |
|
160 | |
|
161 | 0 | setupBaseConvenienceObjects(maintenanceDocument); |
162 | |
|
163 | |
|
164 | 0 | processGlobalSaveDocumentBusinessRules(maintenanceDocument); |
165 | |
|
166 | |
|
167 | |
|
168 | 0 | boolean success = true; |
169 | |
|
170 | 0 | WorkflowDocument workflowDocument = document.getDocumentHeader().getWorkflowDocument(); |
171 | 0 | if (workflowDocument.isInitiated() || workflowDocument.isSaved()){ |
172 | 0 | success &= documentAuthorizer.canCreateOrMaintain((MaintenanceDocument)document, GlobalVariables.getUserSession().getPerson()); |
173 | 0 | if (success == false) { |
174 | 0 | GlobalVariables.getMessageMap() |
175 | |
.putError(KRADConstants.DOCUMENT_ERRORS, RiceKeyConstants.AUTHORIZATION_ERROR_DOCUMENT, |
176 | |
new String[]{GlobalVariables.getUserSession().getPerson().getPrincipalName(), |
177 | |
"Create/Maintain", getDocumentDictionaryService() |
178 | |
.getMaintenanceDocumentTypeName(newDataObject.getClass())}); |
179 | |
} |
180 | |
} |
181 | |
|
182 | 0 | success &= processGlobalRouteDocumentBusinessRules(maintenanceDocument); |
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | 0 | success &= processCustomRouteDocumentBusinessRules(maintenanceDocument); |
188 | |
|
189 | 0 | success &= processInactivationBlockChecking(maintenanceDocument); |
190 | |
|
191 | |
|
192 | |
|
193 | 0 | resumeErrorPath(); |
194 | |
|
195 | 0 | return success; |
196 | |
} |
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
protected boolean isDocumentInactivatingBusinessObject(MaintenanceDocument maintenanceDocument) { |
205 | 0 | if (maintenanceDocument.isEdit()) { |
206 | 0 | Class dataObjectClass = maintenanceDocument.getNewMaintainableObject().getDataObjectClass(); |
207 | |
|
208 | 0 | if (dataObjectClass != null && Inactivatable.class.isAssignableFrom(dataObjectClass)) { |
209 | 0 | Inactivatable oldInactivateableBO = (Inactivatable) oldDataObject; |
210 | 0 | Inactivatable newInactivateableBO = (Inactivatable) newDataObject; |
211 | |
|
212 | 0 | return oldInactivateableBO.isActive() && !newInactivateableBO.isActive(); |
213 | |
} |
214 | |
} |
215 | 0 | return false; |
216 | |
} |
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument) { |
225 | 0 | if (isDocumentInactivatingBusinessObject(maintenanceDocument)) { |
226 | 0 | Class dataObjectClass = maintenanceDocument.getNewMaintainableObject().getDataObjectClass(); |
227 | 0 | Set<InactivationBlockingMetadata> inactivationBlockingMetadatas = |
228 | |
ddService.getAllInactivationBlockingDefinitions(dataObjectClass); |
229 | |
|
230 | 0 | if (inactivationBlockingMetadatas != null) { |
231 | 0 | for (InactivationBlockingMetadata inactivationBlockingMetadata : inactivationBlockingMetadatas) { |
232 | |
|
233 | |
|
234 | |
|
235 | 0 | if (!processInactivationBlockChecking(maintenanceDocument, inactivationBlockingMetadata)) { |
236 | 0 | return false; |
237 | |
} |
238 | |
} |
239 | |
} |
240 | |
} |
241 | 0 | return true; |
242 | |
} |
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
protected boolean processInactivationBlockChecking(MaintenanceDocument maintenanceDocument, |
254 | |
InactivationBlockingMetadata inactivationBlockingMetadata) { |
255 | 0 | if (newDataObject instanceof PersistableBusinessObject) { |
256 | 0 | String inactivationBlockingDetectionServiceBeanName = |
257 | |
inactivationBlockingMetadata.getInactivationBlockingDetectionServiceBeanName(); |
258 | 0 | if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) { |
259 | 0 | inactivationBlockingDetectionServiceBeanName = |
260 | |
KRADServiceLocatorWeb.DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE; |
261 | |
} |
262 | 0 | InactivationBlockingDetectionService inactivationBlockingDetectionService = KRADServiceLocatorWeb |
263 | |
.getInactivationBlockingDetectionService(inactivationBlockingDetectionServiceBeanName); |
264 | |
|
265 | 0 | boolean foundBlockingRecord = inactivationBlockingDetectionService |
266 | |
.hasABlockingRecord((PersistableBusinessObject) newDataObject, inactivationBlockingMetadata); |
267 | |
|
268 | 0 | if (foundBlockingRecord) { |
269 | 0 | putInactivationBlockingErrorOnPage(maintenanceDocument, inactivationBlockingMetadata); |
270 | |
} |
271 | |
|
272 | 0 | return !foundBlockingRecord; |
273 | |
} |
274 | |
|
275 | 0 | return true; |
276 | |
} |
277 | |
|
278 | |
|
279 | |
|
280 | |
|
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
protected void putInactivationBlockingErrorOnPage(MaintenanceDocument document, |
286 | |
InactivationBlockingMetadata inactivationBlockingMetadata) { |
287 | 0 | if (!persistenceStructureService.hasPrimaryKeyFieldValues(newDataObject)) { |
288 | 0 | throw new RuntimeException("Maintenance document did not have all primary key values filled in."); |
289 | |
} |
290 | 0 | Properties parameters = new Properties(); |
291 | 0 | parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, |
292 | |
inactivationBlockingMetadata.getBlockedBusinessObjectClass().getName()); |
293 | 0 | parameters |
294 | |
.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.METHOD_DISPLAY_ALL_INACTIVATION_BLOCKERS); |
295 | |
|
296 | 0 | List keys = new ArrayList(); |
297 | 0 | if (getPersistenceStructureService().isPersistable(newDataObject.getClass())) { |
298 | 0 | keys = getPersistenceStructureService().listPrimaryKeyFieldNames(newDataObject.getClass()); |
299 | |
} |
300 | |
|
301 | |
|
302 | 0 | String keyName = null; |
303 | 0 | for (Iterator iter = keys.iterator(); iter.hasNext(); ) { |
304 | 0 | keyName = (String) iter.next(); |
305 | |
|
306 | 0 | Object keyValue = null; |
307 | 0 | if (keyName != null) { |
308 | 0 | keyValue = ObjectUtils.getPropertyValue(newDataObject, keyName); |
309 | |
} |
310 | |
|
311 | 0 | if (keyValue == null) { |
312 | 0 | keyValue = ""; |
313 | 0 | } else if (keyValue instanceof java.sql.Date) { |
314 | 0 | if (Formatter.findFormatter(keyValue.getClass()) != null) { |
315 | 0 | Formatter formatter = Formatter.getFormatter(keyValue.getClass()); |
316 | 0 | keyValue = (String) formatter.format(keyValue); |
317 | 0 | } |
318 | |
} else { |
319 | 0 | keyValue = keyValue.toString(); |
320 | |
} |
321 | |
|
322 | |
|
323 | 0 | if (getDataObjectAuthorizationService().attributeValueNeedsToBeEncryptedOnFormsAndLinks( |
324 | |
inactivationBlockingMetadata.getBlockedBusinessObjectClass(), keyName)){ |
325 | |
try { |
326 | 0 | keyValue = CoreApiServiceLocator.getEncryptionService().encrypt(keyValue); |
327 | 0 | } catch (GeneralSecurityException e) { |
328 | 0 | LOG.error("Exception while trying to encrypted value for inquiry framework.", e); |
329 | 0 | throw new RuntimeException(e); |
330 | 0 | } |
331 | |
} |
332 | |
|
333 | 0 | parameters.put(keyName, keyValue); |
334 | 0 | } |
335 | |
|
336 | 0 | String blockingUrl = |
337 | |
UrlFactory.parameterizeUrl(KRADConstants.DISPLAY_ALL_INACTIVATION_BLOCKERS_ACTION, parameters); |
338 | |
|
339 | |
|
340 | 0 | GlobalVariables.getMessageMap() |
341 | |
.putError(KRADConstants.GLOBAL_ERRORS, RiceKeyConstants.ERROR_INACTIVATION_BLOCKED, blockingUrl); |
342 | 0 | } |
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
@Override |
348 | |
public boolean processApproveDocument(ApproveDocumentEvent approveEvent) { |
349 | 0 | MaintenanceDocument maintenanceDocument = (MaintenanceDocument) approveEvent.getDocument(); |
350 | |
|
351 | |
|
352 | |
|
353 | 0 | clearErrorPath(); |
354 | |
|
355 | |
|
356 | 0 | setupBaseConvenienceObjects(maintenanceDocument); |
357 | |
|
358 | |
|
359 | 0 | processGlobalSaveDocumentBusinessRules(maintenanceDocument); |
360 | |
|
361 | |
|
362 | |
|
363 | 0 | boolean success = true; |
364 | |
|
365 | |
|
366 | 0 | success &= processGlobalApproveDocumentBusinessRules(maintenanceDocument); |
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | 0 | success &= processCustomApproveDocumentBusinessRules(maintenanceDocument); |
372 | |
|
373 | |
|
374 | |
|
375 | 0 | resumeErrorPath(); |
376 | |
|
377 | 0 | return success; |
378 | |
} |
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
protected void putGlobalError(String errorConstant) { |
388 | 0 | if (!errorAlreadyExists(KRADConstants.DOCUMENT_ERRORS, errorConstant)) { |
389 | 0 | GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(KRADConstants.DOCUMENT_ERRORS, errorConstant); |
390 | |
} |
391 | 0 | } |
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
|
401 | |
protected void putGlobalError(String errorConstant, String parameter) { |
402 | 0 | if (!errorAlreadyExists(KRADConstants.DOCUMENT_ERRORS, errorConstant)) { |
403 | 0 | GlobalVariables.getMessageMap() |
404 | |
.putErrorWithoutFullErrorPath(KRADConstants.DOCUMENT_ERRORS, errorConstant, parameter); |
405 | |
} |
406 | 0 | } |
407 | |
|
408 | |
|
409 | |
|
410 | |
|
411 | |
|
412 | |
|
413 | |
|
414 | |
|
415 | |
|
416 | |
protected void putGlobalError(String errorConstant, String[] parameters) { |
417 | 0 | if (!errorAlreadyExists(KRADConstants.DOCUMENT_ERRORS, errorConstant)) { |
418 | 0 | GlobalVariables.getMessageMap() |
419 | |
.putErrorWithoutFullErrorPath(KRADConstants.DOCUMENT_ERRORS, errorConstant, parameters); |
420 | |
} |
421 | 0 | } |
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
protected void putFieldError(String propertyName, String errorConstant) { |
435 | 0 | if (!errorAlreadyExists(MAINTAINABLE_ERROR_PREFIX + propertyName, errorConstant)) { |
436 | 0 | GlobalVariables.getMessageMap() |
437 | |
.putErrorWithoutFullErrorPath(MAINTAINABLE_ERROR_PREFIX + propertyName, errorConstant); |
438 | |
} |
439 | 0 | } |
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
|
455 | |
|
456 | |
protected void putFieldError(String propertyName, String errorConstant, String parameter) { |
457 | 0 | if (!errorAlreadyExists(MAINTAINABLE_ERROR_PREFIX + propertyName, errorConstant)) { |
458 | 0 | GlobalVariables.getMessageMap() |
459 | |
.putErrorWithoutFullErrorPath(MAINTAINABLE_ERROR_PREFIX + propertyName, errorConstant, parameter); |
460 | |
} |
461 | 0 | } |
462 | |
|
463 | |
|
464 | |
|
465 | |
|
466 | |
|
467 | |
|
468 | |
|
469 | |
|
470 | |
|
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
|
477 | |
protected void putFieldError(String propertyName, String errorConstant, String[] parameters) { |
478 | 0 | if (!errorAlreadyExists(MAINTAINABLE_ERROR_PREFIX + propertyName, errorConstant)) { |
479 | 0 | GlobalVariables.getMessageMap() |
480 | |
.putErrorWithoutFullErrorPath(MAINTAINABLE_ERROR_PREFIX + propertyName, errorConstant, parameters); |
481 | |
} |
482 | 0 | } |
483 | |
|
484 | |
|
485 | |
|
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
protected void putFieldErrorWithShortLabel(String propertyName, String errorConstant) { |
493 | 0 | String shortLabel = ddService.getAttributeShortLabel(dataObjectClass, propertyName); |
494 | 0 | putFieldError(propertyName, errorConstant, shortLabel); |
495 | 0 | } |
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
|
506 | |
|
507 | |
|
508 | |
|
509 | |
|
510 | |
|
511 | |
|
512 | |
protected void putDocumentError(String propertyName, String errorConstant, String parameter) { |
513 | 0 | if (!errorAlreadyExists(DOCUMENT_ERROR_PREFIX + propertyName, errorConstant)) { |
514 | 0 | GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + propertyName, errorConstant, parameter); |
515 | |
} |
516 | 0 | } |
517 | |
|
518 | |
|
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
|
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
|
532 | |
protected void putDocumentError(String propertyName, String errorConstant, String[] parameters) { |
533 | 0 | GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + propertyName, errorConstant, parameters); |
534 | 0 | } |
535 | |
|
536 | |
|
537 | |
|
538 | |
|
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
|
545 | |
protected boolean errorAlreadyExists(String propertyName, String errorConstant) { |
546 | 0 | if (GlobalVariables.getMessageMap().fieldHasMessage(propertyName, errorConstant)) { |
547 | 0 | return true; |
548 | |
} else { |
549 | 0 | return false; |
550 | |
} |
551 | |
} |
552 | |
|
553 | |
|
554 | |
|
555 | |
|
556 | |
|
557 | |
|
558 | |
|
559 | |
|
560 | |
|
561 | |
protected void putGlobalsError(String propertyName, String errorConstant) { |
562 | 0 | if (!errorAlreadyExists(propertyName, errorConstant)) { |
563 | 0 | GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(propertyName, errorConstant); |
564 | |
} |
565 | 0 | } |
566 | |
|
567 | |
|
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
|
573 | |
|
574 | |
|
575 | |
|
576 | |
protected void putGlobalsError(String propertyName, String errorConstant, String parameter) { |
577 | 0 | if (!errorAlreadyExists(propertyName, errorConstant)) { |
578 | 0 | GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(propertyName, errorConstant, parameter); |
579 | |
} |
580 | 0 | } |
581 | |
|
582 | |
|
583 | |
|
584 | |
|
585 | |
|
586 | |
|
587 | |
|
588 | |
|
589 | |
|
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
protected void clearErrorPath() { |
595 | |
|
596 | 0 | priorErrorPath.addAll(GlobalVariables.getMessageMap().getErrorPath()); |
597 | |
|
598 | |
|
599 | 0 | GlobalVariables.getMessageMap().getErrorPath().clear(); |
600 | 0 | } |
601 | |
|
602 | |
|
603 | |
|
604 | |
|
605 | |
|
606 | |
|
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
|
612 | |
protected void resumeErrorPath() { |
613 | |
|
614 | |
|
615 | 0 | GlobalVariables.getMessageMap().getErrorPath().addAll(priorErrorPath); |
616 | 0 | } |
617 | |
|
618 | |
|
619 | |
|
620 | |
|
621 | |
|
622 | |
|
623 | |
|
624 | |
protected boolean dataDictionaryValidate(MaintenanceDocument document) { |
625 | 0 | LOG.debug("MaintenanceDocument validation beginning"); |
626 | |
|
627 | |
|
628 | |
|
629 | 0 | GlobalVariables.getMessageMap().addToErrorPath("document.newMaintainableObject"); |
630 | |
|
631 | |
|
632 | 0 | Maintainable newMaintainable = document.getNewMaintainableObject(); |
633 | 0 | if (newMaintainable == null) { |
634 | 0 | GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject"); |
635 | 0 | throw new ValidationException( |
636 | |
"Maintainable object from Maintenance Document '" + document.getDocumentTitle() + |
637 | |
"' is null, unable to proceed."); |
638 | |
} |
639 | |
|
640 | |
|
641 | 0 | Object dataObject = newMaintainable.getDataObject(); |
642 | 0 | if (dataObject == null) { |
643 | 0 | GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject."); |
644 | 0 | throw new ValidationException("Maintainable's component business object is null."); |
645 | |
} |
646 | |
|
647 | 0 | GlobalVariables.getMessageMap().addToErrorPath("dataObject"); |
648 | |
|
649 | 0 | dictionaryValidationService.validate(newDataObject); |
650 | |
|
651 | 0 | GlobalVariables.getMessageMap().removeFromErrorPath("dataObject"); |
652 | |
|
653 | |
|
654 | 0 | GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject"); |
655 | |
|
656 | 0 | LOG.debug("MaintenanceDocument validation ending"); |
657 | 0 | return true; |
658 | |
} |
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
|
666 | |
|
667 | |
|
668 | |
|
669 | |
|
670 | |
|
671 | |
|
672 | |
|
673 | |
|
674 | |
|
675 | |
|
676 | |
protected boolean primaryKeyCheck(MaintenanceDocument document) { |
677 | |
|
678 | 0 | boolean success = true; |
679 | 0 | Class<?> dataObjectClass = document.getNewMaintainableObject().getDataObjectClass(); |
680 | |
|
681 | 0 | Object oldBo = document.getOldMaintainableObject().getDataObject(); |
682 | 0 | Object newDataObject = document.getNewMaintainableObject().getDataObject(); |
683 | |
|
684 | |
|
685 | |
|
686 | |
|
687 | |
|
688 | |
|
689 | 0 | if (newDataObject instanceof GlobalBusinessObject) { |
690 | 0 | return success; |
691 | |
} |
692 | |
|
693 | |
|
694 | |
|
695 | 0 | if (document.isEdit()) { |
696 | 0 | if (!getDataObjectMetaDataService().equalsByPrimaryKeys(oldBo, newDataObject)) { |
697 | |
|
698 | 0 | putDocumentError(KRADConstants.DOCUMENT_ERRORS, |
699 | |
RiceKeyConstants.ERROR_DOCUMENT_MAINTENANCE_PRIMARY_KEYS_CHANGED_ON_EDIT, |
700 | |
getHumanReadablePrimaryKeyFieldNames(dataObjectClass)); |
701 | 0 | success &= false; |
702 | |
} |
703 | |
} |
704 | |
|
705 | |
|
706 | |
|
707 | 0 | else if (document.isNew()) { |
708 | |
|
709 | |
|
710 | 0 | if (newDataObject instanceof PersistableBusinessObject) { |
711 | |
|
712 | |
|
713 | 0 | Map<String, ?> newPkFields = getDataObjectMetaDataService().getPrimaryKeyFieldValues(newDataObject); |
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
|
720 | |
|
721 | 0 | PersistableBusinessObject testBo = boService |
722 | |
.findByPrimaryKey(dataObjectClass.asSubclass(PersistableBusinessObject.class), newPkFields); |
723 | |
|
724 | |
|
725 | |
|
726 | 0 | if (testBo != null) { |
727 | 0 | putDocumentError(KRADConstants.DOCUMENT_ERRORS, |
728 | |
RiceKeyConstants.ERROR_DOCUMENT_MAINTENANCE_KEYS_ALREADY_EXIST_ON_CREATE_NEW, |
729 | |
getHumanReadablePrimaryKeyFieldNames(dataObjectClass)); |
730 | 0 | success &= false; |
731 | |
} |
732 | |
} |
733 | |
} |
734 | |
|
735 | 0 | return success; |
736 | |
} |
737 | |
|
738 | |
|
739 | |
|
740 | |
|
741 | |
|
742 | |
|
743 | |
|
744 | |
|
745 | |
protected String getHumanReadablePrimaryKeyFieldNames(Class<?> dataObjectClass) { |
746 | 0 | String delim = ""; |
747 | 0 | StringBuffer pkFieldNames = new StringBuffer(); |
748 | |
|
749 | |
|
750 | 0 | List<String> pkFields = getDataObjectMetaDataService().listPrimaryKeyFieldNames(dataObjectClass); |
751 | 0 | for (Iterator<String> iter = pkFields.iterator(); iter.hasNext(); ) { |
752 | 0 | String pkFieldName = (String) iter.next(); |
753 | |
|
754 | |
|
755 | |
|
756 | 0 | String humanReadableFieldName = ddService.getAttributeLabel(dataObjectClass, pkFieldName); |
757 | |
|
758 | |
|
759 | 0 | pkFieldNames.append(delim + humanReadableFieldName); |
760 | |
|
761 | |
|
762 | 0 | if (delim.equalsIgnoreCase("")) { |
763 | 0 | delim = ", "; |
764 | |
} |
765 | 0 | } |
766 | |
|
767 | 0 | return pkFieldNames.toString(); |
768 | |
} |
769 | |
|
770 | |
|
771 | |
|
772 | |
|
773 | |
|
774 | |
|
775 | |
|
776 | |
|
777 | |
|
778 | |
|
779 | |
|
780 | |
|
781 | |
|
782 | |
protected boolean processGlobalApproveDocumentBusinessRules(MaintenanceDocument document) { |
783 | 0 | return true; |
784 | |
} |
785 | |
|
786 | |
|
787 | |
|
788 | |
|
789 | |
|
790 | |
|
791 | |
|
792 | |
|
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
|
798 | |
protected boolean processGlobalRouteDocumentBusinessRules(MaintenanceDocument document) { |
799 | 0 | boolean success = true; |
800 | |
|
801 | |
|
802 | 0 | success &= checkEmptyDocumentField( |
803 | |
KRADPropertyConstants.DOCUMENT_HEADER + "." + KRADPropertyConstants.DOCUMENT_DESCRIPTION, |
804 | |
document.getDocumentHeader().getDocumentDescription(), "Description"); |
805 | |
|
806 | 0 | return success; |
807 | |
} |
808 | |
|
809 | |
|
810 | |
|
811 | |
|
812 | |
|
813 | |
|
814 | |
|
815 | |
|
816 | |
|
817 | |
|
818 | |
|
819 | |
|
820 | |
|
821 | |
|
822 | |
|
823 | |
|
824 | |
|
825 | |
|
826 | |
|
827 | |
protected boolean processGlobalSaveDocumentBusinessRules(MaintenanceDocument document) { |
828 | |
|
829 | 0 | boolean success = true; |
830 | |
|
831 | |
|
832 | 0 | primaryKeyCheck(document); |
833 | |
|
834 | |
|
835 | |
|
836 | 0 | this.dataDictionaryValidate(document); |
837 | |
|
838 | 0 | return success; |
839 | |
} |
840 | |
|
841 | |
|
842 | |
|
843 | |
|
844 | |
|
845 | |
|
846 | |
|
847 | |
protected boolean processCustomSaveDocumentBusinessRules(MaintenanceDocument document) { |
848 | 0 | return true; |
849 | |
} |
850 | |
|
851 | |
|
852 | |
|
853 | |
|
854 | |
|
855 | |
|
856 | |
|
857 | |
protected boolean processCustomRouteDocumentBusinessRules(MaintenanceDocument document) { |
858 | 0 | return true; |
859 | |
} |
860 | |
|
861 | |
|
862 | |
|
863 | |
|
864 | |
|
865 | |
|
866 | |
|
867 | |
protected boolean processCustomApproveDocumentBusinessRules(MaintenanceDocument document) { |
868 | 0 | return true; |
869 | |
} |
870 | |
|
871 | |
|
872 | |
|
873 | |
|
874 | |
|
875 | |
|
876 | |
|
877 | |
|
878 | |
|
879 | |
|
880 | |
|
881 | |
|
882 | |
|
883 | |
|
884 | |
protected boolean isDocumentValidForSave(MaintenanceDocument maintenanceDocument) { |
885 | |
|
886 | 0 | boolean success = true; |
887 | |
|
888 | 0 | success &= super.isDocumentOverviewValid(maintenanceDocument); |
889 | 0 | success &= validateDocumentStructure((Document) maintenanceDocument); |
890 | 0 | success &= validateMaintenanceDocument(maintenanceDocument); |
891 | 0 | success &= validateGlobalBusinessObjectPersistable(maintenanceDocument); |
892 | 0 | return success; |
893 | |
} |
894 | |
|
895 | |
|
896 | |
|
897 | |
|
898 | |
|
899 | |
|
900 | |
|
901 | |
|
902 | |
|
903 | |
|
904 | |
|
905 | |
protected boolean validateDocumentStructure(Document document) { |
906 | 0 | boolean success = true; |
907 | |
|
908 | |
|
909 | 0 | String documentHeaderId = document.getDocumentNumber(); |
910 | 0 | if (documentHeaderId == null || StringUtils.isEmpty(documentHeaderId)) { |
911 | 0 | throw new ValidationException("Document has no document number, unable to proceed."); |
912 | |
} |
913 | |
|
914 | 0 | return success; |
915 | |
} |
916 | |
|
917 | |
|
918 | |
|
919 | |
|
920 | |
|
921 | |
|
922 | |
|
923 | |
|
924 | |
|
925 | |
|
926 | |
|
927 | |
|
928 | |
protected boolean validateMaintenanceDocument(MaintenanceDocument maintenanceDocument) { |
929 | 0 | boolean success = true; |
930 | 0 | Maintainable newMaintainable = maintenanceDocument.getNewMaintainableObject(); |
931 | |
|
932 | |
|
933 | 0 | if (newMaintainable == null) { |
934 | 0 | throw new ValidationException( |
935 | |
"Maintainable object from Maintenance Document '" + maintenanceDocument.getDocumentTitle() + |
936 | |
"' is null, unable to proceed."); |
937 | |
} |
938 | |
|
939 | |
|
940 | 0 | if (newMaintainable.getDataObject() == null) { |
941 | 0 | throw new ValidationException("Maintainable's component data object is null."); |
942 | |
} |
943 | |
|
944 | 0 | return success; |
945 | |
} |
946 | |
|
947 | |
|
948 | |
|
949 | |
|
950 | |
|
951 | |
|
952 | |
|
953 | |
|
954 | |
|
955 | |
|
956 | |
|
957 | |
|
958 | |
|
959 | |
|
960 | |
protected boolean validateGlobalBusinessObjectPersistable(MaintenanceDocument document) { |
961 | 0 | boolean success = true; |
962 | |
|
963 | 0 | if (document.getNewMaintainableObject() == null) { |
964 | 0 | return success; |
965 | |
} |
966 | 0 | if (document.getNewMaintainableObject().getDataObject() == null) { |
967 | 0 | return success; |
968 | |
} |
969 | 0 | if (!(document.getNewMaintainableObject().getDataObject() instanceof GlobalBusinessObject)) { |
970 | 0 | return success; |
971 | |
} |
972 | |
|
973 | 0 | PersistableBusinessObject bo = (PersistableBusinessObject) document.getNewMaintainableObject().getDataObject(); |
974 | 0 | GlobalBusinessObject gbo = (GlobalBusinessObject) bo; |
975 | 0 | return gbo.isPersistable(); |
976 | |
} |
977 | |
|
978 | |
|
979 | |
|
980 | |
|
981 | |
|
982 | |
|
983 | |
|
984 | |
|
985 | |
|
986 | |
|
987 | |
protected boolean isCorrectMaintenanceClass(MaintenanceDocument document, Class clazz) { |
988 | |
|
989 | 0 | if (document == null || clazz == null) { |
990 | 0 | throw new IllegalArgumentException("Null arguments were passed in."); |
991 | |
} |
992 | |
|
993 | |
|
994 | 0 | if (clazz.toString().equals(document.getNewMaintainableObject().getDataObjectClass().toString())) { |
995 | 0 | return true; |
996 | |
} else { |
997 | 0 | return false; |
998 | |
} |
999 | |
} |
1000 | |
|
1001 | |
|
1002 | |
|
1003 | |
|
1004 | |
|
1005 | |
|
1006 | |
|
1007 | |
|
1008 | |
|
1009 | |
|
1010 | |
|
1011 | |
|
1012 | |
protected boolean checkEmptyBOField(String propertyName, Object valueToTest, String parameter) { |
1013 | 0 | boolean success = true; |
1014 | |
|
1015 | 0 | success = checkEmptyValue(valueToTest); |
1016 | |
|
1017 | |
|
1018 | 0 | if (!success) { |
1019 | 0 | putFieldError(propertyName, RiceKeyConstants.ERROR_REQUIRED, parameter); |
1020 | |
} |
1021 | |
|
1022 | 0 | return success; |
1023 | |
} |
1024 | |
|
1025 | |
|
1026 | |
|
1027 | |
|
1028 | |
|
1029 | |
|
1030 | |
|
1031 | |
|
1032 | |
|
1033 | |
|
1034 | |
|
1035 | |
|
1036 | |
|
1037 | |
protected boolean checkEmptyDocumentField(String propertyName, Object valueToTest, String parameter) { |
1038 | 0 | boolean success = true; |
1039 | 0 | success = checkEmptyValue(valueToTest); |
1040 | 0 | if (!success) { |
1041 | 0 | putDocumentError(propertyName, RiceKeyConstants.ERROR_REQUIRED, parameter); |
1042 | |
} |
1043 | 0 | return success; |
1044 | |
} |
1045 | |
|
1046 | |
|
1047 | |
|
1048 | |
|
1049 | |
|
1050 | |
|
1051 | |
|
1052 | |
|
1053 | |
|
1054 | |
|
1055 | |
|
1056 | |
protected boolean checkEmptyValue(Object valueToTest) { |
1057 | 0 | boolean success = true; |
1058 | |
|
1059 | |
|
1060 | 0 | if (valueToTest == null) { |
1061 | 0 | success = false; |
1062 | |
} else { |
1063 | |
|
1064 | 0 | if (valueToTest instanceof String) { |
1065 | 0 | if (StringUtils.isBlank((String) valueToTest)) { |
1066 | 0 | success = false; |
1067 | |
} |
1068 | |
} |
1069 | |
} |
1070 | |
|
1071 | 0 | return success; |
1072 | |
} |
1073 | |
|
1074 | |
|
1075 | |
|
1076 | |
|
1077 | |
|
1078 | |
|
1079 | |
protected void showErrorMap() { |
1080 | 0 | if (GlobalVariables.getMessageMap().hasNoErrors()) { |
1081 | 0 | return; |
1082 | |
} |
1083 | |
|
1084 | 0 | for (Iterator i = GlobalVariables.getMessageMap().getAllPropertiesAndErrors().iterator(); i.hasNext(); ) { |
1085 | 0 | Map.Entry e = (Map.Entry) i.next(); |
1086 | |
|
1087 | 0 | AutoPopulatingList errorList = (AutoPopulatingList) e.getValue(); |
1088 | 0 | for (Iterator j = errorList.iterator(); j.hasNext(); ) { |
1089 | 0 | ErrorMessage em = (ErrorMessage) j.next(); |
1090 | |
|
1091 | 0 | if (em.getMessageParameters() == null) { |
1092 | 0 | LOG.error(e.getKey().toString() + " = " + em.getErrorKey()); |
1093 | |
} else { |
1094 | 0 | LOG.error(e.getKey().toString() + " = " + em.getErrorKey() + " : " + |
1095 | |
em.getMessageParameters().toString()); |
1096 | |
} |
1097 | 0 | } |
1098 | 0 | } |
1099 | 0 | } |
1100 | |
|
1101 | |
|
1102 | |
|
1103 | |
|
1104 | |
public void setupBaseConvenienceObjects(MaintenanceDocument document) { |
1105 | |
|
1106 | 0 | oldDataObject = document.getOldMaintainableObject().getDataObject(); |
1107 | 0 | if (oldDataObject != null && oldDataObject instanceof PersistableBusinessObject) { |
1108 | 0 | ((PersistableBusinessObject) oldDataObject).refreshNonUpdateableReferences(); |
1109 | |
} |
1110 | |
|
1111 | |
|
1112 | 0 | newDataObject = document.getNewMaintainableObject().getDataObject(); |
1113 | 0 | if (newDataObject instanceof PersistableBusinessObject) { |
1114 | 0 | ((PersistableBusinessObject) newDataObject).refreshNonUpdateableReferences(); |
1115 | |
} |
1116 | |
|
1117 | 0 | dataObjectClass = document.getNewMaintainableObject().getDataObjectClass(); |
1118 | |
|
1119 | |
|
1120 | 0 | setupConvenienceObjects(); |
1121 | 0 | } |
1122 | |
|
1123 | |
public void setupConvenienceObjects() { |
1124 | |
|
1125 | 0 | } |
1126 | |
|
1127 | |
|
1128 | |
|
1129 | |
|
1130 | |
|
1131 | |
|
1132 | |
|
1133 | |
|
1134 | |
|
1135 | |
|
1136 | |
|
1137 | |
protected boolean checkForPartiallyFilledOutReferenceForeignKeys(String referenceName) { |
1138 | 0 | boolean success = true; |
1139 | |
|
1140 | 0 | if (newDataObject instanceof PersistableBusinessObject) { |
1141 | |
ForeignKeyFieldsPopulationState fkFieldsState; |
1142 | 0 | fkFieldsState = getPersistenceStructureService() |
1143 | |
.getForeignKeyFieldsPopulationState((PersistableBusinessObject) newDataObject, referenceName); |
1144 | |
|
1145 | |
|
1146 | 0 | if (fkFieldsState.isAnyFieldsPopulated() && !fkFieldsState.isAllFieldsPopulated()) { |
1147 | 0 | success = false; |
1148 | |
|
1149 | |
|
1150 | |
|
1151 | |
|
1152 | 0 | List fKeys = new ArrayList(getPersistenceStructureService().getForeignKeysForReference( |
1153 | |
newDataObject.getClass().asSubclass(PersistableBusinessObject.class), referenceName).keySet()); |
1154 | 0 | String fKeysReadable = consolidateFieldNames(fKeys, ", ").toString(); |
1155 | |
|
1156 | |
|
1157 | 0 | for (Iterator iter = fkFieldsState.getUnpopulatedFieldNames().iterator(); iter.hasNext(); ) { |
1158 | 0 | String fieldName = (String) iter.next(); |
1159 | |
|
1160 | |
|
1161 | 0 | String fieldNameReadable = ddService.getAttributeLabel(newDataObject.getClass(), fieldName); |
1162 | |
|
1163 | |
|
1164 | 0 | putFieldError(fieldName, RiceKeyConstants.ERROR_DOCUMENT_MAINTENANCE_PARTIALLY_FILLED_OUT_REF_FKEYS, |
1165 | |
new String[]{fieldNameReadable, fKeysReadable}); |
1166 | 0 | } |
1167 | |
} |
1168 | |
} |
1169 | |
|
1170 | 0 | return success; |
1171 | |
} |
1172 | |
|
1173 | |
|
1174 | |
|
1175 | |
|
1176 | |
|
1177 | |
|
1178 | |
|
1179 | |
protected StringBuffer consolidateFieldNames(List fieldNames, String delimiter) { |
1180 | 0 | StringBuffer sb = new StringBuffer(); |
1181 | |
|
1182 | |
|
1183 | 0 | boolean firstPass = true; |
1184 | 0 | String delim = ""; |
1185 | |
|
1186 | |
|
1187 | 0 | for (Iterator iter = fieldNames.iterator(); iter.hasNext(); ) { |
1188 | 0 | String fieldName = (String) iter.next(); |
1189 | |
|
1190 | |
|
1191 | |
|
1192 | 0 | sb.append(delim + ddService.getAttributeLabel(newDataObject.getClass(), fieldName)); |
1193 | |
|
1194 | |
|
1195 | 0 | if (firstPass) { |
1196 | 0 | delim = delimiter; |
1197 | 0 | firstPass = false; |
1198 | |
} |
1199 | 0 | } |
1200 | |
|
1201 | 0 | return sb; |
1202 | |
} |
1203 | |
|
1204 | |
|
1205 | |
|
1206 | |
|
1207 | |
|
1208 | |
|
1209 | |
|
1210 | |
|
1211 | |
|
1212 | |
protected String getFieldLabel(String fieldName) { |
1213 | 0 | return ddService.getAttributeLabel(newDataObject.getClass(), fieldName) + "(" + |
1214 | |
ddService.getAttributeShortLabel(newDataObject.getClass(), fieldName) + ")"; |
1215 | |
} |
1216 | |
|
1217 | |
|
1218 | |
|
1219 | |
|
1220 | |
|
1221 | |
|
1222 | |
|
1223 | |
|
1224 | |
|
1225 | |
|
1226 | |
protected String getFieldLabel(Class dataObjectClass, String fieldName) { |
1227 | 0 | return ddService.getAttributeLabel(dataObjectClass, fieldName) + "(" + |
1228 | |
ddService.getAttributeShortLabel(dataObjectClass, fieldName) + ")"; |
1229 | |
} |
1230 | |
|
1231 | |
|
1232 | |
|
1233 | |
|
1234 | |
|
1235 | |
|
1236 | |
protected final Object getNewDataObject() { |
1237 | 0 | return newDataObject; |
1238 | |
} |
1239 | |
|
1240 | |
protected void setNewDataObject(Object newDataObject) { |
1241 | 0 | this.newDataObject = newDataObject; |
1242 | 0 | } |
1243 | |
|
1244 | |
|
1245 | |
|
1246 | |
|
1247 | |
|
1248 | |
|
1249 | |
protected final Object getOldDataObject() { |
1250 | 0 | return oldDataObject; |
1251 | |
} |
1252 | |
|
1253 | |
public boolean processCustomAddCollectionLineBusinessRules(MaintenanceDocument document, String collectionName, |
1254 | |
PersistableBusinessObject line) { |
1255 | 0 | return true; |
1256 | |
} |
1257 | |
|
1258 | |
protected final BusinessObjectService getBoService() { |
1259 | 0 | if (boService == null) { |
1260 | 0 | this.boService = KRADServiceLocator.getBusinessObjectService(); |
1261 | |
} |
1262 | 0 | return boService; |
1263 | |
} |
1264 | |
|
1265 | |
public final void setBoService(BusinessObjectService boService) { |
1266 | 0 | this.boService = boService; |
1267 | 0 | } |
1268 | |
|
1269 | |
protected final ConfigurationService getConfigService() { |
1270 | 0 | if (configService == null) { |
1271 | 0 | this.configService = KRADServiceLocator.getKualiConfigurationService(); |
1272 | |
} |
1273 | 0 | return configService; |
1274 | |
} |
1275 | |
|
1276 | |
public final void setConfigService(ConfigurationService configService) { |
1277 | 0 | this.configService = configService; |
1278 | 0 | } |
1279 | |
|
1280 | |
protected final DataDictionaryService getDdService() { |
1281 | 0 | if (ddService == null) { |
1282 | 0 | this.ddService = KRADServiceLocatorWeb.getDataDictionaryService(); |
1283 | |
} |
1284 | 0 | return ddService; |
1285 | |
} |
1286 | |
|
1287 | |
public final void setDdService(DataDictionaryService ddService) { |
1288 | 0 | this.ddService = ddService; |
1289 | 0 | } |
1290 | |
|
1291 | |
protected final DictionaryValidationService getDictionaryValidationService() { |
1292 | 0 | if (dictionaryValidationService == null) { |
1293 | 0 | this.dictionaryValidationService = KRADServiceLocatorWeb.getDictionaryValidationService(); |
1294 | |
} |
1295 | 0 | return dictionaryValidationService; |
1296 | |
} |
1297 | |
|
1298 | |
public final void setDictionaryValidationService(DictionaryValidationService dictionaryValidationService) { |
1299 | 0 | this.dictionaryValidationService = dictionaryValidationService; |
1300 | 0 | } |
1301 | |
public org.kuali.rice.kim.service.PersonService getPersonService() { |
1302 | 0 | if (personService == null) { |
1303 | 0 | this.personService = KimApiServiceLocator.getPersonService(); |
1304 | |
} |
1305 | 0 | return personService; |
1306 | |
} |
1307 | |
|
1308 | |
public void setPersonService(org.kuali.rice.kim.service.PersonService personService) { |
1309 | 0 | this.personService = personService; |
1310 | 0 | } |
1311 | |
|
1312 | |
public DateTimeService getDateTimeService() { |
1313 | 0 | return CoreApiServiceLocator.getDateTimeService(); |
1314 | |
} |
1315 | |
|
1316 | |
public DocumentHelperService getDocumentHelperService() { |
1317 | 0 | if (documentHelperService == null) { |
1318 | 0 | this.documentHelperService = KRADServiceLocatorWeb.getDocumentHelperService(); |
1319 | |
} |
1320 | 0 | return this.documentHelperService; |
1321 | |
} |
1322 | |
|
1323 | |
public void setDocumentHelperService(DocumentHelperService documentHelperService) { |
1324 | 0 | this.documentHelperService = documentHelperService; |
1325 | 0 | } |
1326 | |
|
1327 | |
protected RoleService getRoleService() { |
1328 | 0 | if (this.roleService == null) { |
1329 | 0 | this.roleService = KimApiServiceLocator.getRoleService(); |
1330 | |
} |
1331 | 0 | return this.roleService; |
1332 | |
} |
1333 | |
|
1334 | |
protected DataObjectMetaDataService getDataObjectMetaDataService() { |
1335 | 0 | if (dataObjectMetaDataService == null) { |
1336 | 0 | this.dataObjectMetaDataService = KRADServiceLocatorWeb.getDataObjectMetaDataService(); |
1337 | |
} |
1338 | 0 | return dataObjectMetaDataService; |
1339 | |
} |
1340 | |
|
1341 | |
public void setDataObjectMetaDataService(DataObjectMetaDataService dataObjectMetaDataService) { |
1342 | 0 | this.dataObjectMetaDataService = dataObjectMetaDataService; |
1343 | 0 | } |
1344 | |
|
1345 | |
protected final PersistenceStructureService getPersistenceStructureService() { |
1346 | 0 | if (persistenceStructureService == null) { |
1347 | 0 | this.persistenceStructureService = KRADServiceLocator.getPersistenceStructureService(); |
1348 | |
} |
1349 | 0 | return persistenceStructureService; |
1350 | |
} |
1351 | |
|
1352 | |
public final void setPersistenceStructureService(PersistenceStructureService persistenceStructureService) { |
1353 | 0 | this.persistenceStructureService = persistenceStructureService; |
1354 | 0 | } |
1355 | |
|
1356 | |
public WorkflowDocumentService getWorkflowDocumentService() { |
1357 | 0 | if (workflowDocumentService == null) { |
1358 | 0 | this.workflowDocumentService = KRADServiceLocatorWeb.getWorkflowDocumentService(); |
1359 | |
} |
1360 | 0 | return workflowDocumentService; |
1361 | |
} |
1362 | |
|
1363 | |
public void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService) { |
1364 | 0 | this.workflowDocumentService = workflowDocumentService; |
1365 | 0 | } |
1366 | |
|
1367 | |
public DataObjectAuthorizationService getDataObjectAuthorizationService() { |
1368 | 0 | if (dataObjectAuthorizationService == null) { |
1369 | 0 | this.dataObjectAuthorizationService = KRADServiceLocatorWeb.getDataObjectAuthorizationService(); |
1370 | |
} |
1371 | 0 | return dataObjectAuthorizationService; |
1372 | |
} |
1373 | |
|
1374 | |
public void setDataObjectAuthorizationService(DataObjectAuthorizationService dataObjectAuthorizationService) { |
1375 | 0 | this.dataObjectAuthorizationService = dataObjectAuthorizationService; |
1376 | 0 | } |
1377 | |
|
1378 | |
public DocumentDictionaryService getDocumentDictionaryService() { |
1379 | 0 | if (documentDictionaryService == null) { |
1380 | 0 | this.documentDictionaryService = KRADServiceLocatorWeb.getDocumentDictionaryService(); |
1381 | |
} |
1382 | 0 | return documentDictionaryService; |
1383 | |
} |
1384 | |
|
1385 | |
public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService) { |
1386 | 0 | this.documentDictionaryService = documentDictionaryService; |
1387 | 0 | } |
1388 | |
} |
1389 | |
|