Interface DocumentFileStorage
public interface DocumentFileStorage
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanapplyTranscriptionSpeakerSuggestion(String documentId, TranscriptionSpeakerSuggestion suggestion, long transcriptUpdated, org.exoplatform.services.security.Identity aclIdentity) Names a speaker of a media file's transcript after a proposal the platform made, as a user who can edit the file, and marks that proposal applied, in one save under the file's lock (EXO-92126).longcalculateFilesSize(Long ownerId, org.exoplatform.services.security.Identity aclIdentity) booleanvoidcancelBulkAction(String actionId, String userName) Cancel any bulk action by action IDbooleancanImport(org.exoplatform.services.security.Identity identity) voidcheckFolderReadable(String folderId, org.exoplatform.services.security.Identity aclIdentity) Checks that the given user can read a given folder, asdownloadFolder(String, Identity)reads it, without walking or zipping itdefault voidcheckUploadConflict(String folderId, String name, UploadConflictAction conflictAction, org.exoplatform.services.security.Identity aclIdentity) Checks an upload can be filed under a name in a folder with a conflict action, assaveUploadedDocument(String, String, String, UploadConflictAction, Identity)checks it when it files it.voiddefault booleanclearTranscriptionState(String documentId) Removes, as the system, the transcription state of a media file not transcribed yet, so that the file reads as never transcribed and can be queued again; a transcribed file, or one with no state, is left as it is.default voidcompleteTranscription(String documentId, String transcription, String segments, TranscriptionState state) Writes, as the system and in one save, the transcript of a media file, its timed segments and its final state.copyDocument(String nodeId, String destintionNodeId, org.exoplatform.services.security.Identity aclIdentity) Copy the given node.createDocumentFromTemplate(long ownerId, String folderId, String folderPath, String title, String documentType, org.exoplatform.services.security.Identity aclIdentity) Creates a new empty office document (Word/Excel/PowerPoint/ODF) from the platform's blank template, by delegating to the ecmsDocumentService.createDocumentFromTemplateDocument(long ownerId, String templateDocumentId, String destinationFolderId, String title, org.exoplatform.services.security.Identity aclIdentity) Creates a document from a template document: copies the template node, or the target of a shortcut template, into the destination folder under the given title, in one call, and broadcasts the document creation event the blank-document paths broadcast, so Analytics records one document creation whatever the name the user chose.createFolder(long ownerId, String folderId, String folderPath, String title, org.exoplatform.services.security.Identity aclIdentity) createFolderPath(String folderId, List<String> titles, org.exoplatform.services.security.Identity aclIdentity) Creates the last folder of a path of folder titles under a folder, each folder of the path before it reused when its parent holds one of that name, created otherwise.createNewVersion(String nodeId, String aclIdentity, InputStream newContent) Creates a new version from an input streamvoidcreateShortcut(String documentId, String destPath, String aclIdentity, String conflictAction) Creates a shortcut for a documentvoiddownloadDocuments(int actionId, List<AbstractNode> documents, org.exoplatform.services.security.Identity identity, long authenticatedUserId) downloadFolder(String folderId, org.exoplatform.services.security.Identity aclIdentity) Download a zipped folder, walked with the rights of the given user: the children and the shortcut targets this user cannot read are left out of the zipduplicateDocument(long ownerId, String fileId, String prefixClone, org.exoplatform.services.security.Identity aclIdentity) Duplicate the given node.default StringgetAudioTranscription(String documentId) A previously saved media Text transcription contentdefault StringgetAudioTranscription(String documentId, org.exoplatform.services.security.Identity aclIdentity) A previously saved media Text transcription contentgetBiggestDocuments(Long ownerId, org.exoplatform.services.security.Identity aclIdentity, int offset, int limit) Retrieves a list of biggest accessible files, for a selected user.getBreadcrumb(long ownerId, String folderId, String folderPath, org.exoplatform.services.security.Identity aclIdentity) Retrieves breadcrumb of the given node.default DocumentAudiencegetDocumentAudience(String documentId) Who a file is for, read as the system: its owner, the users it is shared with one by one, and the space whose documents hold it (EXO-92126).getDocumentById(String documentId) getDocumentById(String documentId, String aclIdentity) Retrieves a document By IdgetDocumentCategoryIds(long spaceIdentityId, org.exoplatform.services.security.Identity aclIdentity) io.meeds.portal.thumbnail.model.FileContentgetDocumentContent(String documentId, String aclIdentity) Retrieves a document content By its IdgetDocumentDownloadInfo(String documentId) Gets the identifier, the name and the mime type of a given document without reading its content: the returned item's content is null.getDocumentDownloadItem(String documentId) Gets a download item of a given documentdefault StringgetDocumentPathInDrive(String documentId, long ownerId, org.exoplatform.services.security.Identity aclIdentity) Retrieves the path of a document as reached from the drive of an owner: the document's own path when it lies in that drive, otherwise the path through a shortcut of that drive targeting the document or one of its ancestors; in a user drive, only the document or its parent folder.getDocumentSpaceGroupId(String documentId) Tells which space drive holds a node itself, read as the system.byte[]getDownloadZipBytes(int actionId, String userName) Get the zip for download by action IDgetFavoriteFileIds(DocumentNodeFilter filter, org.exoplatform.services.security.Identity aclUserIdentity, int offset, int limit) default InputStreamgetFileContentAsStream(String documentId, org.exoplatform.services.security.Identity aclIdentity) Returns a document file content as Textdefault StringgetFileContentAsText(String documentId) Returns a document file content as TextgetFilesTimeline(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity aclIdentity, int offset, int limit) Retrieves a list of accessible files, for a selected user, by applying the designated filter.default DocumentTextContentgetFileTextContent(String documentId) Returns the text of a document file, from the search index when it already holds it, else extracted from the file itself, and when there is none, why.default DocumentTextPagegetFileTextPage(String documentId, long offset, int maxChars) Returns a part of the text of a document file, with the length of the whole text and the document's outline, so a document too large to be read in one go is read part by part, or one section at a time.getFileVersions(String fileNodeId, String aclIdentity) Retrieves versions of specific filegetFolderChildNodes(DocumentFolderFilter filter, org.exoplatform.services.security.Identity aclIdentity, int offset, int limit) Retrieves a list of accessible files, for a selected user, by applying the designated filter.getFullTreeData(long ownerId, String folderId, String destinationFolderPath, org.exoplatform.services.security.Identity aclIdentity, boolean withChildren, boolean showHidden) Retrieves breadcrumb of the given node.getGroupDocumentsCount(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity aclIdentity) Retrieves the number of existing files by group.getNewName(long ownerId, String folderId, String folderPath, String title) getPersonalRootFolder(org.exoplatform.services.security.Identity aclIdentity) Retrieves the Root folder Path of a userlonggetRootFolderOwnerId(String documentId) Return the root folder ownerIdentityidgetSpaceRootFolder(long spaceId, org.exoplatform.services.security.Identity aclIdentity) Retrieves the Root folder Path of a Spacedefault StringgetTranscriptionChapters(String documentId, org.exoplatform.services.security.Identity aclIdentity) The chapters a media file's transcript is grouped into, read with the rights of the given user.default StringgetTranscriptionSegments(String documentId) The timed segments of a media file's transcript, read as the system, for the platform's own background work on a transcript.default StringgetTranscriptionSegments(String documentId, org.exoplatform.services.security.Identity aclIdentity) The timed segments of a media file's transcript, read with the rights of the given user.getTranscriptionSpeakers(String documentId, org.exoplatform.services.security.Identity aclIdentity) The person each named speaker of a media file's transcript is, read with the rights of the given user (EXO-92123).default List<TranscriptionSpeakerSuggestion> getTranscriptionSpeakerSuggestions(String documentId, org.exoplatform.services.security.Identity aclIdentity) The proposals of who the speakers of a media file's transcript are, read with the rights of the given user (EXO-92126).default TranscriptionStategetTranscriptionState(String documentId) The transcription state of a media file, read as the system.default TranscriptionStategetTranscriptionState(String documentId, org.exoplatform.services.security.Identity aclIdentity) The transcription state of a media file, read with the rights of the given user.booleanhasEditPermissions(String nodeId, org.exoplatform.services.security.Identity aclUserIdentity) Checks if user has edit permission on documentvoidimportFiles(String importId, org.exoplatform.social.core.space.model.Space space, String userName, String folderId, String folderPath, String conflict, org.exoplatform.services.security.Identity identity, String ownerId, long authenticatedUserId) Import list of documents from an uploaded zipdefault booleanmarkTranscriptionQueued(String documentId) Marks a media file QUEUED as the system, only when it has no transcription state yet: the read and the write are made in one session, so a run's state is never written over.voidmoveDocument(long ownerId, String fileId, String destPath, org.exoplatform.services.security.Identity aclIdentity, String conflictAction) Move the given node.voidmoveDocument(javax.jcr.Session session, long ownerId, String fileId, String destPath, org.exoplatform.services.security.Identity aclIdentity, String conflictAction) Move the given node.voidmoveDocuments(int actionId, long ownerId, List<AbstractNode> documents, String destPath, org.exoplatform.services.security.Identity userIdentityId, long identityId) Move list of documents in bulkvoidnotifyMember(String documentId, long destId) default voidremoveTranscriptionSpeakerSuggestion(String documentId, String speaker, org.exoplatform.services.security.Identity aclIdentity) Removes the proposal for one speaker of a media file's transcript, as a user who can edit the file (EXO-92126).voidrenameDocument(long ownerId, String documentID, String title, org.exoplatform.services.security.Identity aclIdentity) restoreVersion(String versionId, String aclIdentity) restore document versiondefault booleansaveTranscriptionChapters(String documentId, String chapters, long transcriptUpdated) Writes, as the system, the chapters a media file's transcript is grouped into (EXO-92122), only while the transcript they were made from is still the stored one: done, and with the update time read before making them.default booleansaveTranscriptionSpeakerSuggestions(String documentId, List<TranscriptionSpeakerSuggestion> suggestions, long transcriptUpdated) Replaces, as the system, the proposals of who the speakers of a media file's transcript are (EXO-92126), only while the transcript they were made from is still the stored one; none removes them.default FileNodesaveUploadedDocument(String folderId, String uploadId, String name, UploadConflictAction conflictAction, org.exoplatform.services.security.Identity aclIdentity) Files an uploaded file into a folder the way the Documents app files an upload, as the user: under the user's own session, with the same activity, events, hidden state and name handling.search(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity identity, int offset, int limit) voidsetDocumentVisibility(long ownerId, String documentID, Boolean hidden, org.exoplatform.services.security.Identity aclIdentity) Set the document visibility.default voidsetTranscriptionSpeaker(String documentId, String speaker, String identityId, org.exoplatform.services.security.Identity aclIdentity) Says which person a speaker of a media file's transcript is, or that it is nobody named any more, as a user who can edit the file (EXO-92123).voidshareDocument(String documentId, long destId, org.exoplatform.services.security.Identity aclIdentity, boolean broadcast) Shares a document with given user or spacevoidunShareDocument(String documentId, long destId) default voidupdateAudioTranscription(String documentId, String transcription) Updates the Text transcription of a Documentdefault voidupdateAudioTranscription(String documentId, String transcription, org.exoplatform.services.security.Identity aclIdentity) Updates the Text transcription of a Documentdefault voidupdateDocumentDescription(long ownerId, String documentID, String description, org.exoplatform.services.security.Identity aclIdentity) voidupdatePermissions(String documentID, NodePermission nodePermissionEntity, org.exoplatform.services.security.Identity aclIdentity) default voidupdateTranscriptionState(String documentId, TranscriptionState state) Writes the transcription state of a media file as the system: every field of the state is written, a null one removed, and the update time set to now.updateVersionSummary(String originFileId, String versionId, String summary, String aclIdentity) update or add a version summarydefault voidvalidateUploadedContent(String fileName, String mimeType, byte[] content) Checks a file's content with the platform's upload validators, as a new file uploaded from a browser is checked.default voidvalidateUploadedFile(String fileName, String mimeType, Path file) Checks a file on disk with the platform's upload validators, as a new file uploaded from a browser is checked, each validator reading it from a fresh stream: the file is never read whole into memory.
-
Method Details
-
getSpaceRootFolder
FolderNode getSpaceRootFolder(long spaceId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the Root folder Path of a Space- Parameters:
spaceId-Spacetechnical identifieraclIdentity- user willing to access the space's root folder- Returns:
- the root
FolderNodefor the designated space - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the space doesn't exist
-
getPersonalRootFolder
Retrieves the Root folder Path of a user- Parameters:
aclIdentity- user willing to access his/her own root folder- Returns:
- the root
FolderNodefor the designated user
-
getRootFolderOwnerId
Return the root folder ownerIdentityid- Parameters:
documentId- JCR Node Id by example- Returns:
Identityid
-
getFilesTimeline
List<FileNode> getFilesTimeline(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity aclIdentity, int offset, int limit) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves a list of accessible files, for a selected user, by applying the designated filter. The returned results will be of typeFileNodeonly. The ownerId of filter object will be used to select the list of accessible Nodes to retrieve switch a timeline.- Parameters:
filter-DocumentTimelineFilterthat contains filtering criteriaaclIdentity-Identityof the user acessing filesoffset- Offset of the result listlimit- Limit of the result list- Returns:
ListofAbstractNode- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when parentFolderId doesn't exisits
-
search
-
search
List<FileNode> search(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity identity, int offset, int limit) - Parameters:
filter-DocumentTimelineFilterto restrict search resultsidentity- User ACLIdentityoffset- search offsetlimit- search limit- Returns:
Listof foundFileNodeavailable for user
-
getBiggestDocuments
List<AbstractNode> getBiggestDocuments(Long ownerId, org.exoplatform.services.security.Identity aclIdentity, int offset, int limit) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves a list of biggest accessible files, for a selected user. The returned results will be of typeFileNodeonly. The ownerId of filter object will be used to select the list of accessible Nodes to retrieve.- Parameters:
ownerId-Identityof the identity in which search filesaclIdentity-Identityof the user acessing filesoffset- Offset of the result listlimit- Limit of the result list- Returns:
ListofAbstractNode- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when parentFolderId doesn't exisits
-
calculateFilesSize
long calculateFilesSize(Long ownerId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
getGroupDocumentsCount
DocumentGroupsSize getGroupDocumentsCount(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the number of existing files by group.- Parameters:
filter-DocumentFolderFilterthat contains filtering criteriaaclIdentity-Identityof the user acessing files- Returns:
DocumentGroupsSize- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when parentFolderId doesn't exisits
-
getFolderChildNodes
List<AbstractNode> getFolderChildNodes(DocumentFolderFilter filter, org.exoplatform.services.security.Identity aclIdentity, int offset, int limit) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Retrieves a list of accessible files, for a selected user, by applying the designated filter. The parentForlderId of filter object will be used to select the list of Nodes to retrieve. Without a search criterion, the folder's children are listed folders first, then files, a shortcut with its target's kind, and a shortcut whose target is gone or can't be read left out; the offset and the limit page over that listing, so successive pages neither skip nor repeat a child.- Parameters:
filter-DocumentFolderFilterthat contains filtering criteriaaclIdentity-Identityof the user acessing filesoffset- Offset of the result listlimit- Limit of the result list; without a search criterion, none when zero or less- Returns:
ListofAbstractNode- Throws:
IllegalAccessException- when the user isn't allowed to access documents of the designated parentFolderIdorg.exoplatform.commons.exception.ObjectNotFoundException- when parentFolderId doesn't exisits
-
getBreadcrumb
List<BreadCrumbItem> getBreadcrumb(long ownerId, String folderId, String folderPath, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Retrieves breadcrumb of the given node.- Parameters:
folderId- Id of the given folderaclIdentity-Identityof the user acessing files- Returns:
ListofAbstractNode- Throws:
IllegalAccessException- when the user isn't allowed to access documents of the designated parentFolderIdorg.exoplatform.commons.exception.ObjectNotFoundException- when folderId doesn't exisits
-
getFullTreeData
List<FullTreeItem> getFullTreeData(long ownerId, String folderId, String destinationFolderPath, org.exoplatform.services.security.Identity aclIdentity, boolean withChildren, boolean showHidden) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Retrieves breadcrumb of the given node.- Parameters:
folderId- Id of the given folderaclIdentity-Identityof the user acessing fileswithChildren- get all children- Returns:
ListofAbstractNode- Throws:
IllegalAccessExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
setDocumentVisibility
void setDocumentVisibility(long ownerId, String documentID, Boolean hidden, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.ObjectAlreadyExistsException Set the document visibility.- Parameters:
ownerId- the owner IddocumentID- theDocument Idhidden- the hidden valueaclIdentity- user Identuty- Throws:
org.exoplatform.commons.ObjectAlreadyExistsException
-
duplicateDocument
AbstractNode duplicateDocument(long ownerId, String fileId, String prefixClone, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Duplicate the given node.- Parameters:
fileId- Id of the given fileaclIdentity-Identityof the user acessing files- Returns:
AbstractNode- Throws:
IllegalAccessException- when the user isn't allowed to access documents of the designated parentFolderIdorg.exoplatform.commons.exception.ObjectNotFoundException- when folderId doesn't exisits
-
copyDocument
AbstractNode copyDocument(String nodeId, String destintionNodeId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Copy the given node.- Parameters:
nodeId- Id of the given filedestintionNodeId- Id of the destination folderaclIdentity-Identityof the user acessing files- Returns:
AbstractNode- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when folderId doesn't exisits
-
createDocumentFromTemplateDocument
AbstractNode createDocumentFromTemplateDocument(long ownerId, String templateDocumentId, String destinationFolderId, String title, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.commons.ObjectAlreadyExistsException Creates a document from a template document: copies the template node, or the target of a shortcut template, into the destination folder under the given title, in one call, and broadcasts the document creation event the blank-document paths broadcast, so Analytics records one document creation whatever the name the user chose. The Documents app's Duplicate and copy-paste keepcopyDocument(String, String, Identity)and record nothing.- Parameters:
ownerId- owner identity id, used when destinationFolderId is blanktemplateDocumentId- identifier of the template document nodedestinationFolderId- identifier of the destination folder nodetitle- title the user gave, with or without the template's extensionaclIdentity-Identityof the user creating the document- Returns:
- the created
AbstractNode, the copy itself - Throws:
IllegalAccessException- when the user may not add a document to the destination folderorg.exoplatform.commons.exception.ObjectNotFoundException- when the template document or the destination folder doesn't existorg.exoplatform.commons.ObjectAlreadyExistsException- when the destination folder already holds a node of the computed name
-
moveDocument
void moveDocument(javax.jcr.Session session, long ownerId, String fileId, String destPath, org.exoplatform.services.security.Identity aclIdentity, String conflictAction) throws Exception Move the given node.- Parameters:
session- current jcr sessionfileId- Id of the given fileaclIdentity-Identityof the user acessing filesconflictAction- conflict action- Throws:
IllegalAccessException- when the user isn't allowed to access documents of the designated parentFolderIdorg.exoplatform.commons.exception.ObjectNotFoundException- when folderId doesn't exisitsorg.exoplatform.commons.ObjectAlreadyExistsException- when file with same name already exists in the target pathException
-
moveDocument
void moveDocument(long ownerId, String fileId, String destPath, org.exoplatform.services.security.Identity aclIdentity, String conflictAction) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.commons.ObjectAlreadyExistsException Move the given node.- Parameters:
fileId- Id of the given fileaclIdentity-Identityof the user acessing filesconflictAction- conflict action- Throws:
IllegalAccessException- when the user isn't allowed to access documents of the designated parentFolderIdorg.exoplatform.commons.exception.ObjectNotFoundException- when folderId doesn't exisitsorg.exoplatform.commons.ObjectAlreadyExistsException- when file with same name already exists in the target path
-
createFolder
AbstractNode createFolder(long ownerId, String folderId, String folderPath, String title, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
IllegalAccessExceptionorg.exoplatform.commons.ObjectAlreadyExistsExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
createFolderPath
AbstractNode createFolderPath(String folderId, List<String> titles, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException Creates the last folder of a path of folder titles under a folder, each folder of the path before it reused when its parent holds one of that name, created otherwise. A folder is found by the node name its title gives, ascreateFolder(long, String, String, String, Identity)names it, so it is found wherever it sorts among its parent's children; a node of that name that is not a plain folder (a file, a shortcut, a hidden folder) can't be reused.- Parameters:
folderId- the folder the path starts undertitles- the folder titles, the first under that folder, each next one under the previousaclIdentity- the user creating the folders- Returns:
- the last folder of the path, created
- Throws:
IllegalArgumentException- when a title is not valid, or a node of a title's name can't be reused as a folderIllegalAccessException- when the user can't add a folder where one is missingorg.exoplatform.commons.ObjectAlreadyExistsException- when the last folder of the path exists alreadyorg.exoplatform.commons.exception.ObjectNotFoundException- when the starting folder can't be found
-
createDocumentFromTemplate
AbstractNode createDocumentFromTemplate(long ownerId, String folderId, String folderPath, String title, String documentType, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.commons.ObjectAlreadyExistsException Creates a new empty office document (Word/Excel/PowerPoint/ODF) from the platform's blank template, by delegating to the ecmsDocumentService.- Parameters:
ownerId- owner identity id (used when folderId is blank to resolve the identity root folder)folderId- identifier of the parent folder nodefolderPath- optional relative path under the parent foldertitle- document title (should already include the file extension)documentType- office document extension (e.g. docx, xlsx, pptx, odt, ods, odp) matched against the installed template providersaclIdentity- ACL identity of the user creating the document- Returns:
- the created
AbstractNode - Throws:
IllegalAccessException- when the user isn't allowed to edit the parent folderorg.exoplatform.commons.exception.ObjectNotFoundException- when the parent folder or a matching template doesn't existorg.exoplatform.commons.ObjectAlreadyExistsException- when a document with the same name already exists in the target folder
-
validateUploadedContent
Checks a file's content with the platform's upload validators, as a new file uploaded from a browser is checked.- Parameters:
fileName- the file namemimeType- the file's typecontent- the file's content- Throws:
IllegalArgumentException- when a validator refuses the file, with its message
-
validateUploadedFile
Checks a file on disk with the platform's upload validators, as a new file uploaded from a browser is checked, each validator reading it from a fresh stream: the file is never read whole into memory.- Parameters:
fileName- the file name the validators checkmimeType- the file's typefile- the file's location on disk- Throws:
IllegalArgumentException- when a validator refuses the file, with its messageIllegalStateException- when the file can't be read
-
checkUploadConflict
default void checkUploadConflict(String folderId, String name, UploadConflictAction conflictAction, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Checks an upload can be filed under a name in a folder with a conflict action, assaveUploadedDocument(String, String, String, UploadConflictAction, Identity)checks it when it files it.- Parameters:
folderId- the foldername- the file name, with its extensionconflictAction- what to do when the folder holds a file of that nameaclIdentity- the user- Throws:
IllegalArgumentException- when the folder is not a folder, or a new version is asked of a document of that name that is not a file (a folder or a shortcut), or keeps no versionsIllegalStateException- when the folder can't be readorg.exoplatform.commons.exception.ObjectNotFoundException- when the folder doesn't exist
-
saveUploadedDocument
default FileNode saveUploadedDocument(String folderId, String uploadId, String name, UploadConflictAction conflictAction, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Files an uploaded file into a folder the way the Documents app files an upload, as the user: under the user's own session, with the same activity, events, hidden state and name handling.- Parameters:
folderId- the folder the file is filed intouploadId- the upload, registered in the platform's upload service; it is consumed once the file is filedname- the file name, with its extensionconflictAction- what to do when the folder holds a file of that nameaclIdentity- the user filing it- Returns:
- the filed document
- Throws:
IllegalArgumentException- when the name is blank, the folder is not a folder, or a new version is asked of a document of that name that is not a file (a folder or a shortcut), or keeps no versionsIllegalStateException- when the file couldn't be filed, or read back once filedIllegalAccessException- when the user can't add documents to the folderorg.exoplatform.commons.exception.ObjectNotFoundException- when the folder or the upload doesn't exist
-
getNewName
String getNewName(long ownerId, String folderId, String folderPath, String title) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
IllegalAccessExceptionorg.exoplatform.commons.ObjectAlreadyExistsExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
renameDocument
void renameDocument(long ownerId, String documentID, String title, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException - Throws:
IllegalAccessExceptionorg.exoplatform.commons.ObjectAlreadyExistsExceptionorg.exoplatform.commons.exception.ObjectNotFoundException
-
updatePermissions
void updatePermissions(String documentID, NodePermission nodePermissionEntity, org.exoplatform.services.security.Identity aclIdentity) -
downloadDocuments
void downloadDocuments(int actionId, List<AbstractNode> documents, org.exoplatform.services.security.Identity identity, long authenticatedUserId) -
notifyMember
- Throws:
IllegalAccessException
-
canAccess
-
updateDocumentDescription
default void updateDocumentDescription(long ownerId, String documentID, String description, org.exoplatform.services.security.Identity aclIdentity) throws IllegalStateException, javax.jcr.RepositoryException - Throws:
IllegalStateExceptionjavax.jcr.RepositoryException
-
updateAudioTranscription
default void updateAudioTranscription(String documentId, String transcription, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException Updates the Text transcription of a Document- Parameters:
documentId- Video or Audio UUIDtranscription- Media Audio Transcription TextaclIdentity- current user Identity- Throws:
IllegalAccessException- when the current user can't edit the designated document
-
updateAudioTranscription
-
getAudioTranscription
default String getAudioTranscription(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException A previously saved media Text transcription content- Parameters:
documentId- Video or Audio UUIDaclIdentity- current user Identity- Returns:
- the transcription text
- Throws:
IllegalAccessException- when the current user can't access the designated document
-
getAudioTranscription
-
getTranscriptionState
default TranscriptionState getTranscriptionState(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException The transcription state of a media file, read with the rights of the given user. A file transcribed before the state existed, which holds a transcript but no state, reads asTranscriptionStatus.DONE; a file never sent to transcription reads with a null status.- Parameters:
documentId- the file's UUIDaclIdentity- the user reading it- Returns:
- the state, never null
- Throws:
IllegalAccessException- when the user may not read the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
getTranscriptionState
default TranscriptionState getTranscriptionState(String documentId) throws org.exoplatform.commons.exception.ObjectNotFoundException The transcription state of a media file, read as the system.- Parameters:
documentId- the file's UUID- Returns:
- the state, never null
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
updateTranscriptionState
default void updateTranscriptionState(String documentId, TranscriptionState state) throws org.exoplatform.commons.exception.ObjectNotFoundException Writes the transcription state of a media file as the system: every field of the state is written, a null one removed, and the update time set to now.- Parameters:
documentId- the file's UUIDstate- the state to write- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
markTranscriptionQueued
default boolean markTranscriptionQueued(String documentId) throws org.exoplatform.commons.exception.ObjectNotFoundException Marks a media file QUEUED as the system, only when it has no transcription state yet: the read and the write are made in one session, so a run's state is never written over.- Parameters:
documentId- the file's UUID- Returns:
- true when the state was written, false when the file had one
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the session creating it is not saved yet
-
clearTranscriptionState
default boolean clearTranscriptionState(String documentId) throws org.exoplatform.commons.exception.ObjectNotFoundException Removes, as the system, the transcription state of a media file not transcribed yet, so that the file reads as never transcribed and can be queued again; a transcribed file, or one with no state, is left as it is.- Parameters:
documentId- the file's UUID- Returns:
- true when a state was removed
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
completeTranscription
default void completeTranscription(String documentId, String transcription, String segments, TranscriptionState state) throws org.exoplatform.commons.exception.ObjectNotFoundException Writes, as the system and in one save, the transcript of a media file, its timed segments and its final state.- Parameters:
documentId- the file's UUIDtranscription- the transcript's textsegments- the timed segments as a JSON list, or null when there are nonestate- the state to write,TranscriptionStatus.DONE- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
getTranscriptionSegments
default String getTranscriptionSegments(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException The timed segments of a media file's transcript, read with the rights of the given user.- Parameters:
documentId- the file's UUIDaclIdentity- the user reading it- Returns:
- the segments as a JSON list, or null when there are none
- Throws:
IllegalAccessException- when the user may not read the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
getTranscriptionSegments
default String getTranscriptionSegments(String documentId) throws org.exoplatform.commons.exception.ObjectNotFoundException The timed segments of a media file's transcript, read as the system, for the platform's own background work on a transcript.- Parameters:
documentId- the file's UUID- Returns:
- the segments as a JSON list, or null when there are none
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
saveTranscriptionChapters
default boolean saveTranscriptionChapters(String documentId, String chapters, long transcriptUpdated) throws org.exoplatform.commons.exception.ObjectNotFoundException Writes, as the system, the chapters a media file's transcript is grouped into (EXO-92122), only while the transcript they were made from is still the stored one: done, and with the update time read before making them.- Parameters:
documentId- the file's UUIDchapters- the chapters as a JSON listtranscriptUpdated- the update time of the transcription state the chapters were made from, in milliseconds since the epoch- Returns:
- true when written, false when the transcript changed since, or is not done
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
getTranscriptionChapters
default String getTranscriptionChapters(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException The chapters a media file's transcript is grouped into, read with the rights of the given user.- Parameters:
documentId- the file's UUIDaclIdentity- the user reading it- Returns:
- the chapters as a JSON list, or null when there are none
- Throws:
IllegalAccessException- when the user may not read the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
getTranscriptionSpeakers
default Map<String,String> getTranscriptionSpeakers(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException The person each named speaker of a media file's transcript is, read with the rights of the given user (EXO-92123).- Parameters:
documentId- the file's UUIDaclIdentity- the user reading it- Returns:
- who each named speaker is, by speaker number: an identity id, or a
guest's name after
TranscriptSpeakers.GUEST_PREFIX; empty when none is named - Throws:
IllegalAccessException- when the user may not read the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
setTranscriptionSpeaker
default void setTranscriptionSpeaker(String documentId, String speaker, String identityId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Says which person a speaker of a media file's transcript is, or that it is nobody named any more, as a user who can edit the file (EXO-92123). A proposal the platform applied to that speaker is dropped in the same save (EXO-92126): the name is a person's from then on.- Parameters:
documentId- the file's UUIDspeaker- the speaker's number in the transcriptidentityId- who the speaker is: the identity id of the person, or a guest's name afterTranscriptSpeakers.GUEST_PREFIX; null to unname the speaker. The value is stored as given: a guest's name is validated byDocumentTranscriptionService#setGuestSpeaker, which callers go throughaclIdentity- the user naming it- Throws:
IllegalAccessException- when the user may not edit the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
getDocumentAudience
default DocumentAudience getDocumentAudience(String documentId) throws org.exoplatform.commons.exception.ObjectNotFoundException Who a file is for, read as the system: its owner, the users it is shared with one by one, and the space whose documents hold it (EXO-92126).- Parameters:
documentId- the file's UUID- Returns:
- who the file is for
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
saveTranscriptionSpeakerSuggestions
default boolean saveTranscriptionSpeakerSuggestions(String documentId, List<TranscriptionSpeakerSuggestion> suggestions, long transcriptUpdated) throws org.exoplatform.commons.exception.ObjectNotFoundException Replaces, as the system, the proposals of who the speakers of a media file's transcript are (EXO-92126), only while the transcript they were made from is still the stored one; none removes them.- Parameters:
documentId- the file's UUIDsuggestions- the proposals, one per speaker at mosttranscriptUpdated- the update time of the transcription state the proposals were made from, in milliseconds since the epoch- Returns:
- true when written, false when the transcript changed since, or is not done
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist
-
getTranscriptionSpeakerSuggestions
default List<TranscriptionSpeakerSuggestion> getTranscriptionSpeakerSuggestions(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException The proposals of who the speakers of a media file's transcript are, read with the rights of the given user (EXO-92126).- Parameters:
documentId- the file's UUIDaclIdentity- the user reading them- Returns:
- the proposals, in the order they were saved; empty when none
- Throws:
IllegalAccessException- when the user may not read the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
removeTranscriptionSpeakerSuggestion
default void removeTranscriptionSpeakerSuggestion(String documentId, String speaker, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Removes the proposal for one speaker of a media file's transcript, as a user who can edit the file (EXO-92126).- Parameters:
documentId- the file's UUIDspeaker- the speaker's number in the transcriptaclIdentity- the user removing it- Throws:
IllegalAccessException- when the user may not edit the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
applyTranscriptionSpeakerSuggestion
default boolean applyTranscriptionSpeakerSuggestion(String documentId, TranscriptionSpeakerSuggestion suggestion, long transcriptUpdated, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Names a speaker of a media file's transcript after a proposal the platform made, as a user who can edit the file, and marks that proposal applied, in one save under the file's lock (EXO-92126). What the proposal rests on in the file is read again at that moment: the transcript must still be the one it was made from, the proposal must still be stored (not dismissed), and neither the speaker nor the person may be named. A proposal made by elimination is never applied: it is only ever suggested, since the voice left over may be a guest's. A name applied this way never replaces one a person gave, nor names a voice of another transcript. Whether the person is still an enabled user is not read here: the caller checks it just before, so a person disabled in between is still named.- Parameters:
documentId- the file's UUIDsuggestion- the proposaltranscriptUpdated- the update time of the transcription state the proposal was made from, in milliseconds since the epochaclIdentity- the user naming it- Returns:
- true when the speaker was named; false when any of these no longer holds
- Throws:
IllegalAccessException- when the user may not edit the fileorg.exoplatform.commons.exception.ObjectNotFoundException- when the file does not exist, or the user cannot see it
-
createShortcut
void createShortcut(String documentId, String destPath, String aclIdentity, String conflictAction) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException Creates a shortcut for a document- Parameters:
documentId- document iddestPath- destination pathaclIdentity- user identity idconflictAction- conflict action- Throws:
IllegalAccessExceptionorg.exoplatform.commons.ObjectAlreadyExistsException
-
getFileVersions
Retrieves versions of specific file- Parameters:
fileNodeId- target file node idaclIdentity- user identity id- Returns:
ListofFileVersion
-
getDocumentById
AbstractNode getDocumentById(String documentId, String aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Retrieves a document By Id- Parameters:
documentId- target file node idaclIdentity- user identity id- Returns:
AbstractNode- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when document doesn't existsIllegalAccessException- when user can't access document
-
getDocumentById
- Parameters:
documentId- target file node id- Returns:
AbstractNode
-
getDocumentPathInDrive
default String getDocumentPathInDrive(String documentId, long ownerId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the path of a document as reached from the drive of an owner: the document's own path when it lies in that drive, otherwise the path through a shortcut of that drive targeting the document or one of its ancestors; in a user drive, only the document or its parent folder.- Parameters:
documentId- target document node idownerId- identity id of the drive owner (space or user)aclIdentity- user identity- Returns:
- the path of the document from the owner's drive, null when no shortcut of that drive leads to it
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the document or the owner's drive isn't found or isn't accessible to the user
-
getDocumentSpaceGroupId
Tells which space drive holds a node itself, read as the system. A shortcut or a share link (exo:symlink) isn't the node it points to: it holds nothing of its own, so it belongs to no space here.- Parameters:
documentId- the node id- Returns:
- the group id (
/spaces/<name>) of the space whoseDocumentsdrive holds the node, or null when the node is missing, is a shortcut or a share link, lies outside a space'sDocumentsdrive (a personal drive, the trash, any other place), or can't be read
-
getDocumentContent
io.meeds.portal.thumbnail.model.FileContent getDocumentContent(String documentId, String aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves a document content By its Id- Parameters:
documentId- target file node idaclIdentity- user identity id- Returns:
FileContent- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException
-
updateVersionSummary
FileVersion updateVersionSummary(String originFileId, String versionId, String summary, String aclIdentity) update or add a version summary- Parameters:
originFileId- original file idversionId- version idsummary- new summary to be savedaclIdentity- current user identity- Returns:
FileVersion
-
restoreVersion
restore document version- Parameters:
versionId- version idaclIdentity- current user identity- Returns:
FileVersion
-
getDownloadZipBytes
Get the zip for download by action ID- Parameters:
actionId- action iduserName- current user name- Throws:
IOException
-
cancelBulkAction
Cancel any bulk action by action ID- Parameters:
actionId- action iduserName- current user name- Throws:
IOException
-
createNewVersion
Creates a new version from an input stream- Parameters:
nodeId- target node idaclIdentity- current user identity idnewContent- the new content to be set in the new version- Returns:
FileVersion
-
moveDocuments
void moveDocuments(int actionId, long ownerId, List<AbstractNode> documents, String destPath, org.exoplatform.services.security.Identity userIdentityId, long identityId) Move list of documents in bulk- Parameters:
actionId- action idownerId- owner iddocuments- list of documents to movedestPath- destination pathuserIdentityId- current user acl identity ididentityId- current user identity id
-
hasEditPermissions
boolean hasEditPermissions(String nodeId, org.exoplatform.services.security.Identity aclUserIdentity) Checks if user has edit permission on document- Parameters:
nodeId- document node idaclUserIdentity- user identity id- Returns:
- true if has edit permission or false
-
getDocumentDownloadItem
Gets a download item of a given document- Parameters:
documentId- document id- Returns:
DownloadItem
-
getDocumentDownloadInfo
Gets the identifier, the name and the mime type of a given document without reading its content: the returned item's content is null. The document is read whatever the caller's permissions: the caller checks access first, asPublicDocumentAccessService.getPublicDocumentInfo(String)does with the public access link.- Parameters:
documentId- document id- Returns:
DownloadItemwithout content, or null when no document has this id or it cannot be read
-
downloadFolder
String downloadFolder(String folderId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Download a zipped folder, walked with the rights of the given user: the children and the shortcut targets this user cannot read are left out of the zip- Parameters:
folderId- folder node idaclIdentity- the user whose rights the walk applies- Returns:
- downloaded zip path, or null when the zip cannot be built
- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the user cannot read the folder or no node has this id
-
checkFolderReadable
void checkFolderReadable(String folderId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException Checks that the given user can read a given folder, asdownloadFolder(String, Identity)reads it, without walking or zipping it- Parameters:
folderId- folder node idaclIdentity- the user whose rights apply- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when the user cannot read the folder or no node has this idIllegalStateException- when the folder cannot be read for another reason
-
getFileContentAsText
-
getFileTextContent
Returns the text of a document file, from the search index when it already holds it, else extracted from the file itself, and when there is none, why. No permission is checked here: the caller checks the user can access the document first.- Parameters:
documentId- Document identifier- Returns:
- the text of the file and where it came from, or why there is none
-
getFileTextPage
Returns a part of the text of a document file, with the length of the whole text and the document's outline, so a document too large to be read in one go is read part by part, or one section at a time. The whole text is extracted from the file once per version of it and kept for the next parts. No permission is checked here: the caller checks the user can access the document first.- Parameters:
documentId- Document identifieroffset- the first character to readmaxChars- the most characters to read, 0 for the outline only- Returns:
- the part read, or why there is no text
-
getFileContentAsStream
default InputStream getFileContentAsStream(String documentId, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException Returns a document file content as Text- Parameters:
documentId- Document identifieraclIdentity-Identityof the user acessing file- Returns:
- the
InputStreamof the binary - Throws:
IllegalAccessException- when user can't access document
-
importFiles
void importFiles(String importId, org.exoplatform.social.core.space.model.Space space, String userName, String folderId, String folderPath, String conflict, org.exoplatform.services.security.Identity identity, String ownerId, long authenticatedUserId) throws Exception Import list of documents from an uploaded zip- Parameters:
importId- import idspace- space where to create documentsfolderId- folder idfolderPath- folder pathconflict- conflict ruleidentity- current user identityownerId- owner idauthenticatedUserId- current user identity id- Throws:
Exception
-
canImport
boolean canImport(org.exoplatform.services.security.Identity identity) -
getFavoriteFileIds
List<String> getFavoriteFileIds(DocumentNodeFilter filter, org.exoplatform.services.security.Identity aclUserIdentity, int offset, int limit) -
getDocumentCategoryIds
-