1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.web.controller;
17
18 import org.apache.commons.lang.ArrayUtils;
19 import org.apache.commons.lang.StringUtils;
20 import org.kuali.rice.core.api.config.property.ConfigurationService;
21 import org.kuali.rice.core.api.exception.RiceRuntimeException;
22 import org.kuali.rice.core.api.util.RiceKeyConstants;
23 import org.kuali.rice.core.framework.parameter.ParameterConstants;
24 import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator;
25 import org.kuali.rice.kew.api.KewApiConstants;
26 import org.kuali.rice.kew.api.WorkflowDocument;
27 import org.kuali.rice.kew.api.exception.WorkflowException;
28 import org.kuali.rice.kim.api.identity.Person;
29 import org.kuali.rice.krad.bo.AdHocRouteRecipient;
30 import org.kuali.rice.krad.bo.Attachment;
31 import org.kuali.rice.krad.bo.DocumentHeader;
32 import org.kuali.rice.krad.bo.Note;
33 import org.kuali.rice.krad.document.Document;
34 import org.kuali.rice.krad.document.MaintenanceDocument;
35 import org.kuali.rice.krad.document.authorization.DocumentAuthorizer;
36 import org.kuali.rice.krad.exception.DocumentAuthorizationException;
37 import org.kuali.rice.krad.exception.UnknownDocumentIdException;
38 import org.kuali.rice.krad.exception.ValidationException;
39 import org.kuali.rice.krad.question.ConfirmationQuestion;
40 import org.kuali.rice.krad.rule.event.AddNoteEvent;
41 import org.kuali.rice.krad.service.AttachmentService;
42 import org.kuali.rice.krad.service.BusinessObjectService;
43 import org.kuali.rice.krad.service.DataDictionaryService;
44 import org.kuali.rice.krad.service.DocumentHelperService;
45 import org.kuali.rice.krad.service.DocumentService;
46 import org.kuali.rice.krad.service.KRADServiceLocator;
47 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
48 import org.kuali.rice.krad.service.NoteService;
49 import org.kuali.rice.krad.uif.UifConstants.WorkflowAction;
50 import org.kuali.rice.krad.uif.UifParameters;
51 import org.kuali.rice.krad.uif.UifPropertyPaths;
52 import org.kuali.rice.krad.uif.container.CollectionGroup;
53 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
54 import org.kuali.rice.krad.util.GlobalVariables;
55 import org.kuali.rice.krad.util.KRADConstants;
56 import org.kuali.rice.krad.util.KRADPropertyConstants;
57 import org.kuali.rice.krad.util.KRADUtils;
58 import org.kuali.rice.krad.util.NoteType;
59 import org.kuali.rice.krad.util.SessionTicket;
60 import org.kuali.rice.krad.web.form.DocumentFormBase;
61 import org.kuali.rice.krad.web.form.UifFormBase;
62 import org.springframework.util.FileCopyUtils;
63 import org.springframework.validation.BindingResult;
64 import org.springframework.web.bind.ServletRequestBindingException;
65 import org.springframework.web.bind.annotation.ModelAttribute;
66 import org.springframework.web.bind.annotation.RequestMapping;
67 import org.springframework.web.bind.annotation.RequestMethod;
68 import org.springframework.web.multipart.MultipartFile;
69 import org.springframework.web.servlet.ModelAndView;
70
71 import javax.servlet.http.HttpServletRequest;
72 import javax.servlet.http.HttpServletResponse;
73 import java.io.FileNotFoundException;
74 import java.io.IOException;
75 import java.io.InputStream;
76 import java.util.ArrayList;
77 import java.util.HashMap;
78 import java.util.List;
79 import java.util.Map;
80 import java.util.Properties;
81
82
83
84
85
86
87
88
89
90
91
92
93 public abstract class DocumentControllerBase extends UifControllerBase {
94 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentControllerBase.class);
95
96
97
98 protected static final String[] DOCUMENT_LOAD_COMMANDS =
99 {KewApiConstants.ACTIONLIST_COMMAND, KewApiConstants.DOCSEARCH_COMMAND, KewApiConstants.SUPERUSER_COMMAND,
100 KewApiConstants.HELPDESK_ACTIONLIST_COMMAND};
101
102 private BusinessObjectService businessObjectService;
103 private DataDictionaryService dataDictionaryService;
104 private DocumentService documentService;
105 private DocumentHelperService documentHelperService;
106 private AttachmentService attachmentService;
107 private NoteService noteService;
108
109
110
111
112
113 @Override
114 protected abstract DocumentFormBase createInitialForm(HttpServletRequest request);
115
116
117
118
119
120
121
122
123
124
125 @RequestMapping(params = "methodToCall=docHandler")
126 public ModelAndView docHandler(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
127 HttpServletRequest request, HttpServletResponse response) throws Exception {
128 String command = form.getCommand();
129
130
131 if (ArrayUtils.contains(DOCUMENT_LOAD_COMMANDS, command) && form.getDocId() != null) {
132 loadDocument(form);
133 } else if (KewApiConstants.INITIATE_COMMAND.equals(command)) {
134 createDocument(form);
135 } else {
136 LOG.error("docHandler called with invalid parameters");
137 throw new IllegalStateException("docHandler called with invalid parameters");
138 }
139
140
141
142
143
144
145 return getUIFModelAndView(form);
146 }
147
148
149
150
151
152
153
154
155 protected void loadDocument(DocumentFormBase form) throws WorkflowException {
156 String docId = form.getDocId();
157
158 LOG.debug("Loading document" + docId);
159
160 Document doc = null;
161 doc = getDocumentService().getByDocumentHeaderId(docId);
162 if (doc == null) {
163 throw new UnknownDocumentIdException(
164 "Document no longer exists. It may have been cancelled before being saved.");
165 }
166
167 WorkflowDocument workflowDocument = doc.getDocumentHeader().getWorkflowDocument();
168 if (!getDocumentHelperService().getDocumentAuthorizer(doc).canOpen(doc,
169 GlobalVariables.getUserSession().getPerson())) {
170 throw buildAuthorizationException("open", doc);
171 }
172
173
174
175 if (workflowDocument != doc.getDocumentHeader().getWorkflowDocument()) {
176 LOG.warn("Workflow document changed via canOpen check");
177 doc.getDocumentHeader().setWorkflowDocument(workflowDocument);
178 }
179
180 form.setDocument(doc);
181 WorkflowDocument workflowDoc = doc.getDocumentHeader().getWorkflowDocument();
182 form.setDocTypeName(workflowDoc.getDocumentTypeName());
183
184 KRADServiceLocatorWeb.getSessionDocumentService().addDocumentToUserSession(GlobalVariables.getUserSession(),
185 workflowDoc);
186 }
187
188
189
190
191
192
193
194
195 protected void createDocument(DocumentFormBase form) throws WorkflowException {
196 LOG.debug("Creating new document instance for doc type: " + form.getDocTypeName());
197 Document doc = getDocumentService().getNewDocument(form.getDocTypeName());
198
199 form.setDocument(doc);
200 form.setDocTypeName(doc.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
201 }
202
203
204
205
206
207
208
209
210 @RequestMapping(params = "methodToCall=reload")
211 public ModelAndView reload(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
212 HttpServletRequest request, HttpServletResponse response) throws Exception {
213 Document document = form.getDocument();
214
215
216 form.setDocId(document.getDocumentNumber());
217 form.setCommand(DOCUMENT_LOAD_COMMANDS[1]);
218
219 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_MESSAGES, RiceKeyConstants.MESSAGE_RELOADED);
220
221
222 return docHandler(form, result, request, response);
223 }
224
225
226
227
228
229
230
231
232 @RequestMapping(params = "methodToCall=cancel")
233 @Override
234 public ModelAndView cancel(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
235 HttpServletRequest request, HttpServletResponse response) {
236 DocumentFormBase documentForm = (DocumentFormBase) form;
237
238
239
240 performWorkflowAction(documentForm, WorkflowAction.CANCEL, false);
241
242 return returnToPrevious(form);
243 }
244
245
246
247
248
249
250
251 @RequestMapping(params = "methodToCall=save")
252 public ModelAndView save(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
253 HttpServletRequest request, HttpServletResponse response) throws Exception {
254 performWorkflowAction(form, WorkflowAction.SAVE, true);
255
256 return getUIFModelAndView(form);
257 }
258
259
260
261
262
263
264
265 @RequestMapping(params = "methodToCall=route")
266 public ModelAndView route(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
267 HttpServletRequest request, HttpServletResponse response) throws Exception {
268 performWorkflowAction(form, WorkflowAction.ROUTE, true);
269
270 return getUIFModelAndView(form);
271 }
272
273
274
275
276
277
278
279 @RequestMapping(params = "methodToCall=blanketApprove")
280 public ModelAndView blanketApprove(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
281 HttpServletRequest request, HttpServletResponse response) throws Exception {
282 performWorkflowAction(form, WorkflowAction.BLANKETAPPROVE, true);
283
284 return returnToPrevious(form);
285 }
286
287
288
289
290
291
292
293 @RequestMapping(params = "methodToCall=approve")
294 public ModelAndView approve(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
295 HttpServletRequest request, HttpServletResponse response) throws Exception {
296 performWorkflowAction(form, WorkflowAction.APPROVE, true);
297
298 return returnToPrevious(form);
299 }
300
301
302
303
304
305
306
307 @RequestMapping(params = "methodToCall=disapprove")
308 public ModelAndView disapprove(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
309 HttpServletRequest request, HttpServletResponse response) throws Exception {
310
311 performWorkflowAction(form, WorkflowAction.DISAPPROVE, true);
312
313 return returnToPrevious(form);
314 }
315
316
317
318
319
320
321
322 @RequestMapping(params = "methodToCall=fyi")
323 public ModelAndView fyi(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
324 HttpServletRequest request, HttpServletResponse response) throws Exception {
325 performWorkflowAction(form, WorkflowAction.FYI, false);
326
327 return returnToPrevious(form);
328 }
329
330
331
332
333
334
335
336 @RequestMapping(params = "methodToCall=acknowledge")
337 public ModelAndView acknowledge(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
338 HttpServletRequest request, HttpServletResponse response) throws Exception {
339 performWorkflowAction(form, WorkflowAction.ACKNOWLEDGE, false);
340
341 return returnToPrevious(form);
342 }
343
344
345
346
347
348
349
350
351
352 protected void performWorkflowAction(DocumentFormBase form, WorkflowAction action, boolean checkSensitiveData) {
353 Document document = form.getDocument();
354
355 LOG.debug("Performing workflow action " + action.name() + "for document: " + document.getDocumentNumber());
356
357
358 if (checkSensitiveData) {
359
360
361
362
363
364 }
365
366 try {
367 String successMessageKey = null;
368 switch (action) {
369 case SAVE:
370 getDocumentService().saveDocument(document);
371 successMessageKey = RiceKeyConstants.MESSAGE_SAVED;
372 break;
373 case ROUTE:
374 getDocumentService().routeDocument(document, form.getAnnotation(), combineAdHocRecipients(form));
375 successMessageKey = RiceKeyConstants.MESSAGE_ROUTE_SUCCESSFUL;
376 break;
377 case BLANKETAPPROVE:
378 getDocumentService().blanketApproveDocument(document, form.getAnnotation(), combineAdHocRecipients(
379 form));
380 successMessageKey = RiceKeyConstants.MESSAGE_ROUTE_APPROVED;
381 break;
382 case APPROVE:
383 getDocumentService().approveDocument(document, form.getAnnotation(), combineAdHocRecipients(form));
384 successMessageKey = RiceKeyConstants.MESSAGE_ROUTE_APPROVED;
385 break;
386 case DISAPPROVE:
387
388 String disapprovalNoteText = "";
389 getDocumentService().disapproveDocument(document, disapprovalNoteText);
390 successMessageKey = RiceKeyConstants.MESSAGE_ROUTE_DISAPPROVED;
391 break;
392 case FYI:
393 getDocumentService().clearDocumentFyi(document, combineAdHocRecipients(form));
394 successMessageKey = RiceKeyConstants.MESSAGE_ROUTE_FYIED;
395 break;
396 case ACKNOWLEDGE:
397 getDocumentService().acknowledgeDocument(document, form.getAnnotation(), combineAdHocRecipients(
398 form));
399 successMessageKey = RiceKeyConstants.MESSAGE_ROUTE_ACKNOWLEDGED;
400 break;
401 case CANCEL:
402 if (getDocumentService().documentExists(document.getDocumentNumber())) {
403 getDocumentService().cancelDocument(document, form.getAnnotation());
404 successMessageKey = RiceKeyConstants.MESSAGE_CANCELLED;
405 }
406 break;
407 }
408
409 if (successMessageKey != null) {
410 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_MESSAGES, successMessageKey);
411 }
412 } catch (ValidationException e) {
413
414
415 if (GlobalVariables.getMessageMap().hasNoErrors()) {
416 throw new RiceRuntimeException("Validation Exception with no error message.", e);
417 }
418 } catch (Exception e) {
419 throw new RiceRuntimeException(
420 "Exception trying to invoke action " + action.name() + "for document: " + document
421 .getDocumentNumber(), e);
422 }
423
424 form.setAnnotation("");
425 }
426
427
428
429
430
431
432 @RequestMapping(params = "methodToCall=supervisorFunctions")
433 public ModelAndView supervisorFunctions(@ModelAttribute("KualiForm") DocumentFormBase form, BindingResult result,
434 HttpServletRequest request, HttpServletResponse response) throws Exception {
435
436 String workflowSuperUserUrl = getConfigurationService().getPropertyValueAsString(KRADConstants.WORKFLOW_URL_KEY)
437 + "/" + KRADConstants.SUPERUSER_ACTION;
438
439 Properties props = new Properties();
440 props.put(UifParameters.METHOD_TO_CALL, "displaySuperUserDocument");
441 props.put(UifPropertyPaths.DOCUMENT_ID, form.getDocument().getDocumentNumber());
442
443 return performRedirect(form, workflowSuperUserUrl, props);
444 }
445
446
447
448
449
450
451
452
453 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=insertNote")
454 public ModelAndView insertNote(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
455 HttpServletRequest request, HttpServletResponse response) {
456
457
458 String selectedCollectionPath = uifForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
459 CollectionGroup collectionGroup = uifForm.getPreviousView().getViewIndex().getCollectionGroupByPath(
460 selectedCollectionPath);
461 String addLinePath = collectionGroup.getAddLineBindingInfo().getBindingPath();
462 Object addLine = ObjectPropertyUtils.getPropertyValue(uifForm, addLinePath);
463 Note newNote = (Note) addLine;
464 newNote.setNotePostedTimestampToCurrent();
465
466 Document document = ((DocumentFormBase) uifForm).getDocument();
467
468 newNote.setRemoteObjectIdentifier(document.getNoteTarget().getObjectId());
469
470
471 String attachmentTypeCode = null;
472 MultipartFile attachmentFile = uifForm.getAttachmentFile();
473 Attachment attachment = null;
474 if (attachmentFile != null && !StringUtils.isBlank(attachmentFile.getOriginalFilename())) {
475 if (attachmentFile.getSize() == 0) {
476 GlobalVariables.getMessageMap().putError(String.format("%s.%s",
477 KRADConstants.NEW_DOCUMENT_NOTE_PROPERTY_NAME,
478 KRADConstants.NOTE_ATTACHMENT_FILE_PROPERTY_NAME), RiceKeyConstants.ERROR_UPLOADFILE_EMPTY,
479 attachmentFile.getOriginalFilename());
480 } else {
481 if (newNote.getAttachment() != null) {
482 attachmentTypeCode = newNote.getAttachment().getAttachmentTypeCode();
483 }
484
485 DocumentAuthorizer documentAuthorizer =
486 KRADServiceLocatorWeb.getDocumentHelperService().getDocumentAuthorizer(document);
487 if (!documentAuthorizer.canAddNoteAttachment(document, attachmentTypeCode,
488 GlobalVariables.getUserSession().getPerson())) {
489 throw buildAuthorizationException("annotate", document);
490 }
491 try {
492 String attachmentType = null;
493 Attachment newAttachment = newNote.getAttachment();
494 if (newAttachment != null) {
495 attachmentType = newAttachment.getAttachmentTypeCode();
496 }
497 attachment = getAttachmentService().createAttachment(document.getNoteTarget(),
498 attachmentFile.getOriginalFilename(), attachmentFile.getContentType(),
499 (int) attachmentFile.getSize(), attachmentFile.getInputStream(), attachmentType);
500 } catch (IOException e) {
501 e.printStackTrace();
502 }
503 }
504 }
505
506 Person kualiUser = GlobalVariables.getUserSession().getPerson();
507 if (kualiUser == null) {
508 throw new IllegalStateException("Current UserSession has a null Person.");
509 }
510
511 newNote.setAuthorUniversalIdentifier(kualiUser.getPrincipalId());
512
513
514 boolean rulePassed = KRADServiceLocatorWeb.getKualiRuleService().applyRules(new AddNoteEvent(document,
515 newNote));
516
517
518 if (rulePassed) {
519 newNote.refresh();
520
521 DocumentHeader documentHeader = document.getDocumentHeader();
522
523
524
525
526 if (attachment != null) {
527 newNote.addAttachment(attachment);
528 }
529
530 if (!documentHeader.getWorkflowDocument().isInitiated() && StringUtils.isNotEmpty(
531 document.getNoteTarget().getObjectId()) && !(document instanceof MaintenanceDocument && NoteType
532 .BUSINESS_OBJECT.getCode().equals(newNote.getNoteTypeCode()))) {
533
534 getNoteService().save(newNote);
535 }
536
537 }
538
539 return addLine(uifForm, result, request, response);
540 }
541
542
543
544
545
546
547 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=deleteNote")
548 public ModelAndView deleteNote(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
549 HttpServletRequest request, HttpServletResponse response) {
550
551 String selectedLineIndex = uifForm.getActionParamaterValue("selectedLineIndex");
552 Document document = ((DocumentFormBase) uifForm).getDocument();
553 Note note = document.getNote(Integer.parseInt(selectedLineIndex));
554
555 Attachment attachment = note.getAttachment();
556 String attachmentTypeCode = null;
557 if (attachment != null) {
558 attachmentTypeCode = attachment.getAttachmentTypeCode();
559 }
560
561 String authorUniversalIdentifier = note.getAuthorUniversalIdentifier();
562 if (!KRADUtils.canDeleteNoteAttachment(document, attachmentTypeCode, authorUniversalIdentifier)) {
563 throw buildAuthorizationException("annotate", document);
564 }
565
566 if (attachment != null && attachment.isComplete()) {
567
568
569
570 if (note.getNoteIdentifier()
571 != null) {
572 attachment.refreshNonUpdateableReferences();
573 }
574 getAttachmentService().deleteAttachmentContents(attachment);
575 }
576
577 if (!document.getDocumentHeader().getWorkflowDocument().isInitiated()) {
578 getNoteService().deleteNote(note);
579 }
580
581 return deleteLine(uifForm, result, request, response);
582 }
583
584
585
586
587
588
589 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=downloadAttachment")
590 public ModelAndView downloadAttachment(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
591 HttpServletRequest request,
592 HttpServletResponse response) throws ServletRequestBindingException, FileNotFoundException, IOException {
593
594 String selectedLineIndex = uifForm.getActionParamaterValue("selectedLineIndex");
595 Note note = ((DocumentFormBase) uifForm).getDocument().getNote(Integer.parseInt(selectedLineIndex));
596 Attachment attachment = note.getAttachment();
597 InputStream is = getAttachmentService().retrieveAttachmentContents(attachment);
598
599
600 response.setContentType(attachment.getAttachmentMimeTypeCode());
601 response.setContentLength(attachment.getAttachmentFileSize().intValue());
602 response.setHeader("Expires", "0");
603 response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
604 response.setHeader("Pragma", "public");
605 response.setHeader("Content-Disposition",
606 "attachment; filename=\"" + attachment.getAttachmentFileName() + "\"");
607
608
609 FileCopyUtils.copy(is, response.getOutputStream());
610 return null;
611 }
612
613
614
615
616
617 @RequestMapping(method = RequestMethod.POST, params = "methodToCall=cancelAttachment")
618 public ModelAndView cancelAttachment(@ModelAttribute("KualiForm") UifFormBase uifForm, BindingResult result,
619 HttpServletRequest request, HttpServletResponse response) {
620
621 uifForm.setAttachmentFile(null);
622 return getUIFModelAndView(uifForm);
623 }
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642 protected String checkAndWarnAboutSensitiveData(DocumentFormBase form, HttpServletRequest request,
643 HttpServletResponse response, String fieldName, String fieldValue, String caller,
644 String context) throws Exception {
645
646 String viewName = null;
647 Document document = form.getDocument();
648
649
650 boolean containsSensitiveData = false;
651
652
653
654
655 boolean warnForSensitiveData = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsBoolean(
656 KRADConstants.KRAD_NAMESPACE, ParameterConstants.ALL_COMPONENT,
657 KRADConstants.SystemGroupParameterNames.SENSITIVE_DATA_PATTERNS_WARNING_IND);
658
659
660 Map<String, String> ticketContext = new HashMap<String, String>();
661 ticketContext.put(KRADPropertyConstants.DOCUMENT_NUMBER, document.getDocumentNumber());
662 ticketContext.put(KRADConstants.CALLING_METHOD, caller);
663 ticketContext.put(KRADPropertyConstants.NAME, fieldName);
664
665 boolean questionAsked = GlobalVariables.getUserSession().hasMatchingSessionTicket(
666 KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET, ticketContext);
667
668
669 if (containsSensitiveData && warnForSensitiveData && !questionAsked) {
670 Object question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME);
671 if (question == null || !KRADConstants.DOCUMENT_SENSITIVE_DATA_QUESTION.equals(question)) {
672
673
674
675
676
677
678
679
680
681
682
683 viewName = "ask_user_questions";
684 } else {
685 Object buttonClicked = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON);
686
687
688 if (ConfirmationQuestion.NO.equals(buttonClicked)) {
689
690 viewName = "user_says_no";
691 }
692
693
694
695 SessionTicket ticket = new SessionTicket(KRADConstants.SENSITIVE_DATA_QUESTION_SESSION_TICKET);
696 ticket.setTicketContext(ticketContext);
697 GlobalVariables.getUserSession().putSessionTicket(ticket);
698 }
699 }
700
701
702 return viewName;
703 }
704
705
706
707
708
709
710
711
712 protected List<AdHocRouteRecipient> combineAdHocRecipients(DocumentFormBase form) {
713 Document document = form.getDocument();
714
715 List<AdHocRouteRecipient> adHocRecipients = new ArrayList<AdHocRouteRecipient>();
716 adHocRecipients.addAll(document.getAdHocRoutePersons());
717 adHocRecipients.addAll(document.getAdHocRouteWorkgroups());
718
719 return adHocRecipients;
720 }
721
722
723
724
725
726
727
728 protected DocumentAuthorizationException buildAuthorizationException(String action, Document document) {
729 return new DocumentAuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(),
730 action, document.getDocumentNumber());
731 }
732
733 public BusinessObjectService getBusinessObjectService() {
734 if (this.businessObjectService == null) {
735 this.businessObjectService = KRADServiceLocator.getBusinessObjectService();
736 }
737 return this.businessObjectService;
738 }
739
740 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
741 this.businessObjectService = businessObjectService;
742 }
743
744 public DataDictionaryService getDataDictionaryService() {
745 if (this.dataDictionaryService == null) {
746 this.dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
747 }
748 return this.dataDictionaryService;
749 }
750
751 public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
752 this.dataDictionaryService = dataDictionaryService;
753 }
754
755 public DocumentService getDocumentService() {
756 if (this.documentService == null) {
757 this.documentService = KRADServiceLocatorWeb.getDocumentService();
758 }
759 return this.documentService;
760 }
761
762 public void setDocumentService(DocumentService documentService) {
763 this.documentService = documentService;
764 }
765
766 public DocumentHelperService getDocumentHelperService() {
767 if (this.documentHelperService == null) {
768 this.documentHelperService = KRADServiceLocatorWeb.getDocumentHelperService();
769 }
770 return this.documentHelperService;
771 }
772
773 public void setDocumentHelperService(DocumentHelperService documentHelperService) {
774 this.documentHelperService = documentHelperService;
775 }
776
777 public AttachmentService getAttachmentService() {
778 if (attachmentService == null) {
779 attachmentService = KRADServiceLocator.getAttachmentService();
780 }
781 return this.attachmentService;
782 }
783
784 public NoteService getNoteService() {
785 if (noteService == null) {
786 noteService = KRADServiceLocator.getNoteService();
787 }
788 return this.noteService;
789 }
790
791 public ConfigurationService getConfigurationService() {
792 return KRADServiceLocator.getKualiConfigurationService();
793 }
794 }