Interface DocumentService

  • All Superinterfaces:
    ComponentService<com.flower.docs.domain.document.Document>, CRUDService<com.flower.docs.domain.document.Document>, EditService<com.flower.docs.domain.document.Document>

    public interface DocumentService
    extends ComponentService<com.flower.docs.domain.document.Document>
    Service dedicated to Document management
    Author:
    Christopher Laszczuk
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<com.flower.docs.domain.file.DocumentFile> addFiles​(com.flower.docs.domain.common.Id id, java.util.List<com.flower.docs.domain.file.DocumentFile> files, boolean replace)
      Adds multiple files to a document.
      java.util.List<com.flower.docs.domain.document.Document> create​(java.util.List<com.flower.docs.domain.document.Document> documents)
      Creates a document with its files.
      void deleteFiles​(com.flower.docs.domain.common.Id id, java.util.List<com.flower.docs.domain.common.Id> fileIds)
      Deletes files of a document.
      com.flower.docs.domain.file.DocumentFile getFile​(com.flower.docs.domain.common.Id documentId, com.flower.docs.domain.common.Id fileId, boolean includeContent)
      Get a specific file of document.
      java.util.List<com.flower.docs.domain.file.DocumentFile> getFiles​(com.flower.docs.domain.common.Id id, boolean includeContent)
      Get files of document.
    • Method Detail

      • create

        java.util.List<com.flower.docs.domain.document.Document> create​(java.util.List<com.flower.docs.domain.document.Document> documents)
                                                                 throws com.flower.docs.domain.exception.FunctionalException,
                                                                        com.flower.docs.domain.exception.TechnicalException
        Creates a document with its files.
        Note: If a document to create has no class, it will be created as Status.DRAFT. This allows an asynchronous document creation. File operation on a draft document does not require any specific permission.
        Specified by:
        create in interface CRUDService<com.flower.docs.domain.document.Document>
        Parameters:
        documents - The documents to create. If a document has no class, it will be created as Status.DRAFT
        Returns:
        The created documents
        Throws:
        com.flower.docs.domain.exception.TechnicalException - If a technical error occurred during process
        com.flower.docs.domain.exception.FunctionalException - If a functional error occurred during process
      • getFiles

        java.util.List<com.flower.docs.domain.file.DocumentFile> getFiles​(com.flower.docs.domain.common.Id id,
                                                                          boolean includeContent)
                                                                   throws com.flower.docs.domain.exception.TechnicalException,
                                                                          com.flower.docs.domain.exception.FunctionalException
        Get files of document.
        Parameters:
        id - The identifier of the document whose files are requested IdentifiableElement.getId()
        includeContent - Determines if the file contents should be included or not
        Returns:
        The requested files
        Throws:
        com.flower.docs.domain.exception.TechnicalException - If a technical error occurred during process
        com.flower.docs.domain.exception.FunctionalException - If a functional error occurred during process
        See Also:
        DocumentFile.getContent()
      • getFile

        com.flower.docs.domain.file.DocumentFile getFile​(com.flower.docs.domain.common.Id documentId,
                                                         com.flower.docs.domain.common.Id fileId,
                                                         boolean includeContent)
                                                  throws com.flower.docs.domain.exception.TechnicalException,
                                                         com.flower.docs.domain.exception.FunctionalException
        Get a specific file of document.
        Parameters:
        documentId - The identifier of the document whose files are requested IdentifiableElement.getId()
        fileId - The identifier of the document file IdentifiableElement.getId()
        includeContent - Determines if the file contents should be included or not
        Returns:
        The requested file
        Throws:
        com.flower.docs.domain.exception.TechnicalException - If a technical error occurred during process
        com.flower.docs.domain.exception.FunctionalException - If a functional error occurred during process
        See Also:
        DocumentFile.getContent()
      • addFiles

        java.util.List<com.flower.docs.domain.file.DocumentFile> addFiles​(com.flower.docs.domain.common.Id id,
                                                                          java.util.List<com.flower.docs.domain.file.DocumentFile> files,
                                                                          boolean replace)
                                                                   throws com.flower.docs.domain.exception.TechnicalException,
                                                                          com.flower.docs.domain.exception.FunctionalException
        Adds multiple files to a document.
        Parameters:
        id - The document id IdentifiableElement.getId()
        files - The files to add IdentifiableElement.getId()
        replace - Determines if actual document files should be replaced by provided ones
        Returns:
        The created files without their content
        Throws:
        com.flower.docs.domain.exception.TechnicalException - If a technical error occurred during process
        com.flower.docs.domain.exception.FunctionalException - If a functional error occurred during process
      • deleteFiles

        void deleteFiles​(com.flower.docs.domain.common.Id id,
                         java.util.List<com.flower.docs.domain.common.Id> fileIds)
                  throws com.flower.docs.domain.exception.TechnicalException,
                         com.flower.docs.domain.exception.FunctionalException
        Deletes files of a document.
        Parameters:
        id - The document id IdentifiableElement.getId()
        fileIds - The identifiers of files to delete IdentifiableElement.getId()
        Throws:
        com.flower.docs.domain.exception.TechnicalException - If a technical error occurred during process
        com.flower.docs.domain.exception.FunctionalException - If a functional error occurred during process