Package org.kuali.rice.krad.service
Interface DocumentService
public interface DocumentService
Defines various operations that support the Document framework.
The calling code should always use any returned Document object for future operations since a new object will be
created if a passed-in document is saved.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionacknowledgeDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) acknowledgeDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) Acknowledge the document, optionally providing an annotation for the acknowledgement which will show up in the route log of the document, and optionally providing a list of ad hoc recipients for the document.approveDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) approveDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRoutingRecipients) Save and then approve the document, optionally providing an annotation which will show up in the route log of the document for the action taken, and optionally providing a list of ad hoc recipients for the document.blanketApproveDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) blanketApproveDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) Blanket approve the document which will save the document, approve the document, and stand in for an approve for all typically generated approval actions requested for this document.cancelDocument(Document document, String annotation) Cancel the document, without saving, optionally providing an annotation for the disapproval which will show up in the route log of the document for the action taken.clearDocumentFyi(Document document, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) clearDocumentFyi(Document document, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) Clear the fyi requests for the document, optionally providing a list of ad hoc recipients for the document, which should be restricted to action requested of fyi as all other actions requested will be discarded.completeDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) completeDocument(Document document, String annotation, List adHocRecipients) Save and then complete the document, optionally providing an annotation which will show up in the route log of the document for the action taken, and optionally providing a list of ad hoc recipients for the documentorg.kuali.rice.krad.bo.NotecreateNoteFromDocument(Document document, String text) This method creates a note from the given document and note text.disapproveDocument(Document document, String annotation) Disapprove the document, without saving, optionally providing an annotation which will show up in the route log of the document for the action taken.booleandocumentExists(String documentHeaderId) getByDocumentHeaderId(String documentHeaderId) get a document based on the document header id which is the primary key for all document typesgetByDocumentHeaderIdSessionless(String documentHeaderId) get a document based on the document header id which is the primary key for all document types.getDocumentsByListOfDocumentHeaderIds(Class<? extends Document> documentClass, List<String> documentHeaderIds) This method retrieves a list of fully-populated documents given a list of document header id values.getNewDocument(Class<? extends Document> documentClass) get a new blank document instance having the given Document classgetNewDocument(String documentTypeName) get a new blank document instance based on the document type namegetNewDocument(String documentTypeName, String initiatorPrincipalNm) get a new blank document instance based on the document type name.voidprepareWorkflowDocument(Document document) Sets the title and app document id in the workflow documentrecallDocument(Document document, String annotation, boolean cancel) Recall the document, optionally providing an annotation for the recall which will show up in the route log of the document for the action taken.routeDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) routeDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRoutingRecipients) Save and then route the document, optionally providing an annotation which will show up in the route log of the document for the action taken, and optionally providing a list of ad hoc recipients for the document.saveDocument(Document document) This is a helper method that performs the same as thesaveDocument(Document, Class)method.saveDocument(Document document, Class<? extends DocumentEvent> kualiDocumentEventClass) Saves the passed-in document.saveDocument(Document document, DocumentEvent docEvent) This method saves the given document using the document event passed in.booleansaveDocumentNotes(Document document) Saves the notes associated with the given document if they are in a state where they can be saved.sendAdHocRequests(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) Send ad hoc requests for the given document to the specified node name, optionally providing an annotation which will show up in the route log of the document.sendAdHocRequests(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) Send ad hoc requests for the given document, optionally providing an annotation which will show up in the route log of the document.sendNoteRouteNotification(Document document, org.kuali.rice.krad.bo.Note note, org.kuali.rice.kim.api.identity.Person sender) Builds an workflow notification request for the note and sends it to note recipient.superUserApproveDocument(Document document, String annotation) Save and then approve the document as a super user, optionally providing an annotation which will show up in the route log of the document for the action taken.superUserCancelDocument(Document document, String annotation) Save and then cancel the document as a super user, optionally providing an annotation which will show up in the route log of the document for the action taken.superUserDisapproveDocument(Document document, String annotation) Save and then disapprove the document as a super user, optionally providing an annotation which will show up in the route log of the document for the action taken.superUserDisapproveDocumentWithoutSaving(Document document, String annotation) Disapprove the document as super user, without saving, optionally providing an annotation which will show up in the route log of the document for the action taken.updateDocument(Document document) This method is to allow for documents to be updated.validateAndPersistDocument(Document document, DocumentEvent event) Helper method used to save and validate a document
-
Method Details
-
documentExists
- Parameters:
documentHeaderId-- Returns:
- true if a document with the given documentHeaderId exists
-
getNewDocument
Document getNewDocument(String documentTypeName) throws org.kuali.rice.kew.api.exception.WorkflowException get a new blank document instance based on the document type name- Parameters:
documentTypeName-- Returns:
- new document instance
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
getNewDocument
Document getNewDocument(Class<? extends Document> documentClass) throws org.kuali.rice.kew.api.exception.WorkflowException get a new blank document instance having the given Document class- Parameters:
documentClass-- Returns:
- new document instance
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
getNewDocument
Document getNewDocument(String documentTypeName, String initiatorPrincipalNm) throws org.kuali.rice.kew.api.exception.WorkflowException get a new blank document instance based on the document type name. The principal name passed in will be used as the document initiator.- Parameters:
documentTypeName-initiatorPrincipalNm-- Returns:
- new document instance
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
getByDocumentHeaderId
Document getByDocumentHeaderId(String documentHeaderId) throws org.kuali.rice.kew.api.exception.WorkflowException get a document based on the document header id which is the primary key for all document types- Parameters:
documentHeaderId-- Returns:
- document, by id
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
getByDocumentHeaderIdSessionless
Document getByDocumentHeaderIdSessionless(String documentHeaderId) throws org.kuali.rice.kew.api.exception.WorkflowException 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).- Parameters:
documentHeaderId-- Returns:
- document, by id
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
getDocumentsByListOfDocumentHeaderIds
List<Document> getDocumentsByListOfDocumentHeaderIds(Class<? extends Document> documentClass, List<String> documentHeaderIds) throws org.kuali.rice.kew.api.exception.WorkflowException This method retrieves a list of fully-populated documents given a list of document header id values.- Parameters:
documentClass-documentHeaderIds-- Returns:
- list of fully-populated documents
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
updateDocument
This method is to allow for documents to be updated. It is currently used to update the document status as well as to allow for locked docs to be unlocked- Parameters:
document- the document to be updated- Returns:
- the updated document
-
saveDocument
This is a helper method that performs the same as thesaveDocument(Document, Class)method. The convenience of this method is that the event being used is the standard SaveDocumentEvent.- Throws:
org.kuali.rice.kew.api.exception.WorkflowException- See Also:
-
saveDocument
Document saveDocument(Document document, DocumentEvent docEvent) throws org.kuali.rice.kew.api.exception.WorkflowException This method saves the given document using the document event passed in.- Throws:
org.kuali.rice.kew.api.exception.WorkflowException- See Also:
-
saveDocument
Document saveDocument(Document document, Class<? extends DocumentEvent> kualiDocumentEventClass) throws org.kuali.rice.kew.api.exception.WorkflowException 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 DocumentEvent class when saving the document. The DocumentEvent class must implement theSaveEventinterface. 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. Also note that this method will not check the document action flags to check if a save is valid The calling code should always use the object returned from this method for future operations since a new object is created when the passed-in document is saved.- Parameters:
document- the document to be savedkualiDocumentEventClass- the event class to use when saving (class must implement the SaveEvent interface)- Returns:
- the saved document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
routeDocument
Document routeDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRoutingRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Save and then route the document, optionally providing an annotation which will show up in the route log of the document for the action taken, and optionally providing a list of ad hoc recipients for the document.- Parameters:
document- the document to be routedannotation- the annotation to appear in the route log of the documentadHocRoutingRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the saved and routed document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
approveDocument
Document approveDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRoutingRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Save and then approve the document, optionally providing an annotation which will show up in the route log of the document for the action taken, and optionally providing a list of ad hoc recipients for the document.- Parameters:
document- the document to be approvedannotation- the annotation to appear in the route log of the documentadHocRoutingRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the saved and approved document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
superUserApproveDocument
Document superUserApproveDocument(Document document, String annotation) throws org.kuali.rice.kew.api.exception.WorkflowException Save and then approve the document as a super user, optionally providing an annotation which will show up in the route log of the document for the action taken.- Parameters:
document- the document to be super user approvedannotation- the annotation to appear in the route log of the document- Returns:
- the saved and super user approved document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
superUserCancelDocument
Document superUserCancelDocument(Document document, String annotation) throws org.kuali.rice.kew.api.exception.WorkflowException Save and then cancel the document as a super user, optionally providing an annotation which will show up in the route log of the document for the action taken.- Parameters:
document- the document to be super user canceledannotation- the annotation to appear in the route log of the document- Returns:
- the saved and super user canceled document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
superUserDisapproveDocument
Document superUserDisapproveDocument(Document document, String annotation) throws org.kuali.rice.kew.api.exception.WorkflowException Save and then disapprove the document as a super user, optionally providing an annotation which will show up in the route log of the document for the action taken.- Parameters:
document- the document to be super user disapprovedannotation- the annotation to appear in the route log of the document- Returns:
- the saved and super user disapproved document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
superUserDisapproveDocumentWithoutSaving
Document superUserDisapproveDocumentWithoutSaving(Document document, String annotation) throws org.kuali.rice.kew.api.exception.WorkflowException Disapprove the document as super user, without saving, optionally providing an annotation which will show up in the route log of the document for the action taken.- Parameters:
document- the document to be super user disapprovedannotation- the annotation to appear in the route log of the document- Returns:
- the super user disapproved document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
disapproveDocument
Disapprove the document, without saving, optionally providing an annotation which will show up in the route log of the document for the action taken.- Parameters:
document- the document to be disapprovedannotation- the annotation to appear in the route log of the document- Returns:
- the disapproved document
- Throws:
Exception
-
cancelDocument
Document cancelDocument(Document document, String annotation) throws org.kuali.rice.kew.api.exception.WorkflowException Cancel the document, without saving, optionally providing an annotation for the disapproval which will show up in the route log of the document for the action taken.- Parameters:
document- the document to be canceledannotation- the annotation to appear in the route log of the document- Returns:
- the canceled document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
acknowledgeDocument
Document acknowledgeDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Acknowledge the document, optionally providing an annotation for the acknowledgement which will show up in the route log of the document, and optionally providing a list of ad hoc recipients for the 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 due to the fact that this action being taken is an acknowledgement.- Parameters:
document- the document to be acknowledgedannotation- the annotation to appear in the route log of the documentadHocRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the acknowledged document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
blanketApproveDocument
Document blanketApproveDocument(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Blanket approve the document which will save the document, 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 the action taken on the document in the route log. Also optionally a list of ad hoc recipients can be provided for the document, which should be restricted to actions requested of acknowledge and fyi as all other actions requested will be discarded.- Parameters:
document- the document to be blanket approvedannotation- the annotation to appear in the route log of the documentadHocRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the saved and blanket approved document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
clearDocumentFyi
Document clearDocumentFyi(Document document, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Clear the fyi requests for the document, optionally providing a list of ad hoc recipients for the document, which should be restricted to action requested of fyi as all other actions requested will be discarded.- Parameters:
document- the document to clear of fyi requestsadHocRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
prepareWorkflowDocument
void prepareWorkflowDocument(Document document) throws org.kuali.rice.kew.api.exception.WorkflowException Sets the title and app document id in the workflow document- Parameters:
document- the document to prepare- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
createNoteFromDocument
This method creates a note from the given document and note text. The resulting Note will have it's note type set to the value ofDocument.getNoteType(). Additionally, it's remoteObjectId will be set to the object id of the document's note target.- Parameters:
document- the document from which to use the note type and note target when creating the notetext- the text value to include in the resulting note- Returns:
- the note that was created
-
saveDocumentNotes
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.- Parameters:
document- the document for which to save notes- Returns:
- true if the notes were saved, false if they were not
-
sendAdHocRequests
Document sendAdHocRequests(Document document, String annotation, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Send ad hoc requests for the given document, optionally providing an annotation which will show up in the route log of the document. Also optionally providing a list of ad hoc recipients for the document. However if no ad hoc recipients are provided, no ad hoc requests will be sent.- Parameters:
document- the document for which the ad hoc requests are sentannotation- the annotation to appear in the route log of the documentadHocRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
sendAdHocRequests
Document sendAdHocRequests(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Send ad hoc requests for the given document to the specified node name, optionally providing an annotation which will show up in the route log of the document. Also optionally providing a list of ad hoc recipients for the document. However if no ad hoc recipients are provided, no ad hoc requests will be sent.- Parameters:
document- the document for which the ad hoc requests are sentannotation- the annotation to appear in the route log of the documentnodeName- the name of the node to attach the adhoc requests toadHocRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
sendNoteRouteNotification
Document sendNoteRouteNotification(Document document, org.kuali.rice.krad.bo.Note note, org.kuali.rice.kim.api.identity.Person sender) throws org.kuali.rice.kew.api.exception.WorkflowException Builds an workflow notification request for the note and sends it to note recipient.- Parameters:
document- - document that contains the notenote- - note to notifysender- - user who is sending the notification- Returns:
- the document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
recallDocument
Document recallDocument(Document document, String annotation, boolean cancel) throws org.kuali.rice.kew.api.exception.WorkflowException Recall the document, optionally providing an annotation for the recall which will show up in the route log of the document for the action taken.- Parameters:
document- the document to recallannotation- the annotation to appear in the route log of the documentcancel- indicates if the document should be canceled as part of the recall- Returns:
- the recalled document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException- Since:
- 2.1, 2.1
-
completeDocument
Document completeDocument(Document document, String annotation, List adHocRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException Save and then complete the document, optionally providing an annotation which will show up in the route log of the document for the action taken, and optionally providing a list of ad hoc recipients for the document- Parameters:
document- the document to completeannotation- the annotation to appear in the route log of the documentadHocRecipients- list of ad hoc recipients to which the document will be routed- Returns:
- the saved and completed document
- Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
validateAndPersistDocument
Document validateAndPersistDocument(Document document, DocumentEvent event) throws org.kuali.rice.krad.exception.ValidationException Helper method used to save and validate a document- Parameters:
document- document to be validated and persistedevent- indicates which kualiDocumentEvent was requested- Returns:
- the saved document
- Throws:
org.kuali.rice.krad.exception.ValidationException
-
routeDocument
Document routeDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException - Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
blanketApproveDocument
Document blanketApproveDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException - Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
approveDocument
Document approveDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException - Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
clearDocumentFyi
Document clearDocumentFyi(Document document, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException - Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
acknowledgeDocument
Document acknowledgeDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException - Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-
completeDocument
Document completeDocument(Document document, String annotation, String nodeName, List<org.kuali.rice.krad.bo.AdHocRouteRecipient> adHocRouteRecipients) throws org.kuali.rice.kew.api.exception.WorkflowException - Throws:
org.kuali.rice.kew.api.exception.WorkflowException
-