public interface DocumentAPI
A document can be stored directly with the process instance, or by reference. If you store a document by reference, the process instance contains a document object that has metadata describing the document: its name, content MimeType, the name of the file of the document, and a URL giving the location of the document. The choice of direct local storage or storage by reference depends on the performance profile of document access within an instance of the process. If you require frequent and rapid access to update the document and the document is not large, use direct storage. If the document is large or is not accessed frequently within a process instance, or is not updated by the process, store it by reference.
Multiple versions of a document can be stored. You can retrieve the latest version or the version that was current at a given milestone (for example process instantiation, or activity completion).
Modifier and Type | Method and Description |
---|---|
Document |
attachDocument(long processInstanceId,
String documentName,
String fileName,
String mimeType,
byte[] documentContent)
Attach the given document to the specified process instance.
The content is stored to enable later retrieval. |
Document |
attachDocument(long processInstanceId,
String documentName,
String fileName,
String mimeType,
String url)
Attach a document by reference to the specified process instance.
The document itself does not contain content but is a reference to external content specified by its URL. |
Document |
attachNewDocumentVersion(long processInstanceId,
String documentName,
String contentFileName,
String contentMimeType,
byte[] documentContent)
Attach a new document version to the specified process instance.
|
Document |
attachNewDocumentVersion(long processInstanceId,
String documentName,
String fileName,
String mimeType,
String url)
Attach a new version of a document by reference to the specified process instance.
|
ArchivedDocument |
getArchivedProcessDocument(long sourceObjectId)
Get an ArchivedDocument based on it's id.
|
ArchivedDocument |
getArchivedVersionOfProcessDocument(long sourceObjectId)
Get the original version of the document with the specified identifier.
|
Document |
getDocument(long documentId)
Get the document with the specified identifier.
|
Document |
getDocumentAtActivityInstanceCompletion(long activityInstanceId,
String documentName)
Get the version of the named document when the specified activity completed.
|
Document |
getDocumentAtProcessInstantiation(long processInstanceId,
String documentName)
Get the version of the named document that was current when the specified process instance is instantiated.
|
byte[] |
getDocumentContent(String storageId)
Get content of the document with the specified identifier.
|
Document |
getLastDocument(long processInstanceId,
String documentName)
Get the last version of the named document for the specified process instance.
|
List<Document> |
getLastVersionOfDocuments(long processInstanceId,
int pageIndex,
int numberPerPage,
DocumentCriterion pagingCriterion)
Get the latest version of all documents attached to the specified process instance.
|
long |
getNumberOfDocuments(long processInstanceId)
Get the number of documents attached to the specified process instance.
|
SearchResult<ArchivedDocument> |
searchArchivedDocuments(SearchOptions searchOptions)
Search for archived documents that meet the search options.
|
SearchResult<ArchivedDocument> |
searchArchivedDocumentsSupervisedBy(long userId,
SearchOptions searchOptions)
Search for archived documents that match the search options and are supervised by the specified user.
|
SearchResult<Document> |
searchDocuments(SearchOptions searchOptions)
Search for documents that match the search options.
|
SearchResult<Document> |
searchDocumentsSupervisedBy(long userId,
SearchOptions searchOptions)
Search for documents that match the search options and are supervised by the specified user.
|
Document attachDocument(long processInstanceId, String documentName, String fileName, String mimeType, String url) throws ProcessInstanceNotFoundException, DocumentAttachmentException
processInstanceId
- The identifier of the process instancedocumentName
- The name of the documentfileName
- The filename of the document contentmimeType
- The MimeType of the document contenturl
- The URL of the document contentProcessInstanceNotFoundException
- when the processInstanceId does not refer to an existing process instanceInvalidSessionException
- when the session is not validDocumentAttachmentException
- when an error occurs while attaching the documentDocument attachDocument(long processInstanceId, String documentName, String fileName, String mimeType, byte[] documentContent) throws ProcessInstanceNotFoundException, DocumentAttachmentException
processInstanceId
- The identifier of the process instancedocumentName
- The name of the documentfileName
- The name of the file containing the documentmimeType
- The MimeType of the document contentdocumentContent
- The content of the documentProcessInstanceNotFoundException
- when the processInstanceId does not refer to an existing process instanceInvalidSessionException
- when the session is not validDocumentAttachmentException
- when an error occurs while attaching the documentDocument attachNewDocumentVersion(long processInstanceId, String documentName, String fileName, String mimeType, String url) throws DocumentAttachmentException
processInstanceId
- The identifier of the process instancedocumentName
- The name of the documentfileName
- The name of the file containing the documentmimeType
- The MimeType of the document contenturl
- The URL of the document contentInvalidSessionException
- when the session is not validDocumentAttachmentException
- when an error occurs while attaching the new version of the documentDocument attachNewDocumentVersion(long processInstanceId, String documentName, String contentFileName, String contentMimeType, byte[] documentContent) throws DocumentAttachmentException
processInstanceId
- The identifier of the process instancedocumentName
- The name of the documentcontentFileName
- The name of the file containing the content of the documentcontentMimeType
- The MimeType of the document contentdocumentContent
- The content of the documentInvalidSessionException
- when the session is not validDocumentAttachmentException
- when an error occurs while attaching the new version of the documentDocument getDocument(long documentId) throws DocumentNotFoundException
documentId
- The identifier of the document to retrieveDocumentNotFoundException
- when the document identifier does not refer to an existing documentInvalidSessionException
- when the session is not validList<Document> getLastVersionOfDocuments(long processInstanceId, int pageIndex, int numberPerPage, DocumentCriterion pagingCriterion) throws ProcessInstanceNotFoundException, DocumentException
processInstanceId
- The identifier of the process instancepageIndex
- The index of the pagenumberPerPage
- The number of documents to list per pagepagingCriterion
- the sort criterion for the returned listProcessInstanceNotFoundException
- when the specified processInstanceId does not refer to an existing process instanceInvalidSessionException
- when the session is not validDocumentException
- when any other error occurs during document handlingbyte[] getDocumentContent(String storageId) throws DocumentNotFoundException
storageId
- the id of the document to retrive the content fromDocumentNotFoundException
- when the specified documentId does not refer to an existing documentInvalidSessionException
- when the session is note validDocument getLastDocument(long processInstanceId, String documentName) throws DocumentNotFoundException
processInstanceId
- The identifier of the process instance that the document is attached todocumentName
- The name of the documentInvalidSessionException
- when the session is not validDocumentNotFoundException
- when the specified documentName does not refer to an existing document attached to this process instanceDocument getDocumentAtProcessInstantiation(long processInstanceId, String documentName) throws DocumentNotFoundException
processInstanceId
- The identifier of the process instancedocumentName
- The name of the documentInvalidSessionException
- when the session is not validDocumentNotFoundException
- when the specified documentName does not refer to a document attached to the specified process instanceDocument getDocumentAtActivityInstanceCompletion(long activityInstanceId, String documentName) throws DocumentNotFoundException
activityInstanceId
- The identifier of the activity instancedocumentName
- The name of the documentDocumentNotFoundException
- when the specified documentName does not refer to an existing document attached to the process instance that contains the activityInvalidSessionException
- when the session is not validlong getNumberOfDocuments(long processInstanceId) throws DocumentException
processInstanceId
- The process instance identifierInvalidSessionException
- when the session is not validDocumentException
- when an error occurs during document handlingSearchResult<Document> searchDocuments(SearchOptions searchOptions) throws SearchException
searchOptions
- A SearchOptions
object defining the search optionsInvalidSessionException
- when the session is not validSearchException
- when an error occurs during the searchSearchResult<Document> searchDocumentsSupervisedBy(long userId, SearchOptions searchOptions) throws UserNotFoundException, SearchException
userId
- The identifier of the supervising usersearchOptions
- A SearchOptions
object defining the search optionsInvalidSessionException
- when the session is not validUserNotFoundException
- when the specified userId does not refer to an existing userSearchException
- when an error occurs during the searchSearchResult<ArchivedDocument> searchArchivedDocuments(SearchOptions searchOptions) throws SearchException
searchOptions
- A SearchOptions
object defining the search optionsInvalidSessionException
- when the session is not validSearchException
- when an error occurs during the searchSearchResult<ArchivedDocument> searchArchivedDocumentsSupervisedBy(long userId, SearchOptions searchOptions) throws UserNotFoundException, SearchException
userId
- The identifier of the supervising usersearchOptions
- A SearchOptions
object defining the search optionsInvalidSessionException
- when the session is not validUserNotFoundException
- when the specified userId does not refer to an existing userSearchException
- when an error occurs during the searchArchivedDocument getArchivedProcessDocument(long sourceObjectId) throws ArchivedDocumentNotFoundException
sourceObjectId
- The identifier of the documentInvalidSessionException
- when the session is not validArchivedDocumentNotFoundException
- when the specified identifier does not refer to an archived documentArchivedDocument getArchivedVersionOfProcessDocument(long sourceObjectId) throws ArchivedDocumentNotFoundException
sourceObjectId
- The identifier of the documentInvalidSessionException
- when the session is not validArchivedDocumentNotFoundException
- when the specified identifier does not refer to an archived documentCopyright © 2013 BonitaSoft. All Rights Reserved.