org.kuali.rice.krad.service.impl
Class DocumentServiceImpl

java.lang.Object
  extended by org.kuali.rice.krad.service.impl.DocumentServiceImpl
All Implemented Interfaces:
DocumentService

public class DocumentServiceImpl
extends Object
implements DocumentService

Service implementation for the Document structure. It contains all of the document level type of processing and calling back into documents for various centralization of functionality. This is the default, Kuali delivered implementation which utilizes Workflow.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
DocumentServiceImpl()
           
 
Method Summary
 Document acknowledgeDocument(Document document, String annotation, List<AdHocRouteRecipient> adHocRecipients)
          acknowledge this document, optionally providing an annotation for the acknowledgement which will show up in the route log for the document for this acknowledgement, additionally optionally provide a list of ad hoc recipients that should recieve this document.
 Document approveDocument(Document document, String annotation, List<AdHocRouteRecipient> adHocRecipients)
          approve this document, optionally providing an annotation which will show up in the route log for this document for this action taken, and optionally providing a list of ad hoc recipients for the document
 Document blanketApproveDocument(Document document, String annotation, List<AdHocRouteRecipient> adHocRecipients)
          blanket approve this document which will approve the document and stand in for an approve for all typically generated approval actions requested for this document.
 Document cancelDocument(Document document, String annotation)
          cancel this document, optionally providing an annotation for the disapproval which will show up in the route log for the document for this action taken
protected  void checkForNulls(Document document)
           
 Document clearDocumentFyi(Document document, List<AdHocRouteRecipient> adHocRecipients)
          clear the fyi request for this document, optionally providing a list of ad hoc recipients for this document, which should be restricted to action requested of fyi as all other actions requested will be discarded
 Document completeDocument(Document document, String annotation, List adHocRecipients)
          Complete action for a document
 Note createNoteFromDocument(Document document, String text)
          This method creates a note from a given document and note text.
 Document disapproveDocument(Document document, String annotation)
          disapprove this document, optionally providing an annotation for the disapproval which will show up in the route log for the document for this action taken
 boolean documentExists(String documentHeaderId)
           
protected  BusinessObjectService getBusinessObjectService()
           
 Document getByDocumentHeaderId(String documentHeaderId)
          This is temporary until workflow 2.0 and reads from a table to get documents whose status has changed to A (approved - no outstanding approval actions requested)
 Document getByDocumentHeaderIdSessionless(String documentHeaderId)
          get a document based on the document header id which is the primary key for all document types.
protected  DataDictionaryService getDataDictionaryService()
           
protected  DateTimeService getDateTimeService()
           
protected  DocumentDao getDocumentDao()
           
protected  DocumentDictionaryService getDocumentDictionaryService()
           
protected  DocumentHeaderService getDocumentHeaderService()
           
 List<Document> getDocumentsByListOfDocumentHeaderIds(Class<? extends Document> documentClass, List<String> documentHeaderIds)
          The default implementation - this retrieves all documents by a list of documentHeader for a given class.
 Document getNewDocument(Class<? extends Document> documentClass)
          Creates a new document by class.
 Document getNewDocument(String documentTypeName)
          Creates a new document by document type name.
 Document getNewDocument(String documentTypeName, String initiatorPrincipalNm)
          Creates a new document by document type name.
protected  NoteService getNoteService()
           
 PersonService getPersonService()
           
protected  WorkflowDocumentService getWorkflowDocumentService()
           
protected  boolean isNoteTargetReady(Document document)
          Determines if the given document's note target is ready for notes to be attached and persisted against it.
