public class DocumentServiceImpl extends Object implements DocumentService
DOCUMENT, DOCUMENTMAPPING, SUPERVISED_BY| Constructor and Description |
|---|
DocumentServiceImpl(Recorder recorder,
ReadPersistenceService persistenceService,
SDocumentDownloadURLProvider urlProvider,
ArchiveService archiveService) |
| Modifier and Type | Method and Description |
|---|---|
void |
archive(SDocumentMapping docMapping,
long archiveDate)
archive the specific document mapping in the archive date
|
SMappedDocument |
attachDocumentToProcessInstance(SDocument document,
long processInstanceId,
String name,
String description)
Save a document
|
SMappedDocument |
attachDocumentToProcessInstance(SDocument document,
long processInstanceId,
String name,
String description,
int index)
Save a document
|
void |
deleteArchivedDocuments(List<Long> processInstanceIds)
delete archived documents mapping and documents links to a set of processes
|
void |
deleteContentOfArchivedDocument(long archivedDocumentId)
Remove the content of an archived document while keeping it's metadata.
|
void |
deleteDocument(SLightDocument document) |
void |
deleteDocumentsFromProcessInstance(Long processInstanceId)
Delete documents from a specified process instance
|
String |
generateDocumentURL(String name,
String contentStorageId) |
SAMappedDocument |
getArchivedDocument(long archivedProcessDocumentId)
Retrieve an archived document
|
SAMappedDocument |
getArchivedVersionOfProcessDocument(long documentId)
Get the archived version corresponding to a document
|
SLightDocument |
getDocument(long documentId)
Get document by its id
|
byte[] |
getDocumentContent(String documentId)
Get document content by document id
|
List<SMappedDocument> |
getDocumentList(String documentName,
long processInstanceId,
int fromIndex,
int numberOfResult)
Get a list of document.
|
List<SMappedDocument> |
getDocumentList(String documentName,
long processInstanceId,
long time)
Get a list of document at a given time.
|
List<SMappedDocument> |
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 pagination
|
SMappedDocument |
getMappedDocument(long mappingId)
Get document with mapping by its mapping id
|
SMappedDocument |
getMappedDocument(long processInstanceId,
String documentName)
Get document with mapping by its name in the specific process instance
|
SMappedDocument |
getMappedDocument(long processInstanceId,
String documentName,
long time)
Get name specified document archived in a certain time in the process instance
|
long |
getNumberOfArchivedDocuments(QueryOptions queryOptions)
Get total number of archived documents according to the query criteria
|
long |
getNumberOfArchivedDocumentsSupervisedBy(long userId,
QueryOptions queryOptions)
Get total number of archived documents for the specific supervisor
|
long |
getNumberOfDocuments(QueryOptions queryOptions)
Get total number of document according to the query criteria
|
long |
getNumberOfDocumentsOfProcessInstance(long processInstanceId)
Get total number of documents in the specific process instance
|
long |
getNumberOfDocumentsSupervisedBy(long userId,
QueryOptions queryOptions)
Get total number of documents for the specific supervisor
|
void |
removeCurrentVersion(long processInstanceId,
String documentName)
Remove the document with the specified process instance and name
|
void |
removeCurrentVersion(SMappedDocument document)
Remove this document.
|
void |
removeDocument(SMappedDocument mappedDocument) |
List<SAMappedDocument> |
searchArchivedDocuments(QueryOptions queryOptions)
Search all archived documents according to the query criteria.
|
List<SAMappedDocument> |
searchArchivedDocumentsSupervisedBy(long userId,
QueryOptions queryOptions)
Search all archived documents for the specific supervisor
|
List<SMappedDocument> |
searchDocuments(QueryOptions queryOptions)
Search all documents according to the query criteria
|
List<SMappedDocument> |
searchDocumentsSupervisedBy(long userId,
QueryOptions queryOptions)
Search all documents for the specific supervisor
|
SMappedDocument |
updateDocument(long documentId,
SDocument sDocument)
update the document having the documentId with this new version
|
SMappedDocument |
updateDocument(SDocumentMapping documentToUpdate,
SDocument sDocument) |
void |
updateDocumentIndex(SMappedDocument mappedDocument,
int index)
update the index of a document inside the list
|
void |
updateDocumentOfList(SMappedDocument mappedDocument,
SDocument document,
int index) |
public DocumentServiceImpl(Recorder recorder, ReadPersistenceService persistenceService, SDocumentDownloadURLProvider urlProvider, ArchiveService archiveService)
public SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, String name, String description) throws org.bonitasoft.engine.commons.exceptions.SObjectCreationException
DocumentServiceattachDocumentToProcessInstance in interface DocumentServicedocument - the document to storeprocessInstanceId - the process instance id to attach the document toorg.bonitasoft.engine.commons.exceptions.SObjectCreationException - when the storage has failedpublic SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, String name, String description, int index) throws org.bonitasoft.engine.commons.exceptions.SObjectCreationException, org.bonitasoft.engine.commons.exceptions.SObjectAlreadyExistsException
DocumentServiceattachDocumentToProcessInstance in interface DocumentServicedocument - the document to storeprocessInstanceId - the process instance id to attach the document toindex - the index in the list of documentorg.bonitasoft.engine.commons.exceptions.SObjectCreationException - when the storage has failedorg.bonitasoft.engine.commons.exceptions.SObjectAlreadyExistsExceptionpublic void updateDocumentOfList(SMappedDocument mappedDocument, SDocument document, int index) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
updateDocumentOfList in interface DocumentServicemappedDocument - the document to updatedocument - the new contentindex - the new indexorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic void updateDocumentIndex(SMappedDocument mappedDocument, int index) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
DocumentServiceupdateDocumentIndex in interface DocumentServicemappedDocument - the document to updateindex - the new indexorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic void deleteDocumentsFromProcessInstance(Long processInstanceId) throws SBonitaReadException, org.bonitasoft.engine.commons.exceptions.SObjectModificationException
DocumentServicedeleteDocumentsFromProcessInstance in interface DocumentServiceSBonitaReadExceptionorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic String generateDocumentURL(String name, String contentStorageId)
generateDocumentURL in interface DocumentServicepublic SAMappedDocument getArchivedDocument(long archivedProcessDocumentId) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException
DocumentServicegetArchivedDocument in interface DocumentServicearchivedProcessDocumentId - the id of the archived documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundException - when the archive does not existpublic SAMappedDocument getArchivedVersionOfProcessDocument(long documentId) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException
DocumentServicegetArchivedVersionOfProcessDocument in interface DocumentServicedocumentId - identifier of process documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundException - when the document does not existpublic SLightDocument getDocument(long documentId) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException, SBonitaReadException
DocumentServicegetDocument in interface DocumentServicedocumentId - identifier of documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionSBonitaReadExceptionpublic SMappedDocument getMappedDocument(long processInstanceId, String documentName) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException, SBonitaReadException
DocumentServicegetMappedDocument in interface DocumentServiceprocessInstanceId - identifier of process instancedocumentName - name of process documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionSBonitaReadExceptionpublic SMappedDocument getMappedDocument(long processInstanceId, String documentName, long time) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException, SBonitaReadException
DocumentServicegetMappedDocument in interface DocumentServiceprocessInstanceId - identifier of process instancedocumentName - name of documenttime - the archived time of documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionSBonitaReadExceptionpublic byte[] getDocumentContent(String documentId) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException
DocumentServicegetDocumentContent in interface DocumentServicedocumentId - identifier of the documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionpublic SMappedDocument getMappedDocument(long mappingId) throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException, SBonitaReadException
DocumentServicegetMappedDocument in interface DocumentServicemappingId - identifier of the mapping of the documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionSBonitaReadExceptionpublic List<SMappedDocument> getDocumentsOfProcessInstance(long processInstanceId, int fromIndex, int numberPerPage, String field, OrderByType order) throws SBonitaReadException
DocumentServicegetDocumentsOfProcessInstance in interface DocumentServiceprocessInstanceId - 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 returnedSBonitaReadExceptionpublic long getNumberOfArchivedDocuments(QueryOptions queryOptions) throws SBonitaReadException
DocumentServicegetNumberOfArchivedDocuments in interface DocumentServicequeryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic long getNumberOfArchivedDocumentsSupervisedBy(long userId,
QueryOptions queryOptions)
throws SBonitaReadException
DocumentServicegetNumberOfArchivedDocumentsSupervisedBy in interface DocumentServiceuserId - identifier of supervisor userqueryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic long getNumberOfDocuments(QueryOptions queryOptions) throws SBonitaReadException
DocumentServicegetNumberOfDocuments in interface DocumentServicequeryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic long getNumberOfDocumentsOfProcessInstance(long processInstanceId)
throws SBonitaReadException
DocumentServicegetNumberOfDocumentsOfProcessInstance in interface DocumentServiceprocessInstanceId - identifier of process instanceSBonitaReadExceptionpublic long getNumberOfDocumentsSupervisedBy(long userId,
QueryOptions queryOptions)
throws SBonitaReadException
DocumentServicegetNumberOfDocumentsSupervisedBy in interface DocumentServiceuserId - identifier of supervisor userqueryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic void removeCurrentVersion(SMappedDocument document) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
DocumentService
this archive and delete mapping on the process, i.e. the content of the document itself will be kept in database, use
DocumentService.deleteContentOfArchivedDocument(long) to delete the content
removeCurrentVersion in interface DocumentServicedocument - the document mapping to removeorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic void removeCurrentVersion(long processInstanceId,
String documentName)
throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException,
org.bonitasoft.engine.commons.exceptions.SObjectModificationException
DocumentService
this archive and delete mapping on the process, i.e. the content of the document itself will be kept in database, use
DocumentService.deleteContentOfArchivedDocument(long) to delete the content
removeCurrentVersion in interface DocumentServiceprocessInstanceId - id of the process having the documentdocumentName - name of the documentorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic void deleteDocument(SLightDocument document) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
deleteDocument in interface DocumentServiceorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic void removeDocument(SMappedDocument mappedDocument) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
removeDocument in interface DocumentServiceorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic List<SAMappedDocument> searchArchivedDocuments(QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchArchivedDocuments in interface DocumentServicequeryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic List<SAMappedDocument> searchArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchArchivedDocumentsSupervisedBy in interface DocumentServiceuserId - identifier of supervisor userqueryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic List<SMappedDocument> searchDocuments(QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchDocuments in interface DocumentServicequeryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic List<SMappedDocument> searchDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchDocumentsSupervisedBy in interface DocumentServiceuserId - identifier of supervisor userqueryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic void deleteArchivedDocuments(List<Long> processInstanceIds) throws SBonitaReadException, SRecorderException
DocumentServicedeleteArchivedDocuments in interface DocumentServiceprocessInstanceIds - ids of the source process instancesSBonitaReadExceptionSRecorderExceptionpublic void archive(SDocumentMapping docMapping, long archiveDate) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
DocumentServicearchive in interface DocumentServicedocMapping - document mapping will be archivedarchiveDate - the archive timeorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic List<SMappedDocument> getDocumentList(String documentName, long processInstanceId, int fromIndex, int numberOfResult) throws SBonitaReadException
DocumentServicegetDocumentList in interface DocumentServicedocumentName - the name of the document listprocessInstanceId - the id of the process instance that contains the listfromIndex - pagination parameternumberOfResult - pagination parameterSBonitaReadExceptionpublic void deleteContentOfArchivedDocument(long archivedDocumentId)
throws org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException,
SBonitaReadException,
SRecorderException
DocumentServiceAfter 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.
deleteContentOfArchivedDocument in interface DocumentServiceorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionSBonitaReadExceptionSRecorderExceptionpublic SMappedDocument updateDocument(long documentId, SDocument sDocument) throws SBonitaReadException, org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException, org.bonitasoft.engine.commons.exceptions.SObjectModificationException
DocumentServiceupdateDocument in interface DocumentServicedocumentId - the id of the document to updatesDocument - the new version of the document @returnSBonitaReadExceptionorg.bonitasoft.engine.commons.exceptions.SObjectNotFoundExceptionorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic SMappedDocument updateDocument(SDocumentMapping documentToUpdate, SDocument sDocument) throws org.bonitasoft.engine.commons.exceptions.SObjectModificationException
updateDocument in interface DocumentServicedocumentToUpdate - the document mapping to udpatesDocument - the value to set th emapping withorg.bonitasoft.engine.commons.exceptions.SObjectModificationExceptionpublic List<SMappedDocument> getDocumentList(String documentName, long processInstanceId, long time) throws SBonitaReadException
DocumentServiceelements are taken from archive and from non archived mapping if the process is still running
getDocumentList in interface DocumentServicedocumentName - the name of the document listprocessInstanceId - the id of the process instance that contains the listtime - time when the list was like thatSBonitaReadExceptionCopyright © 2019 Bonitasoft S.A.. All rights reserved.