Class DocumentControllerServiceImpl

java.lang.Object
org.kuali.rice.krad.web.service.impl.ControllerServiceImpl
org.kuali.rice.krad.document.DocumentControllerServiceImpl
All Implemented Interfaces:
DocumentControllerService, ControllerService
Direct Known Subclasses:
MaintenanceDocumentControllerServiceImpl, TransactionalDocumentControllerServiceImpl

public class DocumentControllerServiceImpl extends ControllerServiceImpl implements DocumentControllerService
Default implementation of the document controller service.
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Field Details

  • Constructor Details

    • DocumentControllerServiceImpl

      public DocumentControllerServiceImpl()
  • Method Details

    • docHandler

      public org.springframework.web.servlet.ModelAndView docHandler(DocumentFormBase form) throws org.kuali.rice.kew.api.exception.WorkflowException
      Determines whether a new document instance needs created or we need to load an existing document by checking the DocumentFormBase.getCommand() value, then delegates to a helper method to carry out the action. Handles all requests for a new document instance or to load an existing document based on the given form parameters.
      Specified by:
      docHandler in interface DocumentControllerService
      Parameters:
      form - form instance containing the document data
      Returns:
      ModelAndView instance for rendering the document view
      Throws:
      org.kuali.rice.kew.api.exception.WorkflowException - if a document cannot be created or loaded
    • loadDocument

      protected void loadDocument(DocumentFormBase form) throws org.kuali.rice.kew.api.exception.WorkflowException
      Loads the document by its provided document header id on the given form.

      This has been abstracted out so that it can be overridden in children if the need arises

      Parameters:
      form - form instance that contains the doc id parameter and where the retrieved document instance should be set
      Throws:
      org.kuali.rice.kew.api.exception.WorkflowException
    • createDocument

      protected void createDocument(DocumentFormBase form) throws org.kuali.rice.kew.api.exception.WorkflowException
      Creates a new document of the type specified by the docTypeName property of the given form.

      This has been abstracted out so that it can be overridden in children if the need arises

      Parameters:
      form - form instance that contains the doc type parameter and where the new document instance should be set
      Throws:
      org.kuali.rice.kew.api.exception.WorkflowException
    • cancel

      public org.springframework.web.servlet.ModelAndView cancel(UifFormBase form)
      Navigates back to a previous point (depending on how the view was requested). Invoked when the cancel action is invoked on a view. org.kuali.rice.krad.web.service.impl.NavigationControllerServiceImpl#back(org.kuali.rice.krad.web.form.UifFormBase, boolean)
      Specified by:
      cancel in interface ControllerService
      Overrides:
      cancel in class ControllerServiceImpl
      Parameters:
      form - form instance containing the model data
      Returns:
      ModelAndView instance for rendering the view
    • reload

      public org.springframework.web.servlet.ModelAndView reload(DocumentFormBase form) throws org.kuali.rice.kew.api.exception.WorkflowException
      Reloads from the database the document with the doc id on the given form.
      Specified by:
      reload in interface DocumentControllerService
      Parameters:
      form - form instance containing the document id that will be reloaded
      Returns:
      ModelAndView instance for rendering the reloaded document view
      Throws:
      org.kuali.rice.kew.api.exception.WorkflowException - if the document cannot be reloaded
    • recall

      public org.springframework.web.servlet.ModelAndView recall(DocumentFormBase form)
      Recalls the document with the given id on the form from workflow.
      Specified by:
      recall in interface DocumentControllerService
      Parameters:
      form - form instance containing the document id that will be recalled
      Returns:
      ModelAndView instance for rendering the document view
    • save

      public org.springframework.web.servlet.ModelAndView save(DocumentFormBase form)
      Saves the document instance contained on the given form.
      Specified by:
      save in interface DocumentControllerService
      Parameters:
      form - form instance containing the document that will be saved
      Returns:
      ModelAndView instance for rendering the document view
    • save

      public org.springframework.web.servlet.ModelAndView save(DocumentFormBase form, SaveDocumentEvent saveDocumentEvent)
      Saves the document instance contained on the given form and passes the given event for rule evaluation.
      Specified by:
      save in interface DocumentControllerService
      Parameters:
      form - form instance containing the document that will be saved
      saveDocumentEvent - rule event that will be processed with the save operation
      Returns:
      ModelAndView instance for rendering the document view
    • complete

      public org.springframework.web.servlet.ModelAndView complete(DocumentFormBase form)
      Sends a complete workflow action for the document contained on the form.
      Specified by:
      complete in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the complete request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • route

      public org.springframework.web.servlet.ModelAndView route(DocumentFormBase form)
      Sends a route workflow action for the document contained on the form.
      Specified by:
      route in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the route request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • blanketApprove

      public org.springframework.web.servlet.ModelAndView blanketApprove(DocumentFormBase form)
      Sends a blanket approve workflow action for the document contained on the form.
      Specified by:
      blanketApprove in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the blanket approve request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • approve

      public org.springframework.web.servlet.ModelAndView approve(DocumentFormBase form)
      Sends a approve workflow action for the document contained on the form.
      Specified by:
      approve in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the approve request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • disapprove

      public org.springframework.web.servlet.ModelAndView disapprove(DocumentFormBase form)
      Sends a disapprove workflow action for the document contained on the form.
      Specified by:
      disapprove in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the disapprove request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • generateDisapprovalNote

      protected String generateDisapprovalNote(DocumentFormBase form)
      Convenience method for generating disapproval note with text from the explanation dialog.
      Parameters:
      form - document form instance containing the explanation dialog
      Returns:
    • fyi

      public org.springframework.web.servlet.ModelAndView fyi(DocumentFormBase form)
      Sends a fyi workflow action for the document contained on the form.
      Specified by:
      fyi in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the fyi request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • acknowledge

      public org.springframework.web.servlet.ModelAndView acknowledge(DocumentFormBase form)
      Sends a acknowledge workflow action for the document contained on the form.
      Specified by:
      acknowledge in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the acknowledge request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • sendAdHocRequests

      public org.springframework.web.servlet.ModelAndView sendAdHocRequests(DocumentFormBase form)
      Sends AdHoc workflow Requests for the document instance contained on the form to the AdHoc recipients contained on the form.
      Specified by:
      sendAdHocRequests in interface DocumentControllerService
      Parameters:
      form - form instance containing the document and recipients the requests will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • supervisorFunctions

      public org.springframework.web.servlet.ModelAndView supervisorFunctions(DocumentFormBase form)
      Redirects to the supervisor workflow view.
      Specified by:
      supervisorFunctions in interface DocumentControllerService
      Parameters:
      form - form instance containing the document instance
      Returns:
      ModelAndView instance for rendering the supervisor workflow view
    • close

      public org.springframework.web.servlet.ModelAndView close(DocumentFormBase form)
      Closes the document and returns to the hub.
      Specified by:
      close in interface DocumentControllerService
      Parameters:
      form - form instance containing the document instance
      Returns:
      ModelAndView instance for rendering the document view
    • insertNote

      public org.springframework.web.servlet.ModelAndView insertNote(DocumentFormBase form)
      Validates the note, saves attachment, adds the time stamp and author, and calls the generic addLine method. Invoked by the add note action to adding the note instance contained of the given form.
      Specified by:
      insertNote in interface DocumentControllerService
      Parameters:
      form - form instance containing the note instance
      Returns:
      ModelAndView instance for rendering the document view
    • getAddLineNoteInstance

      protected org.kuali.rice.krad.bo.Note getAddLineNoteInstance(DocumentFormBase form)
      Retrieves the note instance on the form that should be added to the document notes.
      Parameters:
      form - form instance containing the add note instance
      Returns:
    • setNewNoteProperties

      protected void setNewNoteProperties(DocumentFormBase form, Document document, org.kuali.rice.krad.bo.Note newNote)
      Defaults properties (posted timestamp, object id, author) on the note instance that will be added.
      Parameters:
      form - form instance containing the add note instance
      document - document instance the note will be added to
      newNote - note instance to set properties on
    • getNewNoteAttachment

      protected org.kuali.rice.krad.bo.Attachment getNewNoteAttachment(DocumentFormBase form, Document document, org.kuali.rice.krad.bo.Note newNote)
      Builds an attachment for the file (if any) associated with the add note instance.
      Parameters:
      form - form instance containing the attachment file
      document - document instance the attachment should be associated with
      newNote - note instance the attachment should be associated with
      Returns:
      Attachment instance for the note, or null if no attachment file was present
    • saveNewNote

      protected void saveNewNote(DocumentFormBase form, Document document, org.kuali.rice.krad.bo.Note newNote)
      Saves a new note instance to the data store if the document state allows it.
      Parameters:
      form - form instance containing the add note instance
      document - document instance the note is associated with
      newNote - note instance to save
    • deleteNote

      public org.springframework.web.servlet.ModelAndView deleteNote(DocumentFormBase form)
      Invoked by the delete note action to delete a note instance contained on document (within the form).
      Specified by:
      deleteNote in interface DocumentControllerService
      Parameters:
      form - form instance containing the note instance
      Returns:
      ModelAndView instance for rendering the document view
    • downloadAttachment

      public org.springframework.web.servlet.ModelAndView downloadAttachment(DocumentFormBase form, javax.servlet.http.HttpServletResponse response)
      Retrieves a note attachment by either the line index of the note within the documents note collection, or by the note identifier. Invoked to download an attachment that has been uploaded for a note.
      Specified by:
      downloadAttachment in interface DocumentControllerService
      Parameters:
      form - form instance containing the note (and attachment) instance
      response - http servlet response instance for sending back the attachment contents
      Returns:
      ModelAndView instance for rendering the document view, or null if the response has been finished
    • cancelAttachment

      public org.springframework.web.servlet.ModelAndView cancelAttachment(DocumentFormBase form)
      Invoked to remove an attachment that was uploaded for the add note instance.
      Specified by:
      cancelAttachment in interface DocumentControllerService
      Parameters:
      form - form instance containing the attachment.
      Returns:
      ModelAndView instance for rendering the document view
    • superUserTakeActions

      public org.springframework.web.servlet.ModelAndView superUserTakeActions(DocumentFormBase form)
      Invoked to take super user actions on a document.
      Specified by:
      superUserTakeActions in interface DocumentControllerService
      Parameters:
      form - form instance containing the actions.
      Returns:
      ModelAndView instance for rendering the document view
    • superUserApprove

      public org.springframework.web.servlet.ModelAndView superUserApprove(DocumentFormBase form)
      Sends a super user approve workflow action for the document contained on the form.
      Specified by:
      superUserApprove in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the super user approve request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • superUserDisapprove

      public org.springframework.web.servlet.ModelAndView superUserDisapprove(DocumentFormBase form)
      Sends a super user disapprove workflow action for the document contained on the form.
      Specified by:
      superUserDisapprove in interface DocumentControllerService
      Parameters:
      form - form instance containing the document the super user disapprove request will be generated for
      Returns:
      ModelAndView instance for rendering the document view
    • performWorkflowAction

      public void performWorkflowAction(DocumentFormBase form, UifConstants.WorkflowAction action)
      Invokes the DocumentService to carry out a request workflow action and adds a success message, if requested a check for sensitive data is also performed.
      Specified by:
      performWorkflowAction in interface DocumentControllerService
      Parameters:
      form - document form instance containing the document for which the action will be taken on
      action - UifConstants.WorkflowAction enum indicating what workflow action to take
    • performWorkflowAction

      public void performWorkflowAction(DocumentFormBase form, UifConstants.WorkflowAction action, DocumentEvent documentEvent)
      Invokes the DocumentService to carry out a request workflow action and adds a success message, if requested a check for sensitive data is also performed.
      Specified by:
      performWorkflowAction in interface DocumentControllerService
      Parameters:
      form - document form instance containing the document for which the action will be taken on
      action - UifConstants.WorkflowAction enum indicating what workflow action to take
      documentEvent - rule event instance that will be evaluated with the workflow action, only currently supported for the save action
    • combineAdHocRecipients

      protected List<org.kuali.rice.krad.bo.AdHocRouteRecipient> combineAdHocRecipients(DocumentFormBase form)
      Convenience method to combine the two lists of ad hoc recipients into one which should be done before calling any of the document service methods that expect a list of ad hoc recipients.
      Parameters:
      form - document form instance containing the ad hod lists
      Returns:
      List combined ad hoc recipients
    • performSuperUserWorkflowAction

      public void performSuperUserWorkflowAction(DocumentFormBase form, UifConstants.SuperUserWorkflowAction action)
      Invokes the DocumentService to carry out a super user request workflow action and adds a success message.
      Specified by:
      performSuperUserWorkflowAction in interface DocumentControllerService
      Parameters:
      form - document form instance containing the document for which the super user action will be taken on
      action - UifConstants.SuperUserWorkflowAction enum indicating what super user workflow action to take
    • performSuperUserWorkflowAction

      public void performSuperUserWorkflowAction(DocumentFormBase form, UifConstants.SuperUserWorkflowAction action, org.kuali.rice.kew.api.action.ActionRequest actionRequest)
      Invokes the DocumentService to carry out a super user request workflow action and adds a success message.
      Specified by:
      performSuperUserWorkflowAction in interface DocumentControllerService
      Parameters:
      form - document form instance containing the document for which the super user action will be taken on
      action - UifConstants.SuperUserWorkflowAction enum indicating what super user workflow action to take
      actionRequest - the requested action to take, currenly only available for take action
    • getWorkflowDocumentActionsService

      protected org.kuali.rice.kew.api.action.WorkflowDocumentActionsService getWorkflowDocumentActionsService(String documentTypeId)
      Helper method to get the correct WorkflowDocumentActionsService from the applicationId of the document type.
      Parameters:
      documentTypeId - the document type to get the application id from
      Returns:
      the correct WorkflowDocumentActionsService from the applicationId of the document type
    • checkSensitiveDataAndWarningDialog

      protected org.springframework.web.servlet.ModelAndView checkSensitiveDataAndWarningDialog(String field, UifFormBase form)
      Helper method to check if sensitive data is present in a given string and dialog display.

      If the string is sensitive we want to return a dialog box to make sure user wants to continue, else we just return null

      Parameters:
      field - the string to check for sensitive data
      form - the form to add the dialog to
      Returns:
      the model and view for the dialog or null if there isn't one
    • buildAuthorizationException

      protected org.kuali.rice.krad.exception.DocumentAuthorizationException buildAuthorizationException(String action, Document document)
      Convenience method for building document authorization exceptions.
      Parameters:
      action - the action that was requested
      document - document instance the action was requested for
    • getLegacyDataAdapter

      protected LegacyDataAdapter getLegacyDataAdapter()
    • setLegacyDataAdapter

      public void setLegacyDataAdapter(LegacyDataAdapter legacyDataAdapter)
    • getDataDictionaryService

      protected DataDictionaryService getDataDictionaryService()
    • setDataDictionaryService

      public void setDataDictionaryService(DataDictionaryService dataDictionaryService)
    • getDocumentService

      protected DocumentService getDocumentService()
    • setDocumentService

      public void setDocumentService(DocumentService documentService)
    • getDocumentDictionaryService

      protected DocumentDictionaryService getDocumentDictionaryService()
    • setDocumentDictionaryService

      public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
    • getAttachmentService

      protected org.kuali.rice.krad.service.AttachmentService getAttachmentService()
    • setAttachmentService

      public void setAttachmentService(org.kuali.rice.krad.service.AttachmentService attachmentService)
    • getNoteService

      protected org.kuali.rice.krad.service.NoteService getNoteService()
    • setNoteService

      public void setNoteService(org.kuali.rice.krad.service.NoteService noteService)
    • getModelAndViewService

      protected ModelAndViewService getModelAndViewService()
      Overrides:
      getModelAndViewService in class ControllerServiceImpl
    • setModelAndViewService

      public void setModelAndViewService(ModelAndViewService modelAndViewService)
      Overrides:
      setModelAndViewService in class ControllerServiceImpl
    • getNavigationControllerService

      protected NavigationControllerService getNavigationControllerService()
      Overrides:
      getNavigationControllerService in class ControllerServiceImpl
    • setNavigationControllerService

      public void setNavigationControllerService(NavigationControllerService navigationControllerService)
      Overrides:
      setNavigationControllerService in class ControllerServiceImpl
    • getConfigurationService

      protected org.kuali.rice.core.api.config.property.ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(org.kuali.rice.core.api.config.property.ConfigurationService configurationService)
    • getCollectionControllerService

      protected CollectionControllerService getCollectionControllerService()
    • setCollectionControllerService

      public void setCollectionControllerService(CollectionControllerService collectionControllerService)
    • getParameterService

      protected org.kuali.rice.coreservice.framework.parameter.ParameterService getParameterService()
    • setParameterService

      public void setParameterService(org.kuali.rice.coreservice.framework.parameter.ParameterService parameterService)