protected  void loadNotes(Document document)
          Loads the Notes for the note target on this Document.
 void prepareWorkflowDocument(Document document)
          Sets the title and app document id in the flex document
 Document recallDocument(Document document, String annotation, boolean cancel)
          recall this document, optionally providing an annotation for the recall which will show up in the route log for the document for this action taken
 Document routeDocument(Document document, String annotation, List<AdHocRouteRecipient> adHocRecipients)
          start the route the document for approval, optionally providing a list of ad hoc recipients, and additionally provideing a annotation to show up in the route log for the document
 Document saveDocument(Document document)
          This is a helper method that performs the same as the DocumentService.saveDocument(Document, Class) method.
 Document saveDocument(Document document, Class<? extends KualiDocumentEvent> kualiDocumentEventClass)
          Saves the passed-in document.
 boolean saveDocumentNotes(Document document)
          Saves the notes associated with the given document if they are in a state where they can be saved.
 void sendAdHocRequests(Document document, String annotation, List<AdHocRouteRecipient> adHocRecipients)
           
 void sendNoteRouteNotification(Document document, Note note, Person sender)
          Builds an workflow notification request for the note and sends it to note recipient.
 void setBusinessObjectService(BusinessObjectService businessObjectService)
           
 void setDataDictionaryService(DataDictionaryService dataDictionaryService)
           
 void setDateTimeService(DateTimeService dateTimeService)
           
 void setDocumentDao(DocumentDao documentDao)
           
 void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)
           
 void setDocumentHeaderService(DocumentHeaderService documentHeaderService)
           
 void setKualiConfigurationService(ConfigurationService kualiConfigurationService)
           
 void setNoteService(NoteService noteService)
           
 void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService)
           
 Document superUserApproveDocument(Document document, String annotation)
          approve this document as super user, optionally providing an annotation which will show up in the route log for this document for this action taken
 Document superUserCancelDocument(Document document, String annotation)
          cancel this document as super user, optionally providing an annotation which will show up in the route log for this document for this action taken
 Document superUserDisapproveDocument(Document document, String annotation)
          disapprove this document as super user, optionally providing an annotation which will show up in the route log for this document for this action taken
 Document superUserDisapproveDocumentWithoutSaving(Document document, String annotation)
          disapprove this document as super user, without saving, optionally providing an annotation which will show up in the route log for this document for this action taken
 Document updateDocument(Document document)
          This is to allow for updates of document statuses and other related requirements for updates outside of the initial save and route
 Document validateAndPersistDocument(Document document, KualiDocumentEvent event)
          Validates and persists a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentServiceImpl

public DocumentServiceImpl()
Method Detail

saveDocument

public Document saveDocument(Document document)
                      throws WorkflowException,
                             ValidationException
Description copied from interface: DocumentService
This is a helper method that performs the same as the DocumentService.saveDocument(Document, Class) method. The convenience of this method is that the event being used is the standard SaveDocumentEvent.

Specified by:
saveDocument in interface DocumentService
Throws:
WorkflowException
ValidationException
See Also:
DocumentService.saveDocument(org.kuali.rice.krad.document.Document)

saveDocument

public Document saveDocument(Document document,
                             Class<? extends KualiDocumentEvent> kualiDocumentEventClass)
                      throws WorkflowException,
                             ValidationException
Description copied from interface: DocumentService
Saves the passed-in document. This will persist it both to the Kuali database, and also initiate it (if necessary) within workflow, so its available in the initiator's action list. This method uses the passed in KualiDocumentEvent class when saving the document. The KualiDocumentEvent class must implement the SaveEvent interface. Note that the system does not support passing in Workflow Annotations or AdHoc Route Recipients on a SaveDocument call. These are sent to workflow on a routeDocument action, or any of the others which actually causes a routing action to happen in workflow. NOTE: This method will not check the document action flags to check if a save is valid

Specified by:
saveDocument in interface DocumentService
Parameters:
document - The document to be saved
kualiDocumentEventClass - The event class to use when saving (class must implement the SaveEvent interface)
Returns:
the document that was passed in
Throws:
WorkflowException
ValidationException

routeDocument

public Document routeDocument(Document document,
                              String annotation,
                              List<AdHocRouteRecipient> adHocRecipients)
                       throws ValidationException,
                              WorkflowException
Description copied from interface: DocumentService
start the route the document for approval, optionally providing a list of ad hoc recipients, and additionally provideing a annotation to show up in the route log for the document

Specified by:
routeDocument in interface DocumentService
Returns:
Throws:
ValidationException
WorkflowException
See Also:
DocumentService.routeDocument(org.kuali.rice.krad.document.Document, java.lang.String, java.util.List)

approveDocument

public Document approveDocument(Document document,
                                String annotation,
                                List<AdHocRouteRecipient> adHocRecipients)
                         throws ValidationException,
                                WorkflowException
Description copied from interface: DocumentService
approve this document, optionally providing an annotation which will show up in the route log for this document for this action taken, and optionally providing a list of ad hoc recipients for the document

