public class DocumentServiceImpl extends java.lang.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,
java.lang.String name,
java.lang.String description)
Save a document
|
SMappedDocument |
attachDocumentToProcessInstance(SDocument document,
long processInstanceId,
java.lang.String name,
java.lang.String description,
int index)
Save a document
|
void |
deleteArchivedDocuments(java.util.List<java.lang.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(java.lang.Long processInstanceId)
Delete documents from a specified process instance
|
java.lang.String |
generateDocumentURL(java.lang.String name,
java.lang.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(java.lang.String documentId)
Get document content by document id
|
java.util.List<SMappedDocument> |
getDocumentList(java.lang.String documentName,
long processInstanceId,
int fromIndex,
int numberOfResult)
Get a list of document.
|
java.util.List<SMappedDocument> |
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 pagination
|
SMappedDocument |
getMappedDocument(long mappingId)
Get document with mapping by its mapping id
|
SMappedDocument |
getMappedDocument(long processInstanceId,
java.lang.String documentName)
Get document with mapping by its name in the specific process instance
|
SMappedDocument |
getMappedDocument(long processInstanceId,
java.lang.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,
java.lang.String documentName)
Remove the document with the specified process instance and name
|
void |
removeCurrentVersion(SMappedDocument document)
Remove this document.
|
void |
removeDocument(SMappedDocument 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 supervisor
|
java.util.List<SMappedDocument> |
searchDocuments(QueryOptions queryOptions)
Search all documents according to the query criteria
|
java.util.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, java.lang.String name, java.lang.String description) throws SObjectCreationException
DocumentServiceattachDocumentToProcessInstance in interface DocumentServicedocument - the document to storeprocessInstanceId - the process instance id to attach the document toSObjectCreationException - when the storage has failedpublic SMappedDocument attachDocumentToProcessInstance(SDocument document, long processInstanceId, java.lang.String name, java.lang.String description, int index) throws SObjectCreationException, SObjectAlreadyExistsException
DocumentServiceattachDocumentToProcessInstance in interface DocumentServicedocument - the document to storeprocessInstanceId - the process instance id to attach the document toindex - the index in the list of documentSObjectCreationException - when the storage has failedSObjectAlreadyExistsExceptionpublic void updateDocumentOfList(SMappedDocument mappedDocument, SDocument document, int index) throws SObjectModificationException
updateDocumentOfList in interface DocumentServicemappedDocument - the document to updatedocument - the new contentindex - the new indexSObjectModificationExceptionpublic void updateDocumentIndex(SMappedDocument mappedDocument, int index) throws SObjectModificationException
DocumentServiceupdateDocumentIndex in interface DocumentServicemappedDocument - the document to updateindex - the new indexSObjectModificationExceptionpublic void deleteDocumentsFromProcessInstance(java.lang.Long processInstanceId)
throws SBonitaReadException,
SObjectModificationException
DocumentServicedeleteDocumentsFromProcessInstance in interface DocumentServiceSBonitaReadExceptionSObjectModificationExceptionpublic java.lang.String generateDocumentURL(java.lang.String name,
java.lang.String contentStorageId)
generateDocumentURL in interface DocumentServicepublic SAMappedDocument getArchivedDocument(long archivedProcessDocumentId) throws SObjectNotFoundException
DocumentServicegetArchivedDocument in interface DocumentServicearchivedProcessDocumentId - the id of the archived documentSObjectNotFoundException - when the archive does not existpublic SAMappedDocument getArchivedVersionOfProcessDocument(long documentId) throws SObjectNotFoundException
DocumentServicegetArchivedVersionOfProcessDocument in interface DocumentServicedocumentId - identifier of process documentSObjectNotFoundException - when the document does not existpublic SLightDocument getDocument(long documentId) throws SObjectNotFoundException, SBonitaReadException
DocumentServicegetDocument in interface DocumentServicedocumentId - identifier of documentSObjectNotFoundExceptionSBonitaReadExceptionpublic SMappedDocument getMappedDocument(long processInstanceId, java.lang.String documentName) throws SObjectNotFoundException, SBonitaReadException
DocumentServicegetMappedDocument in interface DocumentServiceprocessInstanceId - identifier of process instancedocumentName - name of process documentSObjectNotFoundExceptionSBonitaReadExceptionpublic SMappedDocument getMappedDocument(long processInstanceId, java.lang.String documentName, long time) throws SObjectNotFoundException, SBonitaReadException
DocumentServicegetMappedDocument in interface DocumentServiceprocessInstanceId - identifier of process instancedocumentName - name of documenttime - the archived time of documentSObjectNotFoundExceptionSBonitaReadExceptionpublic byte[] getDocumentContent(java.lang.String documentId)
throws SObjectNotFoundException
DocumentServicegetDocumentContent in interface DocumentServicedocumentId - identifier of the documentSObjectNotFoundExceptionpublic SMappedDocument getMappedDocument(long mappingId) throws SObjectNotFoundException, SBonitaReadException
DocumentServicegetMappedDocument in interface DocumentServicemappingId - identifier of the mapping of the documentSObjectNotFoundExceptionSBonitaReadExceptionpublic java.util.List<SMappedDocument> getDocumentsOfProcessInstance(long processInstanceId, int fromIndex, int numberPerPage, java.lang.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 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 removeSObjectModificationExceptionpublic void removeCurrentVersion(long processInstanceId,
java.lang.String documentName)
throws SObjectNotFoundException,
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 documentSObjectNotFoundExceptionSObjectModificationExceptionpublic void deleteDocument(SLightDocument document) throws SObjectModificationException
deleteDocument in interface DocumentServiceSObjectModificationExceptionpublic void removeDocument(SMappedDocument mappedDocument) throws SObjectModificationException
removeDocument in interface DocumentServiceSObjectModificationExceptionpublic java.util.List<SAMappedDocument> searchArchivedDocuments(QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchArchivedDocuments in interface DocumentServicequeryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic java.util.List<SAMappedDocument> searchArchivedDocumentsSupervisedBy(long userId, QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchArchivedDocumentsSupervisedBy in interface DocumentServiceuserId - identifier of supervisor userqueryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic java.util.List<SMappedDocument> searchDocuments(QueryOptions queryOptions) throws SBonitaReadException
DocumentServicesearchDocuments in interface DocumentServicequeryOptions - a QueryOptions object containing some query conditionsSBonitaReadExceptionpublic java.util.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(java.util.List<java.lang.Long> processInstanceIds)
throws SBonitaReadException,
SRecorderException
DocumentServicedeleteArchivedDocuments in interface DocumentServiceprocessInstanceIds - ids of the source process instancesSBonitaReadExceptionSRecorderExceptionpublic void archive(SDocumentMapping docMapping, long archiveDate) throws SObjectModificationException
DocumentServicearchive in interface DocumentServicedocMapping - document mapping will be archivedarchiveDate - the archive timeSObjectModificationExceptionpublic java.util.List<SMappedDocument> getDocumentList(java.lang.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 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 DocumentServiceSObjectNotFoundExceptionSBonitaReadExceptionSRecorderExceptionpublic SMappedDocument updateDocument(long documentId, SDocument sDocument) throws SBonitaReadException, SObjectNotFoundException, SObjectModificationException
DocumentServiceupdateDocument in interface DocumentServicedocumentId - the id of the document to updatesDocument - the new version of the document @returnSBonitaReadExceptionSObjectNotFoundExceptionSObjectModificationExceptionpublic SMappedDocument updateDocument(SDocumentMapping documentToUpdate, SDocument sDocument) throws SObjectModificationException
updateDocument in interface DocumentServicedocumentToUpdate - the document mapping to udpatesDocument - the value to set th emapping withSObjectModificationExceptionpublic java.util.List<SMappedDocument> getDocumentList(java.lang.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 thatSBonitaReadException