Interface DocumentService
- All Known Implementing Classes:
DocumentServiceImpl
public interface DocumentService
- Since:
- 6.0
- Author:
- Nicolas Chabanoles, Matthieu Chaffotte, Baptiste Mesta
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidarchive(AbstractSDocumentMapping documentMapping, long archiveDate) archive the specific document mapping in the archive dateattachDocumentToProcessInstance(SDocument document, long processInstanceId, String name, String description) Save a documentattachDocumentToProcessInstance(SDocument document, long processInstanceId, String name, String description, int index) Save a documentvoiddeleteArchivedDocuments(List<Long> processInstanceId) delete archived documents mapping and documents links to a set of processesvoiddeleteContentOfArchivedDocument(long archivedDocumentId) Remove the content of an archived document while keeping it's metadata.voiddeleteDocument(long documentId) Delete a document by its id.voiddeleteDocument(SLightDocument document) Delete the given document.voiddeleteDocumentContentsForProcessInstance(Long processInstanceId) Delete the document content of a process instance.voiddeleteDocumentsFromProcessInstance(Long processInstanceId) Delete documents and their associated mappings to a specified process instance.voiddeleteMappedDocument(AbstractSMappedDocument mappedDocument) Delete the given document mapping without removing the document content.generateDocumentURL(String name, String contentStorageId) getArchivedDocument(long archivedProcessDocumentId) Retrieve an archived documentgetArchivedVersionOfProcessDocument(long documentId) Get the archived version corresponding to a documentgetDocument(long documentId) Get document by its idbyte[]getDocumentContent(String documentId) Get document content by document idgetDocumentList(String documentName, long processInstanceId, int fromIndex, int numberOfResult) Get a list of document.getDocumentList(String documentName, long processInstanceId, long time) Get a list of document at a given time.getDocumentsOfProcessInstance(long processInstanceId, int fromIndex, int numberPerPage, String field, OrderByType order) Get a list of documents for specific process instance, this can be used for paginationgetMappedDocument(long mappingId) Get document with mapping by its mapping idgetMappedDocument(long processInstanceId, String documentName) Get document with mapping by its name in the specific process instancegetMappedDocument(long processInstanceId, String documentName, long time) Get name specified document archived in a certain time in the process instancelonggetNumberOfArchivedDocuments(QueryOptions queryOptions) Get total number of archived documents according to the query criterialonggetNumberOfArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions) Get total number of archived documents for the specific supervisorlonggetNumberOfDocuments(QueryOptions queryOptions) Get total number of document according to the query criterialonggetNumberOfDocumentsOfProcessInstance(long processInstanceId) Get total number of documents in the specific process instancelonggetNumberOfDocumentsSupervisedBy(long userId, QueryOptions queryOptions) Get total number of documents for the specific supervisorvoidremoveCurrentVersion(long processInstanceId, String documentName) Remove the document with the specified process instance and name.voidremoveCurrentVersion(AbstractSMappedDocument document) Remove this document.searchArchivedDocuments(QueryOptions queryOptions) Search all archived documents according to the query criteria.searchArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions) Search all archived documents for the specific supervisorsearchDocuments(QueryOptions queryOptions) Search all documents according to the query criteriasearchDocumentsSupervisedBy(long userId, QueryOptions queryOptions) Search all documents for the specific supervisorupdateDocument(long documentId, SDocument sDocument) update the document having the documentId with this new versionupdateDocument(AbstractSDocumentMapping documentToUpdate, SDocument sDocument) voidupdateDocumentIndex(AbstractSDocumentMapping mappedDocument, int index) update the index of a document inside the listvoidupdateDocumentOfList(AbstractSDocumentMapping mappedDocument, SDocument document, int index)
-
Field Details
-
DOCUMENT
- See Also:
-
DOCUMENTMAPPING
- See Also:
-
SUPERVISED_BY
- See Also:
-
-
Method Details
-
attachDocumentToProcessInstance
SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, String name, String description) throws SObjectCreationException Save a document- Parameters:
document- the document to storeprocessInstanceId- the process instance id to attach the document to- Returns:
- The document image from database
- Throws:
SObjectCreationException- when the storage has failed
-
attachDocumentToProcessInstance
SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, String name, String description, int index) throws SObjectCreationException, SObjectAlreadyExistsException Save a document- Parameters:
document- the document to storeprocessInstanceId- the process instance id to attach the document toindex- the index in the list of document- Returns:
- The document image from database
- Throws:
SObjectCreationException- when the storage has failedSObjectAlreadyExistsException
-
removeCurrentVersion
Remove this document.This archives and deletes mapping to the process, i.e. the content of the document itself will be kept in database, use
deleteContentOfArchivedDocument(long)to delete the content.- Parameters:
document- the document mapping to remove- Throws:
SObjectModificationException
-
removeCurrentVersion
void removeCurrentVersion(long processInstanceId, String documentName) throws SObjectNotFoundException, SObjectModificationException Remove the document with the specified process instance and name.This archives and deletes mapping to the process, i.e. the content of the document itself will be kept in database, use
deleteContentOfArchivedDocument(long)to delete the content.- Parameters:
processInstanceId- id of the process having the documentdocumentName- name of the document- Throws:
SObjectNotFoundExceptionSObjectModificationException
-
getDocumentContent
Get document content by document id- Parameters:
documentId- identifier of the document- Returns:
- document content
- Throws:
SObjectNotFoundException
-
getMappedDocument
SMappedDocument getMappedDocument(long mappingId) throws SObjectNotFoundException, SBonitaReadException Get document with mapping by its mapping id- Parameters:
mappingId- identifier of the mapping of the document- Returns:
- an SDocumentMapping object with id corresponding to the parameter
- Throws:
SObjectNotFoundExceptionSBonitaReadException
-
getDocument
Get document by its id- Parameters:
documentId- identifier of document- Returns:
- an SDocumentMapping object with id corresponding to the parameter
- Throws:
SObjectNotFoundExceptionSBonitaReadException
-
getMappedDocument
SMappedDocument getMappedDocument(long processInstanceId, String documentName) throws SObjectNotFoundException, SBonitaReadException Get document with mapping by its name in the specific process instance- Parameters:
processInstanceId- identifier of process instancedocumentName- name of process document- Returns:
- the corresponding SDocumentMapping object
- Throws:
SObjectNotFoundExceptionSBonitaReadException
-
getDocumentsOfProcessInstance
List<SMappedDocument> getDocumentsOfProcessInstance(long processInstanceId, int fromIndex, int numberPerPage, String field, OrderByType order) throws SBonitaReadException Get a list of documents for specific process instance, this can be used for pagination- Parameters:
processInstanceId- identifier of process instancefromIndex- Index of the record to be retrieved from. First record has index 0numberPerPage- Number of result we want to get. Maximum number of result returned- Returns:
- a list of SDocumentMapping objects
- Throws:
SBonitaReadException
-
getNumberOfDocumentsOfProcessInstance
Get total number of documents in the specific process instance- Parameters:
processInstanceId- identifier of process instance- Returns:
- number of documents in the process instance
- Throws:
SBonitaReadException
-
getMappedDocument
AbstractSMappedDocument getMappedDocument(long processInstanceId, String documentName, long time) throws SObjectNotFoundException, SBonitaReadException Get name specified document archived in a certain time in the process instance- Parameters:
processInstanceId- identifier of process instancedocumentName- name of documenttime- the archived time of document- Returns:
- an SDocumentMapping object archived in the specific time or not archived
- Throws:
SObjectNotFoundExceptionSBonitaReadException
-
getNumberOfDocuments
Get total number of document according to the query criteria- Parameters:
queryOptions- a QueryOptions object containing some query conditions- Returns:
- number of document satisfied to the query criteria
- Throws:
SBonitaReadException
-
searchDocuments
Search all documents according to the query criteria- Parameters:
queryOptions- a QueryOptions object containing some query conditions- Returns:
- a list of SDocumentMapping objects
- Throws:
SBonitaReadException
-
getNumberOfDocumentsSupervisedBy
long getNumberOfDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Get total number of documents for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a QueryOptions object containing some query conditions- Returns:
- number of documents for the specific supervisor
- Throws:
SBonitaReadException
-
searchDocumentsSupervisedBy
List<SMappedDocument> searchDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Search all documents for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a QueryOptions object containing some query conditions- Returns:
- a list of SDocumentMapping objects
- Throws:
SBonitaReadException
-
getNumberOfArchivedDocuments
Get total number of archived documents according to the query criteria- Parameters:
queryOptions- a QueryOptions object containing some query conditions- Returns:
- number of archived documents
- Throws:
SBonitaReadException
-
deleteMappedDocument
void deleteMappedDocument(AbstractSMappedDocument mappedDocument) throws SObjectModificationException Delete the given document mapping without removing the document content.- Parameters:
mappedDocument- the document mapping to delete- Throws:
SObjectModificationException- if an error occurred during the deletion
-
searchArchivedDocuments
List<SAMappedDocument> searchArchivedDocuments(QueryOptions queryOptions) throws SBonitaReadException Search all archived documents according to the query criteria.- Parameters:
queryOptions- a QueryOptions object containing some query conditions- Returns:
- a list of SADocumentMapping objects
- Throws:
SBonitaReadException
-
getNumberOfArchivedDocumentsSupervisedBy
long getNumberOfArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Get total number of archived documents for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a QueryOptions object containing some query conditions- Returns:
- number of archived documents for the specific supervisor
- Throws:
SBonitaReadException
-
searchArchivedDocumentsSupervisedBy
List<SAMappedDocument> searchArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException Search all archived documents for the specific supervisor- Parameters:
userId- identifier of supervisor userqueryOptions- a QueryOptions object containing some query conditions- Returns:
- a list of SADocumentMapping objects
- Throws:
SBonitaReadException
-
getArchivedVersionOfProcessDocument
SAMappedDocument getArchivedVersionOfProcessDocument(long documentId) throws SObjectNotFoundException Get the archived version corresponding to a document- Parameters:
documentId- identifier of process document- Returns:
- the archive of the corresponding document
- Throws:
SObjectNotFoundException- when the document does not exist
-
generateDocumentURL
-
getArchivedDocument
SAMappedDocument getArchivedDocument(long archivedProcessDocumentId) throws SObjectNotFoundException Retrieve an archived document- Parameters:
archivedProcessDocumentId- the id of the archived document- Returns:
- the corresponding archive
- Throws:
SObjectNotFoundException- when the archive does not exist
-
deleteDocument
void deleteDocument(long documentId) throws SObjectNotFoundException, SBonitaReadException, SObjectModificationException Delete a document by its id. It does not delete potential mappings, which might throw an error if they are not deleted beforehand.- Parameters:
documentId- the id of the document to delete- Throws:
SObjectNotFoundException- if the document to delete does not existSBonitaReadException- if an error occurred while getting the documentSObjectModificationException- if an error occurred during the deletion
-
deleteDocument
Delete the given document. It does not delete potential mappings, which might throw an error if they are not deleted beforehand.- Parameters:
document- the document to delete- Throws:
SObjectModificationException- if an error occurred during the deletion
-
deleteDocumentsFromProcessInstance
void deleteDocumentsFromProcessInstance(Long processInstanceId) throws SBonitaReadException, SObjectModificationException, SObjectNotFoundException Delete documents and their associated mappings to a specified process instance.- Parameters:
processInstanceId- the id of the process instance to delete documents from- Throws:
SBonitaReadException- if an error occurred while getting the documents or their mappingsSObjectModificationException- if an error occurred during the deletionSObjectNotFoundException- if an element does not exist- Since:
- 6.1
-
deleteDocumentContentsForProcessInstance
void deleteDocumentContentsForProcessInstance(Long processInstanceId) throws SBonitaReadException, SObjectModificationException, SObjectNotFoundException Delete the document content of a process instance. It only deletes the content, not the document mapping. Note that to reach the document content, the document mapping must still exist at the time of call: indeed, this is the only way to reach the content from the process instance. So if you need to call this method and also delete the document mappings, ensure this method is called first.- Parameters:
processInstanceId- the process instance id to delete the document contents from- Throws:
SBonitaReadExceptionSObjectModificationExceptionSObjectNotFoundException
-
deleteArchivedDocuments
void deleteArchivedDocuments(List<Long> processInstanceId) throws SBonitaReadException, SRecorderException delete archived documents mapping and documents links to a set of processes- Parameters:
processInstanceId- ids of the source process instances- Throws:
SBonitaReadExceptionSRecorderException
-
archive
void archive(AbstractSDocumentMapping documentMapping, long archiveDate) throws SObjectModificationException archive the specific document mapping in the archive date- Parameters:
documentMapping- document mapping will be archivedarchiveDate- the archive time- Throws:
SObjectModificationException- Since:
- 6.4.0
-
updateDocumentOfList
void updateDocumentOfList(AbstractSDocumentMapping mappedDocument, SDocument document, int index) throws SObjectModificationException - Parameters:
mappedDocument- the document to updatedocument- the new contentindex- the new index- Throws:
SObjectModificationException- Since:
- 6.4.0
-
updateDocumentIndex
void updateDocumentIndex(AbstractSDocumentMapping mappedDocument, int index) throws SObjectModificationException update the index of a document inside the list- Parameters:
mappedDocument- the document to updateindex- the new index- Throws:
SObjectModificationException- Since:
- 6.4.0
-
getDocumentList
List<SMappedDocument> getDocumentList(String documentName, long processInstanceId, int fromIndex, int numberOfResult) throws SBonitaReadException Get a list of document. if there is no document in the list returns an empty list- Parameters:
documentName- the name of the document listprocessInstanceId- the id of the process instance that contains the listfromIndex- pagination parameternumberOfResult- pagination parameter- Returns:
- the list of document
- Throws:
SBonitaReadException- Since:
- 6.4.0
-
updateDocument
SMappedDocument updateDocument(AbstractSDocumentMapping documentToUpdate, SDocument sDocument) throws SObjectModificationException - Parameters:
documentToUpdate- the document mapping to udpatesDocument- the value to set th emapping with- Returns:
- the updated document mapping
- Throws:
SObjectModificationException
-
getDocumentList
List<AbstractSMappedDocument> getDocumentList(String documentName, long processInstanceId, long time) throws SBonitaReadException Get a list of document at a given time. if there is no document in the list returns an empty list.elements are taken from archive and from non archived mapping if the process is still running
- Parameters:
documentName- the name of the document listprocessInstanceId- the id of the process instance that contains the listtime- time when the list was like that- Returns:
- the list of document
- Throws:
SBonitaReadException- Since:
- 6.4.0
-
deleteContentOfArchivedDocument
void deleteContentOfArchivedDocument(long archivedDocumentId) throws SObjectNotFoundException, SBonitaReadException, SRecorderException Remove the content of an archived document while keeping it's metadata.After calling this method you will not be able to retrieve the content of the document since it will be erased from the database. This method can be useful for keeping history of a document without overloading the database.
- Parameters:
archivedDocumentId- the id of the archived document to remove content on- Throws:
SObjectNotFoundException- if the document to delete does not existSBonitaReadExceptionSRecorderException- Since:
- 6.4.0
-
updateDocument
SMappedDocument updateDocument(long documentId, SDocument sDocument) throws SObjectNotFoundException, SObjectModificationException, SBonitaReadException update the document having the documentId with this new version- Parameters:
documentId- the id of the document to updatesDocument- the new version of the document @return- Throws:
SObjectNotFoundExceptionSObjectModificationExceptionSBonitaReadException
-