Specified by:
approveDocument in interface DocumentService
Returns:
Throws:
ValidationException
WorkflowException
See Also:
DocumentService.approveDocument(org.kuali.rice.krad.document.Document, java.lang.String, java.util.List)

superUserApproveDocument

public Document superUserApproveDocument(Document document,
                                         String annotation)
                                  throws WorkflowException
Description copied from interface: DocumentService
approve this document as super user, optionally providing an annotation which will show up in the route log for this document for this action taken

Specified by:
superUserApproveDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.superUserApproveDocument(org.kuali.rice.krad.document.Document, java.lang.String)

superUserCancelDocument

public Document superUserCancelDocument(Document document,
                                        String annotation)
                                 throws WorkflowException
Description copied from interface: DocumentService
cancel this document as super user, optionally providing an annotation which will show up in the route log for this document for this action taken

Specified by:
superUserCancelDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.superUserCancelDocument(org.kuali.rice.krad.document.Document, java.lang.String)

superUserDisapproveDocument

public Document superUserDisapproveDocument(Document document,
                                            String annotation)
                                     throws WorkflowException
Description copied from interface: DocumentService
disapprove this document as super user, optionally providing an annotation which will show up in the route log for this document for this action taken

Specified by:
superUserDisapproveDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.superUserCancelDocument(org.kuali.rice.krad.document.Document, java.lang.String)

superUserDisapproveDocumentWithoutSaving

public Document superUserDisapproveDocumentWithoutSaving(Document document,
                                                         String annotation)
                                                  throws WorkflowException
Description copied from interface: DocumentService
disapprove this document as super user, without saving, optionally providing an annotation which will show up in the route log for this document for this action taken

Specified by:
superUserDisapproveDocumentWithoutSaving in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.superUserCancelDocument(org.kuali.rice.krad.document.Document, java.lang.String)

disapproveDocument

public Document disapproveDocument(Document document,
                                   String annotation)
                            throws Exception
Description copied from interface: DocumentService
disapprove this document, optionally providing an annotation for the disapproval which will show up in the route log for the document for this action taken

Specified by:
disapproveDocument in interface DocumentService
Returns:
Document
Throws:
Exception
See Also:
DocumentService.disapproveDocument(org.kuali.rice.krad.document.Document, java.lang.String)

cancelDocument

public Document cancelDocument(Document document,
                               String annotation)
                        throws WorkflowException
Description copied from interface: DocumentService
cancel this document, optionally providing an annotation for the disapproval which will show up in the route log for the document for this action taken

Specified by:
cancelDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.cancelDocument(org.kuali.rice.krad.document.Document, java.lang.String)

recallDocument

public Document recallDocument(Document document,
                               String annotation,
                               boolean cancel)
                        throws WorkflowException
Description copied from interface: DocumentService
recall this document, optionally providing an annotation for the recall which will show up in the route log for the document for this action taken

Specified by:
recallDocument in interface DocumentService
Returns:
Throws:
WorkflowException

acknowledgeDocument

public Document acknowledgeDocument(Document document,
                                    String annotation,
                                    List<AdHocRouteRecipient> adHocRecipients)
                             throws WorkflowException
Description copied from interface: DocumentService
acknowledge this document, optionally providing an annotation for the acknowledgement which will show up in the route log for the document for this acknowledgement, additionally optionally provide a list of ad hoc recipients that should recieve this document. The list of ad hoc recipients for this document should have an action requested of acknowledge or fyi as all other actions requested will be discarded as invalid based on the action being taken being an acknowledgement.

Specified by:
acknowledgeDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.acknowledgeDocument(org.kuali.rice.krad.document.Document, java.lang.String, java.util.List)

blanketApproveDocument

public Document blanketApproveDocument(Document document,
                                       String annotation,
                                       List<AdHocRouteRecipient> adHocRecipients)
                                throws ValidationException,
                                       WorkflowException
Description copied from interface: DocumentService
blanket approve this document which will approve the document and stand in for an approve for all typically generated approval actions requested for this document. The user must have blanket approval authority for this document by being registered as a user in the blanket approval workgroup that is associated with this document type. Optionally an annotation can be provided which will show up for this action taken on the document in the route log. Additionally optionally provide a list of ad hoc recipients for this document, which should be restricted to actions requested of acknowledge and fyi as all other actions requested will be discarded

