Interface DocumentFileService


public interface DocumentFileService
  • Method Details

    • getDocumentItems

      List<? extends AbstractNode> getDocumentItems(FileListingType listingType, DocumentNodeFilter filter, int offset, int limit, long userIdentityId, boolean showHiddenFiles) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves a list of accessible folders and/or files, for a selected user, by applying the designated filter.
      Parameters:
      listingType - FileListingType
      filter - DocumentNodeFilter that contains filtering criteria
      offset - Offset of the result list
      limit - Limit of the result list
      userIdentityId - Identity technical identifier of the user acessing files
      Returns:
      List of AbstractNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId or ownerId
      org.exoplatform.commons.exception.ObjectNotFoundException - when parentFolderId or ownerId doesn't exisits
    • search

      List<FileNode> search(String keyword, org.exoplatform.services.security.Identity identity, int offset, int limit)
      Parameters:
      keyword - Search term
      identity - User ACL Identity which can be retrieved by UserACL.getUserIdentity(String)
      offset - search offset
      limit - search limit
      Returns:
      List of found FileNode available for user
    • search

      List<FileNode> search(DocumentTimelineFilter filter, org.exoplatform.services.security.Identity identity, int offset, int limit)
      Parameters:
      filter - DocumentTimelineFilter to restrict search results
      identity - User ACL Identity
      offset - search offset
      limit - search limit
      Returns:
      List of found FileNode available for user
    • getDocumentById

      AbstractNode getDocumentById(String documentId, String aclIdentity) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves a file by its identifier.
      Parameters:
      documentId - Id of the given document
      aclIdentity - user identity id
      Returns:
      AbstractNode
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when document doesn't exisits
      IllegalAccessException - when document isn't accessible for user
    • getDocumentById

      AbstractNode getDocumentById(String documentId)
      Retrieves a file by its identifier.
      Parameters:
      documentId - Id of the given document
    • getDocumentPathInDrive

      default String getDocumentPathInDrive(String documentId, long ownerId, long authenticatedUserId) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      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 - Id of the given document
      ownerId - identity id of the drive owner (space or user)
      authenticatedUserId - current user identity id
      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
      IllegalAccessException - when the user's identity can't be resolved
    • getDocumentSpaceGroupId

      String getDocumentSpaceGroupId(String documentId)
      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 whose Documents drive holds the node, or null when the node is missing, is a shortcut or a share link, lies outside a space's Documents drive (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 file content by its identifier.
      Parameters:
      documentId - Id of the given document
      aclIdentity - user identity id
      Returns:
      InputStream
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException
    • getFilesTimeline

      List<FileNode> getFilesTimeline(DocumentTimelineFilter filter, int offset, int limit, long userIdentityId) throws IllegalAccessException, 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 type FileNode only. The ownerId of filter object will be used to select the list of accessible Nodes to retrieve switch a timeline.
      Parameters:
      filter - DocumentTimelineFilter that contains filtering criteria
      offset - Offset of the result list
      limit - Limit of the result list
      userIdentityId - Identity technical identifier of the user acessing files
      Returns:
      List of AbstractNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated ownerId
      org.exoplatform.commons.exception.ObjectNotFoundException - when ownerId doesn't exisits
    • getFavoriteFileIds

      List<String> getFavoriteFileIds(DocumentNodeFilter filter, int offset, int limit, long userIdentityId) throws IllegalAccessException
      Parameters:
      filter - DocumentFavoriteFilter that contains filtering criteria
      offset - Offset of the result list
      limit - Limit of the result list
      userIdentityId - Identity technical identifier of the user acessing files
      Returns:
      List of AbstractNode identifiers
      Throws:
      IllegalAccessException - when the user isn't found
    • getBiggestDocuments

      List<AbstractNode> getBiggestDocuments(long ownerId, org.exoplatform.social.core.identity.model.Identity userIdentity, 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 returned results will be of type FileNode only. The ownerId of filter object will be used to select the list of accessible Nodes to retrieve switch a timeline.
      Parameters:
      ownerId - Identity technical identifier of the where search files
      userIdentity - Identity technical identifier of the user acessing files
      offset - Offset of the result list
      limit - Limit of the result list
      Returns:
      List of FileNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated ownerId
      org.exoplatform.commons.exception.ObjectNotFoundException - when ownerId doesn't exisits
    • getGroupDocumentsCount

      DocumentGroupsSize getGroupDocumentsCount(DocumentTimelineFilter filter, long userIdentityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves the number of existing files by group.
      Parameters:
      filter - DocumentTimelineFilter that contains filtering criteria
      userIdentityId - Identity technical identifier of the user acessing files
      Returns:
      List of AbstractNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated ownerId
      org.exoplatform.commons.exception.ObjectNotFoundException - when ownerId doesn't exisits
    • getFolderChildNodes

      List<AbstractNode> getFolderChildNodes(DocumentFolderFilter filter, int offset, int limit, long userIdentityId) 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 - DocumentFolderFilter that contains filtering criteria
      offset - Offset of the result list
      limit - Limit of the result list; without a search criterion, none when zero or less
      userIdentityId - Identity technical identifier of the user acessing files
      Returns:
      List of AbstractNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId
      org.exoplatform.commons.exception.ObjectNotFoundException - when parentFolderId doesn't exisits
    • getBreadcrumb

      List<BreadCrumbItem> getBreadcrumb(long ownerId, String folderId, String folderPath, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves breadcrumb of the given node.
      Parameters:
      folderId - Id of the given folder
      authenticatedUserId - of the user acessing files
      Returns:
      List of BreadCrumbItem
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId
      org.exoplatform.commons.exception.ObjectNotFoundException - when folderId doesn't exisits
    • getFullTreeData

      List<FullTreeItem> getFullTreeData(long ownerId, String folderId, String destinationFolderPath, long authenticatedUserId, boolean withChildren, boolean showHidden) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves tree of the given node.
      Parameters:
      folderId - Id of the given folder
      destinationFolderPath - destination folder to add to the tree
      authenticatedUserId - of the user acessing files
      withChildren - get all children
      Returns:
      List of FullTreeItem
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId
      org.exoplatform.commons.exception.ObjectNotFoundException - when folderId doesn't exisits
    • duplicateDocument

      AbstractNode duplicateDocument(long ownerId, String fileId, String prefixClone, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Duplicate the given node.
      Parameters:
      fileId - Id of the given file
      authenticatedUserId - of the user acessing files
      Returns:
      AbstractNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId
      org.exoplatform.commons.exception.ObjectNotFoundException - when folderId doesn't exisits
    • copyDocument

      AbstractNode copyDocument(String nodeId, String destintionNodeId, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Copy the given node.
      Parameters:
      nodeId - Id of the given file
      destintionNodeId - Id of the destination folder
      authenticatedUserId - of the user acessing files
      Returns:
      AbstractNode
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId
      org.exoplatform.commons.exception.ObjectNotFoundException - when folderId doesn't exisits
    • createDocumentFromTemplateDocument

      AbstractNode createDocumentFromTemplateDocument(long ownerId, String templateDocumentId, String destinationFolderId, String title, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.commons.ObjectAlreadyExistsException
      Creates a document from a template document, in one call: the copy is created under the given title in the destination folder and one document creation is recorded, whether the user kept the proposed name or changed it. The Documents app's Duplicate and copy-paste keep copyDocument(String, String, long) and record nothing.
      Parameters:
      ownerId - owner identity id, used when destinationFolderId is blank
      templateDocumentId - identifier of the template document node
      destinationFolderId - identifier of the destination folder node
      title - title the user gave, with or without the template's extension
      authenticatedUserId - identity id of 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 folder
      org.exoplatform.commons.exception.ObjectNotFoundException - when the template document or the destination folder doesn't exist
      org.exoplatform.commons.ObjectAlreadyExistsException - when the destination folder already holds a node of the computed name
    • moveDocument

      void moveDocument(long ownerId, String fileId, String destPath, long authenticatedUserId, String conflictAction) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException, org.exoplatform.commons.ObjectAlreadyExistsException
      Move the given node.
      Parameters:
      fileId - Id of the given file
      authenticatedUserId - of the user accessing files
      conflictAction - conflict action
      Throws:
      IllegalAccessException - when the user isn't allowed to access documents of the designated parentFolderId
      org.exoplatform.commons.exception.ObjectNotFoundException - when folderId doesn't exist
      org.exoplatform.commons.ObjectAlreadyExistsException - when file with same name already exists in the target path
    • deleteDocument

      void deleteDocument(String documentPath, String documentId, boolean favorite, long delay, long authenticatedUserId) throws IllegalAccessException
      Delete a document.
      Parameters:
      documentPath - the path of document
      documentId - the Id of document
      favorite - Is favorite document
      delay - the delay to apply the delete atcion
      authenticatedUserId - of the user acessing files
      Throws:
      IllegalAccessException - when the user isn't allowed to delete document
    • undoDeleteDocument

      void undoDeleteDocument(String documentId, long authenticatedUserId)
      Undo delete a document (Cancel the delete action).
      Parameters:
      documentId - the Id of document
      authenticatedUserId - of the user acessing files
    • deleteDocuments

      void deleteDocuments(int actionId, List<AbstractNode> documents, long authenticatedUserId) throws IllegalAccessException
      Delete a list of documents.
      Parameters:
      documents - the list document
      authenticatedUserId - of the user acessing files
      Throws:
      IllegalAccessException
    • downloadDocuments

      void downloadDocuments(int actionId, List<AbstractNode> documents, long authenticatedUserId) throws IllegalAccessException
      Download a list of documents.
      Parameters:
      documents - the list document
      authenticatedUserId - of the user accessing files
      Throws:
      IllegalAccessException
    • updatePermissions

      void updatePermissions(String documentId, NodePermission nodePermissionEntity, long authenticatedUserId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • shareDocument

      void shareDocument(String documentId, long destId, long authenticatedUserId, boolean broadcast) throws IllegalAccessException
      Shares a document with given user or space
      Parameters:
      documentId - document id
      destId - target user or space identity id
      authenticatedUserId - current user Identity id
      Throws:
      IllegalAccessException
    • notifyMember

      void notifyMember(String documentId, long destId) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • unShareDocument

      void unShareDocument(String documentId, long destId) throws IllegalStateException, javax.jcr.RepositoryException
      Throws:
      IllegalStateException
      javax.jcr.RepositoryException
    • createFolder

      AbstractNode createFolder(long ownerId, String folderId, String folderPath, String name, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.ObjectAlreadyExistsException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • createFolderPath

      AbstractNode createFolderPath(String folderId, List<String> titles, long authenticatedUserId) 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 before it reused when it exists, created otherwise, as DocumentFileStorage.createFolderPath(String, List, Identity) describes.
      Parameters:
      folderId - the folder the path starts under
      titles - the folder titles, the first under that folder
      authenticatedUserId - the identity id of the user creating them
      Returns:
      the last folder of the path, created
      Throws:
      IllegalAccessException - when the user can't add a missing folder
      org.exoplatform.commons.ObjectAlreadyExistsException - when the last folder exists already
      org.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, long authenticatedUserId) 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, delegating to the ecms DocumentService.
      Parameters:
      ownerId - owner identity id (used when folderId is blank)
      folderId - identifier of the parent folder node
      folderPath - optional relative path under the parent folder
      title - document title (should already include the file extension)
      documentType - office document extension (docx, xlsx, pptx, odt, ods, odp)
      authenticatedUserId - identity id of the user creating the document
      Returns:
      the created AbstractNode
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
      org.exoplatform.commons.ObjectAlreadyExistsException
    • validateUploadedContent

      default void validateUploadedContent(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.
      Parameters:
      fileName - the file name
      mimeType - the file's type
      content - the file's content
      Throws:
      IllegalArgumentException - when a validator refuses the file, with its message
    • validateUploadedFile

      default void validateUploadedFile(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.
      Parameters:
      fileName - the file name the validators check
      mimeType - the file's type
      file - the file's location on disk
      Throws:
      IllegalArgumentException - when a validator refuses the file, with its message
      IllegalStateException - when the file can't be read
    • checkUploadConflict

      default void checkUploadConflict(String folderId, String name, UploadConflictAction conflictAction, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Checks an upload can be filed under a name in a folder with a conflict action, before its file is sent, as saveUploadedDocument(String, String, String, UploadConflictAction, long) checks it when it files it.
      Parameters:
      folderId - the folder
      name - the file name, with its extension
      conflictAction - what to do when the folder holds a file of that name
      authenticatedUserId - the identity id of 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 versions
      IllegalStateException - when the folder can't be read
      IllegalAccessException - when the user's identity can't be read
      org.exoplatform.commons.exception.ObjectNotFoundException - when the folder doesn't exist
    • saveUploadedDocument

      default AbstractNode saveUploadedDocument(String folderId, String uploadId, String name, UploadConflictAction conflictAction, long authenticatedUserId) 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: the same activity, events, hidden state and name handling.
      Parameters:
      folderId - the folder the file is filed into
      uploadId - the upload, registered in the platform's upload service; it is consumed once the file is filed
      name - the file name, with its extension
      conflictAction - what to do when the folder holds a file of that name
      authenticatedUserId - the identity id of 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 versions
      IllegalStateException - when the file couldn't be filed, or read back once filed
      IllegalAccessException - when the user can't add documents to the folder
      org.exoplatform.commons.exception.ObjectNotFoundException - when the folder or the upload doesn't exist
    • getNewName

      String getNewName(long ownerId, String folderId, String folderPath, String name) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.ObjectAlreadyExistsException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • renameDocument

      void renameDocument(long ownerId, String documentID, String name, long authenticatedUserId) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException
      Throws:
      IllegalAccessException
      org.exoplatform.commons.ObjectAlreadyExistsException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • canAccess

      boolean canAccess(String documentID, org.exoplatform.services.security.Identity aclIdentity)
    • getAclUserIdentity

      org.exoplatform.services.security.Identity getAclUserIdentity(String userName) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • updateDocumentDescription

      default void updateDocumentDescription(long ownerId, String documentID, String description, long aclIdentity) throws IllegalStateException, IllegalAccessException, javax.jcr.RepositoryException
      Throws:
      IllegalStateException
      IllegalAccessException
      javax.jcr.RepositoryException
    • updateAudioTranscription

      default void updateAudioTranscription(String documentId, String transcription, long aclIdentity) throws IllegalAccessException
      Updates the Text transcription of a Document
      Parameters:
      documentId - Video or Audio UUID
      transcription - Media Audio Transcription Text
      aclIdentity - current user Identity
      Throws:
      IllegalAccessException - when the current user can't edit the designated document
    • updateAudioTranscription

      default void updateAudioTranscription(String documentId, String transcription)
      Updates the Text transcription of a Document
      Parameters:
      documentId - Video or Audio UUID
      transcription - Media Audio Transcription Text
    • getAudioTranscription

      default String getAudioTranscription(String documentId, long aclIdentity) throws IllegalAccessException
      A previously saved media Text transcription content
      Parameters:
      documentId - Video or Audio UUID
      aclIdentity - current user Identity
      Returns:
      the transcription text
      Throws:
      IllegalAccessException - when the current user can't access the designated document
    • getAudioTranscription

      default String getAudioTranscription(String documentId)
      A previously saved media Text transcription content
      Parameters:
      documentId - Video or Audio UUID
      Returns:
      the transcription text
    • getTranscriptionState

      default TranscriptionState getTranscriptionState(String documentId, long 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 as TranscriptionStatus.DONE; a file never sent to transcription reads with a null status.
      Parameters:
      documentId - the file's UUID
      aclIdentity - the identity id of the user reading it
      Returns:
      the state, never null
      Throws:
      IllegalAccessException - when the user may not read the file
      org.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 UUID
      state - 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 UUID
      transcription - the transcript's text
      segments - the timed segments as a JSON list, or null when there are none
      state - the state to write, TranscriptionStatus.DONE
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the file does not exist
    • getTranscriptionSegments

      default String getTranscriptionSegments(String documentId, long 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 UUID
      aclIdentity - the identity id of 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 file
      org.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 UUID
      chapters - the chapters as a JSON list
      transcriptUpdated - 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, long 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 UUID
      aclIdentity - the identity id of 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 file
      org.exoplatform.commons.exception.ObjectNotFoundException - when the file does not exist, or the user cannot see it
    • getTranscriptionSpeakers

      default Map<String,String> getTranscriptionSpeakers(String documentId, long 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 UUID
      aclIdentity - the identity id of 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 file
      org.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, long 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 UUID
      speaker - the speaker's number in the transcript
      identityId - who the speaker is: the identity id of the person, or a guest's name after TranscriptSpeakers.GUEST_PREFIX; null to unname the speaker. The value is stored as given: a guest's name is validated by DocumentTranscriptionService#setGuestSpeaker, which callers go through
      aclIdentity - the identity id of the user naming it
      Throws:
      IllegalAccessException - when the user may not edit the file
      org.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 UUID
      suggestions - the proposals, one per speaker at most
      transcriptUpdated - 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, long 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 UUID
      aclIdentity - the identity id of 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 file
      org.exoplatform.commons.exception.ObjectNotFoundException - when the file does not exist, or the user cannot see it
    • removeTranscriptionSpeakerSuggestion

      default void removeTranscriptionSpeakerSuggestion(String documentId, String speaker, long 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 UUID
      speaker - the speaker's number in the transcript
      aclIdentity - the identity id of the user removing it
      Throws:
      IllegalAccessException - when the user may not edit the file
      org.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, long 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 UUID
      suggestion - the proposal
      transcriptUpdated - the update time of the transcription state the proposal was made from, in milliseconds since the epoch
      aclIdentity - the identity id of 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 file
      org.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 id
      destPath - destination path
      aclIdentity - user identity id
      conflictAction - conflictAction
      Throws:
      IllegalAccessException
      org.exoplatform.commons.ObjectAlreadyExistsException
    • getFileVersions

      List<FileVersion> getFileVersions(String fileNodeId, String aclIdentity)
      Retrieves versions of specific file
      Parameters:
      fileNodeId - target file node id
      aclIdentity - user identity id
      Returns:
      List of FileVersion
    • updateVersionSummary

      FileVersion updateVersionSummary(String originFileId, String versionId, String summary, String aclIdentity)
      update or add a version summary
      Parameters:
      originFileId - original file id
      versionId - version id
      summary - new summary to be saved
      aclIdentity - current user identity
      Returns:
      FileVersion
    • restoreVersion

      FileVersion restoreVersion(String versionId, String aclIdentity)
      restore document version
      Parameters:
      versionId - version id
      aclIdentity - current user identity
      Returns:
      FileVersion
    • canAddDocument

      boolean canAddDocument(String spaceId, String currentUserName)
      verify if current user can add document
      Parameters:
      spaceId - space id
      currentUserName - current user name
    • getDownloadZipBytes

      byte[] getDownloadZipBytes(int actionId, String userName) throws IOException
      Get the zip for download by action ID
      Parameters:
      actionId - action id
      userName - current user name
      Throws:
      IOException
    • cancelBulkAction

      void cancelBulkAction(String actionId, String userName) throws IOException
      Cancel any bulk action by action ID
      Parameters:
      actionId - action id
      userName - current user name
      Throws:
      IOException
    • createNewVersion

      FileVersion createNewVersion(String nodeId, String aclIdentity, InputStream newContent)
      Creates a new version from an input stream
      Parameters:
      nodeId - target node id
      aclIdentity - current user identity id
      newContent - the new content to be set in the new version
      Returns:
      FileVersion
    • moveDocuments

      void moveDocuments(int actionId, long ownerId, List<AbstractNode> documents, String destPath, long userIdentityId) throws IllegalAccessException
      Move list of documents in bulk
      Parameters:
      actionId - action id
      ownerId - owner id
      documents - list of documents to move
      destPath - destination path
      userIdentityId - current user identity id
      Throws:
      IllegalAccessException
    • canImport

      boolean canImport(org.exoplatform.services.security.Identity identity)
      Check if the current user can import documents from zip
      Parameters:
      identity - Current user Identity
    • getDocumentsSizeStat

      DocumentsSize getDocumentsSizeStat(long ownerId, long userIdentityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Get the total size of a space or user drive
      Parameters:
      ownerId - Id of the owner Identity
      Returns:
      the document size object
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • addDocumentsSizeStat

      DocumentsSize addDocumentsSizeStat(long ownerId, long userIdentityId) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Calculate total size of a space or user drive and store the result in new analytics entry
      Parameters:
      ownerId - Id of the owner Identity
      userIdentityId - current user identity id
      Returns:
      the document size object
      Throws:
      IllegalAccessException
      org.exoplatform.commons.exception.ObjectNotFoundException
    • hasEditPermissionOnDocument

      boolean hasEditPermissionOnDocument(String nodeId, long userIdentityId) throws IllegalAccessException
      Checks if user has edit permission on document
      Parameters:
      nodeId - document node id
      userIdentityId - user identity id
      Returns:
      true if has edit permission or false
      Throws:
      IllegalAccessException
    • hasEditPermissionOnDocument

      boolean hasEditPermissionOnDocument(String nodeId, org.exoplatform.services.security.Identity aclIdentity)
      Parameters:
      nodeId - AbstractNode technical identifier
      aclIdentity - User Identity
      Returns:
      true if has edit permission, else false
    • importFiles

      void importFiles(String ownerId, String folderId, String folderPath, String uploadId, String conflict, org.exoplatform.services.security.Identity identity, long authenticatedUserId) throws Exception
      Import list of documents from an uploaded zip
      Parameters:
      ownerId - owner id
      folderId - folder id
      folderPath - folder path
      uploadId - upload id
      conflict - conflict rule
      identity - current user identity
      authenticatedUserId - current user identity id
      Throws:
      Exception
    • getDeletedDocuments

      List<TrashElementNode> getDeletedDocuments(TrashElementNodeFilter trashElementNodeFilter) throws javax.jcr.RepositoryException
      Retrieves a list of trash elements that match the specified filter.
      Parameters:
      trashElementNodeFilter - the filter used to find trash elements
      Returns:
      a list of nodes representing the trash elements
      Throws:
      javax.jcr.RepositoryException - if an error occurs while accessing the repository
    • countDeletedDocuments

      int countDeletedDocuments()
      Counts the total number of deleted documents in the trash.
      Returns:
      the total count of deleted documents
    • restoreDocumentFromTrash

      void restoreDocumentFromTrash(String trashNodePath) throws javax.jcr.RepositoryException
      Restores a document from the trash based on the specified trash node path.
      Parameters:
      trashNodePath - the path of the trash node to restore
      Throws:
      javax.jcr.RepositoryException - if an error occurs during the restoration process
    • deleteDocumentPermanently

      void deleteDocumentPermanently(String documentPath) throws org.exoplatform.commons.exception.ObjectNotFoundException, javax.jcr.RepositoryException
      Delete a document from the trash based on the specified trash node path.
      Parameters:
      documentPath - the path of the trash node to delete
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - if a document not exist in the trash
      javax.jcr.RepositoryException - if an error occurs during the delete process
    • deleteDocumentsPermanently

      void deleteDocumentsPermanently(int actionId, List<AbstractNode> trashElementNodes, long userIdentityId) throws IllegalAccessException
      Delete a list of documents from the trash.
      Parameters:
      actionId - the delete permanently action identifier
      trashElementNodes - the list of the trash nodes to delete
      userIdentityId - the user identity identifier
      Throws:
      IllegalAccessException
    • restoreDocuments

      void restoreDocuments(int actionId, List<AbstractNode> trashElementNodes, long userIdentityId) throws IllegalAccessException
      Restore a list of documents from the trash.
      Parameters:
      actionId - the restore action identifier
      trashElementNodes - the list of the trash nodes to restore
      userIdentityId - the user identity identifier
      Throws:
      IllegalAccessException
    • getImageThumbnailContent

      io.meeds.portal.thumbnail.model.FileContent getImageThumbnailContent(String fileType, String documentId, String userName, int width, int height) throws Exception
      Get image thumbnail content, always at the one preview size the documents clients display, whatever width and height are asked: this read stores no thumbnail at any other size.
      Parameters:
      fileType - the file type
      documentId - the document Id
      userName - the user name
      width - the width asked, not used to size the thumbnail
      height - the height asked, not used to size the thumbnail
      Throws:
      Exception
    • createThumbnail

      org.exoplatform.commons.file.model.FileItem createThumbnail(String fileType, io.meeds.portal.thumbnail.model.FileContent fileContent, String userName, int width, int height) throws Exception
      Create thumbnail for given image, always at the one preview size getImageThumbnailContent(String, String, String, int, int) reads, whatever width and height are asked.
      Parameters:
      fileType - the file type
      fileContent - the FileContent object
      userName - the user name
      width - the width asked, not used to size the thumbnail
      height - the height asked, not used to size the thumbnail
      Throws:
      Exception
    • setDocumentVisibility

      void setDocumentVisibility(long ownerId, String documentID, Boolean hidden, long authenticatedUserId) throws Exception
      Set the document visibility.
      Parameters:
      ownerId - the owner Id
      documentID - theDocument Id
      hidden - the hidden value
      authenticatedUserId - userId
      Throws:
      Exception
    • getDocumentCategoryIds

      default List<Long> getDocumentCategoryIds(String documentId)
      Parameters:
      documentId - Document identifier
      Returns:
      List of linked category identifiers
    • getDocumentCategoryIds

      default List<Long> getDocumentCategoryIds(long spaceIdentityId, String userName)
      Parameters:
      spaceIdentityId - Space Identity Identifier
      Returns:
      List of Category Ids used in Documents
    • getSpaceRootFolder

      default FolderNode getSpaceRootFolder(long spaceId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Retrieves the Root folder Path of a Space
      Parameters:
      spaceId - Space technical identifier
      aclIdentity - user willing to access the space's root folder
      Returns:
      the root FolderNode for the designated space
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the space doesn't exist
      IllegalAccessException - when the user isn't allowed to access documents of the designated space
    • getPersonalRootFolder

      default FolderNode getPersonalRootFolder(org.exoplatform.services.security.Identity aclIdentity)
      Retrieves the Root folder Path of a user
      Parameters:
      aclIdentity - user willing to access his/her own root folder
      Returns:
      the root FolderNode for the designated user
    • getRootFolderOwnerId

      default long getRootFolderOwnerId(String documentId)
      Return the root folder owner Identity id
      Parameters:
      documentId - JCR Node Id by example
      Returns:
      Identity id
    • getFileContentAsText

      default String getFileContentAsText(String documentId)
      Returns a document file content as Text
      Parameters:
      documentId - Document identifier
      Returns:
      the text representation of a file
    • getFileTextContent

      default DocumentTextContent getFileTextContent(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. 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

      default DocumentTextPage getFileTextPage(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. 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 identifier
      offset - the first character to read
      maxChars - 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, long userIdentityId)
      Returns a document file content as Stream
      Parameters:
      documentId - Document identifier
      userIdentityId - User Identity identifier accessing the file binary
      Returns:
      the file binary
    • synchronizeSpacePermissions

      void synchronizeSpacePermissions(org.exoplatform.social.core.space.model.Space space)
      Synchronizes JCR node permissions for a space, automatically detecting whether the space is in redactional mode based on Space. Rewrites node ACLs from open to redactional or vice versa when the space still has standard (uncustomized) permissions.
      Parameters:
      space - Space