Interface DocumentService
-
- All Known Implementing Classes:
DocumentServiceImpl
public interface DocumentService- Since:
- 6.0
- Author:
- Nicolas Chabanoles, Matthieu Chaffotte, Baptiste Mesta
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDOCUMENTstatic java.lang.StringDOCUMENTMAPPINGstatic java.lang.StringSUPERVISED_BY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidarchive(AbstractSDocumentMapping documentMapping, long archiveDate)archive the specific document mapping in the archive dateSMappedDocumentattachDocumentToProcessInstance(SDocument document, long processInstanceId, java.lang.String name, java.lang.String description)Save a documentSMappedDocumentattachDocumentToProcessInstance(SDocument document, long processInstanceId, java.lang.String name, java.lang.String description, int index)Save a documentvoiddeleteArchivedDocuments(java.util.List<java.lang.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(SLightDocument document)voiddeleteDocumentsFromProcessInstance(java.lang.Long processInstanceId)Delete documents from a specified process instancejava.lang.StringgenerateDocumentURL(java.lang.String name, java.lang.String contentStorageId)SAMappedDocumentgetArchivedDocument(long archivedProcessDocumentId)Retrieve an archived documentSAMappedDocumentgetArchivedVersionOfProcessDocument(long documentId)Get the archived version corresponding to a documentSLightDocumentgetDocument(long documentId)Get document by its idbyte[]getDocumentContent(java.lang.String documentId)Get document content by document idjava.util.List<SMappedDocument>getDocumentList(java.lang.String documentName, long processInstanceId, int fromIndex, int numberOfResult)Get a list of document.java.util.List<AbstractSMappedDocument>getDocumentList(java.lang.String documentName, long processInstanceId, long time)Get a list of document at a given time.java.util.List<SMappedDocument>getDocumentsOfProcessInstance(long processInstanceId, int fromIndex, int numberPerPage, java.lang.String field, OrderByType order)Get a list of documents for specific process instance, this can be used for paginationSMappedDocumentgetMappedDocument(long mappingId)Get document with mapping by its mapping idSMappedDocumentgetMappedDocument(long processInstanceId, java.lang.String documentName)Get document with mapping by its name in the specific process instanceAbstractSMappedDocumentgetMappedDocument(long processInstanceId, java.lang.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, java.lang.String documentName)Remove the document with the specified process instance and namevoidremoveCurrentVersion(AbstractSMappedDocument document)Remove this document.voidremoveDocument(AbstractSMappedDocument mappedDocument)java.util.List<SAMappedDocument>searchArchivedDocuments(QueryOptions queryOptions)Search all archived documents according to the query criteria.java.util.List<SAMappedDocument>searchArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions)Search all archived documents for the specific supervisorjava.util.List<SMappedDocument>searchDocuments(QueryOptions queryOptions)Search all documents according to the query criteriajava.util.List<SMappedDocument>searchDocumentsSupervisedBy(long userId, QueryOptions queryOptions)Search all documents for the specific supervisorSMappedDocumentupdateDocument(long documentId, SDocument sDocument)update the document having the documentId with this new versionSMappedDocumentupdateDocument(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 Detail
-
DOCUMENT
static final java.lang.String DOCUMENT
- See Also:
- Constant Field Values
-
DOCUMENTMAPPING
static final java.lang.String DOCUMENTMAPPING
- See Also:
- Constant Field Values
-
SUPERVISED_BY
static final java.lang.String SUPERVISED_BY
- See Also:
- Constant Field Values
-
-
Method Detail
-
attachDocumentToProcessInstance
SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, java.lang.String name, java.lang.String description) throws SObjectCreationException
Save a document- Parameters:
document- the document to storeprocessInstanceId- the process instance id to attach the document toname-description-- Returns:
- The document image from database
- Throws:
SObjectCreationException- when the storage has failed
-
attachDocumentToProcessInstance
SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, java.lang.String name, java.lang.String description, int index) throws SObjectCreationException, SObjectAlreadyExistsException
Save a document- Parameters:
document- the document to storeprocessInstanceId- the process instance id to attach the document toname-description-index- the index in the list of document- Returns:
- The document image from database
- Throws:
SObjectCreationException- when the storage has failedSObjectAlreadyExistsException
-
removeCurrentVersion
void removeCurrentVersion(AbstractSMappedDocument document) throws SObjectModificationException
Remove this document.this archive and delete mapping on 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, java.lang.String documentName) throws SObjectNotFoundException, SObjectModificationExceptionRemove the document with the specified process instance and namethis archive and delete mapping on 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
byte[] getDocumentContent(java.lang.String documentId) throws SObjectNotFoundExceptionGet 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
SLightDocument getDocument(long documentId) throws SObjectNotFoundException, SBonitaReadException
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, java.lang.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
java.util.List<SMappedDocument> getDocumentsOfProcessInstance(long processInstanceId, int fromIndex, int numberPerPage, java.lang.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 returnedorder-field-- Returns:
- a list of SDocumentMapping objects
- Throws:
SBonitaReadException
-
getNumberOfDocumentsOfProcessInstance
long getNumberOfDocumentsOfProcessInstance(long processInstanceId) throws SBonitaReadExceptionGet 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, java.lang.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
long getNumberOfDocuments(QueryOptions queryOptions) throws SBonitaReadException
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
java.util.List<SMappedDocument> searchDocuments(QueryOptions queryOptions) throws SBonitaReadException
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 SBonitaReadExceptionGet 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
java.util.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
long getNumberOfArchivedDocuments(QueryOptions queryOptions) throws SBonitaReadException
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
-
removeDocument
void removeDocument(AbstractSMappedDocument mappedDocument) throws SObjectModificationException
- Throws:
SObjectModificationException
-
searchArchivedDocuments
java.util.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 SBonitaReadExceptionGet 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
java.util.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
java.lang.String generateDocumentURL(java.lang.String name, java.lang.String contentStorageId)
-
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(SLightDocument document) throws SObjectModificationException
- Throws:
SObjectModificationException
-
deleteDocumentsFromProcessInstance
void deleteDocumentsFromProcessInstance(java.lang.Long processInstanceId) throws SBonitaReadException, SObjectModificationExceptionDelete documents from a specified process instance- Parameters:
processInstanceId-- Throws:
SObjectModificationExceptionSBonitaReadException- Since:
- 6.1
-
deleteArchivedDocuments
void deleteArchivedDocuments(java.util.List<java.lang.Long> processInstanceId) throws SBonitaReadException, SRecorderExceptiondelete 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
java.util.List<SMappedDocument> getDocumentList(java.lang.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:
SRecorderExceptionSObjectModificationException
-
getDocumentList
java.util.List<AbstractSMappedDocument> getDocumentList(java.lang.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, SRecorderExceptionRemove 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
-
-