Specified by:
blanketApproveDocument in interface DocumentService
Returns:
Throws:
ValidationException
WorkflowException
See Also:
DocumentService.blanketApproveDocument(org.kuali.rice.krad.document.Document, java.lang.String, java.util.List)

clearDocumentFyi

public Document clearDocumentFyi(Document document,
                                 List<AdHocRouteRecipient> adHocRecipients)
                          throws WorkflowException
Description copied from interface: DocumentService
clear the fyi request for this document, optionally providing a list of ad hoc recipients for this document, which should be restricted to action requested of fyi as all other actions requested will be discarded

Specified by:
clearDocumentFyi in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.clearDocumentFyi(org.kuali.rice.krad.document.Document, java.util.List)

completeDocument

public Document completeDocument(Document document,
                                 String annotation,
                                 List adHocRecipients)
                          throws WorkflowException
Description copied from interface: DocumentService
Complete action for a document

Specified by:
completeDocument in interface DocumentService
Parameters:
document - Document
annotation - Annotation text
adHocRecipients - list of adhoc recipients
Throws:
WorkflowException
See Also:
DocumentService.completeDocument(org.kuali.rice.krad.document.Document, java.lang.String, java.util.List)

checkForNulls

protected void checkForNulls(Document document)

documentExists

public boolean documentExists(String documentHeaderId)
Specified by:
documentExists in interface DocumentService
Returns:
true if a document with the given documentHeaderId exists
See Also:
DocumentService.documentExists(java.lang.String)

getNewDocument

public Document getNewDocument(Class<? extends Document> documentClass)
                        throws WorkflowException
Creates a new document by class.

Specified by:
getNewDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.getNewDocument(java.lang.Class)

getNewDocument

public Document getNewDocument(String documentTypeName,
                               String initiatorPrincipalNm)
                        throws WorkflowException
Creates a new document by document type name. The principal name passed in will be used as the document initiator. If the initiatorPrincipalNm is null or blank, the current user will be used.

Specified by:
getNewDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.getNewDocument(String, String)

getNewDocument

public Document getNewDocument(String documentTypeName)
                        throws WorkflowException
Creates a new document by document type name.

Specified by:
getNewDocument in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.getNewDocument(java.lang.String)

getByDocumentHeaderId

public Document getByDocumentHeaderId(String documentHeaderId)
                               throws WorkflowException
This is temporary until workflow 2.0 and reads from a table to get documents whose status has changed to A (approved - no outstanding approval actions requested)

Specified by:
getByDocumentHeaderId in interface DocumentService
Parameters:
documentHeaderId -
Returns:
Document
Throws:
WorkflowException

getByDocumentHeaderIdSessionless

public Document getByDocumentHeaderIdSessionless(String documentHeaderId)
                                          throws WorkflowException
Description copied from interface: DocumentService
get a document based on the document header id which is the primary key for all document types. Using this method does not require that GlobalVariables.getUserSession() be populated. Therefore, this method can be used when a HTTP request is not being processed (e.g. during workflow indexing/post-processing).

Specified by:
getByDocumentHeaderIdSessionless in interface DocumentService
Returns:
Throws:
WorkflowException
See Also:
DocumentService.getByDocumentHeaderIdSessionless(java.lang.String)

loadNotes

protected void loadNotes(Document document)
Loads the Notes for the note target on this Document.

Parameters:
document - the document for which to load the notes

getDocumentsByListOfDocumentHeaderIds

public List<Document> getDocumentsByListOfDocumentHeaderIds(Class<? extends Document> documentClass,
                                                            List<String> documentHeaderIds)
                                                     throws WorkflowException
The default implementation - this retrieves all documents by a list of documentHeader for a given class.

Specified by:
getDocumentsByListOfDocumentHeaderIds in interface DocumentService
Returns:
List of fully-populated documents
Throws:
WorkflowException
See Also:
DocumentService.getDocumentsByListOfDocumentHeaderIds(java.lang.Class, java.util.List)

validateAndPersistDocument

public Document validateAndPersistDocument(Document document,
                                           KualiDocumentEvent event)
                                    throws ValidationException
Validates and persists a document.

Specified by:
validateAndPersistDocument in interface DocumentService
Parameters:
document - Document
event - KualiDocumentEvent
Throws:
ValidationException

prepareWorkflowDocument

public void prepareWorkflowDocument(Document document)
                             throws WorkflowException
Sets the title and app document id in the flex document

Specified by:
prepareWorkflowDocument in interface DocumentService
Parameters:
document -
Throws:
WorkflowException

updateDocument

public Document updateDocument(Document document)
This is to allow for updates of document statuses and other related requirements for updates outside of the initial save and route

Specified by:
updateDocument in interface DocumentService

createNoteFromDocument

public Note createNoteFromDocument(Document document,
                                   String text)
Description copied from interface: DocumentService
This method creates a note from a given document and note text. The resulting Note will have it's note type set to the value of Document.getNoteType(). Additionally, it's remoteObjectId will be set to the object id of the document's note target.

Specified by:
createNoteFromDocument in interface DocumentService
Parameters:
document - the document from which to use the note type and note target when creating the note
text - the text value to include in the resulting note
Returns:
the note that was created
See Also:
DocumentService.createNoteFromDocument(org.kuali.rice.krad.document.Document, java.lang.String)

saveDocumentNotes

public boolean saveDocumentNotes(Document document)
Description copied from interface: DocumentService
Saves the notes associated with the given document if they are in a state where they can be saved. In certain cases they may not be ready to be saved. For example, in maintenance documents where the notes are associated with the business object instead of the document header, the notes cannot be saved until the business object itself has been persisted.

Specified by:
saveDocumentNotes in interface DocumentService
Parameters:
document - the document for which to save notes
Returns:
true if the notes were saved, false if they were not
See Also:
DocumentService.saveDocumentNotes(org.kuali.rice.krad.document.Document)

sendNoteRouteNotification

public void sendNoteRouteNotification(Document document,
                                      Note note,
                                      Person sender)
                               throws WorkflowException
Description copied from interface: DocumentService
Builds an workflow notification request for the note and sends it to note recipient.

Specified by:
sendNoteRouteNotification in interface DocumentService
Parameters:
document - - document that contains the note
note - - note to notify
sender - - user who is sending the notification
Throws:
WorkflowException
See Also:
DocumentService

isNoteTargetReady

protected boolean isNoteTargetReady(Document document)
Determines if the given document's note target is ready for notes to be attached and persisted against it. This method verifies that the document's note target is non-null as well as checking that it has a non-empty object id.

Parameters:
document - the document on which to check for note target readiness
Returns:
true if the note target is ready, false otherwise

sendAdHocRequests

public void sendAdHocRequests(Document document,
                              String annotation,
                              List<AdHocRouteRecipient> adHocRecipients)
                       throws WorkflowException
Specified by:
sendAdHocRequests in interface DocumentService
Throws:
WorkflowException
See Also:
DocumentService.sendAdHocRequests(org.kuali.rice.krad.document.Document, String, java.util.List)

setDateTimeService

public void setDateTimeService(DateTimeService dateTimeService)

getDateTimeService

protected DateTimeService getDateTimeService()

setNoteService

public void setNoteService(NoteService noteService)

getNoteService

protected NoteService getNoteService()

setBusinessObjectService

public void setBusinessObjectService(BusinessObjectService businessObjectService)

getBusinessObjectService

protected BusinessObjectService getBusinessObjectService()

setWorkflowDocumentService

public void setWorkflowDocumentService(WorkflowDocumentService workflowDocumentService)

getWorkflowDocumentService

protected WorkflowDocumentService getWorkflowDocumentService()

setDocumentDao

public void setDocumentDao(DocumentDao documentDao)

getDocumentDao

protected DocumentDao getDocumentDao()

setDataDictionaryService

public void setDataDictionaryService(DataDictionaryService dataDictionaryService)

getDataDictionaryService

protected DataDictionaryService getDataDictionaryService()

setDocumentHeaderService

public void setDocumentHeaderService(DocumentHeaderService documentHeaderService)

getDocumentHeaderService

protected DocumentHeaderService getDocumentHeaderService()

getDocumentDictionaryService

protected DocumentDictionaryService getDocumentDictionaryService()

setDocumentDictionaryService

public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService)

getPersonService

public PersonService getPersonService()

setKualiConfigurationService

public void setKualiConfigurationService(ConfigurationService kualiConfigurationService)


Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.