Interface DocumentServiceLocal


public interface DocumentServiceLocal
Interface for a document service class.

Since:
4.5.0-object-storage
  • Method Details

    • getDocumentById

      Optional<Document> getDocumentById(DocumentId documentId)
      Parameters:
      documentId - id of the document
      Returns:
      document object
    • createDocumentQuery

      DocumentQuery createDocumentQuery()
      Creates a new DocumentQuery for querying documents.
      Returns:
      a new DocumentQuery instance
    • duplicateDocument

      DocumentId duplicateDocument(DocumentId documentId, PublicationId destinationPublicationId, String name, boolean tryToUseDocumentTemplate) throws DocumentServiceException
      Duplicates a document
      Parameters:
      documentId - id of the (source) document to duplicate
      destinationPublicationId - id of the destination publication
      name - new name of the document or empty for the same name
      tryToUseDocumentTemplate - create a new document based on the document template from the source document
      Returns:
      id of the new created (duplicated) document
      Throws:
      DocumentServiceException
    • createDocumentFromTemplate

      DocumentId createDocumentFromTemplate(PublicationId parentPublicationId, DocumentId documentTemplateId, String newDocumentName, String masterPage) throws DocumentServiceException
      Creates a new document from document template
      Parameters:
      parentPublicationId - id of the destination publication
      documentTemplateId - id of the document template
      newDocumentName - name of the new document
      masterPage - master page of document template
      Returns:
      id of the new created document
      Throws:
      DocumentServiceException
    • createMultipleDocumentsFromTemplate

      List<DocumentId> createMultipleDocumentsFromTemplate(PublicationId parentPublicationId, DocumentId documentTemplateId, List<String> newDocumentNames, String masterPage) throws DocumentServiceException
      Creates multiple documents from document template
      Parameters:
      parentPublicationId - id of the destination publication
      documentTemplateId - id of the document template
      newDocumentNames - list of names of the new documents
      masterPage - master page of document template
      Returns:
      id of the new created document
      Throws:
      DocumentServiceException
    • update

      void update(Document document) throws DocumentServiceException
      Updates an existing document
      Parameters:
      document - the document to update
      Throws:
      DocumentServiceException
    • update

      void update(List<Document> documents) throws DocumentServiceException
      Updates existing documents
      Parameters:
      documents - list of the documents to update
      Throws:
      DocumentServiceException
    • delete

      void delete(DocumentId documentId) throws DocumentServiceException
      Deletes an existing document. It is a soft deletion - moving a document to the trash
      Parameters:
      documentId - the id of the document to delete
      Throws:
      DocumentServiceException
    • createDocumentParameterQuery

      default DocumentParameterQuery createDocumentParameterQuery()
      Creates a new DocumentParameterQuery for querying document parameters.
      Returns:
      a new DocumentParameterQuery instance
      Throws:
      NotImplementedException - if the method is not implemented
    • getDocumentParameterById

      default Optional<DocumentParameter> getDocumentParameterById(ParameterId parameterId)
      Retrieves a document parameter by its ID.
      Parameters:
      parameterId - the ID of the document parameter
      Returns:
      an Optional containing the document parameter if found, or an empty Optional if not
      Throws:
      NotImplementedException - if the method is not implemented
    • updateDocumentParameter

      default void updateDocumentParameter(DocumentParameter documentParameter)
      Updates an existing document parameter.
      Parameters:
      documentParameter - the document parameter to update
      Throws:
      NotImplementedException - if the method is not implemented
    • updateDocumentParameters

      default void updateDocumentParameters(List<DocumentParameter> documentParameters)
      Updates a list of document parameters.
      Parameters:
      documentParameters - the list of document parameters to update
      Throws:
      NotImplementedException - if the method is not implemented
    • createDocumentTemplate

      default DocumentId createDocumentTemplate(String documentTemplateName, DocumentTemplateStatus status) throws DocumentServiceException
      Creates a new document template
      Parameters:
      documentTemplateName - name of the document template
      status - enabled or disabled
      Returns:
      new DocumentId
      Throws:
      DocumentServiceException
    • addDocumentParameter

      default Optional<DocumentParameter> addDocumentParameter(DocumentId documentId, ParameterDefinitionId parameterId) throws DocumentServiceException
      Add parameter to document.
      Parameters:
      documentId - the id of document
      parameterId - the id of parameter to add
      Returns:
      an Optional containing the created document parameter
      Throws:
      NotImplementedException - if the method is not implemented
      DocumentServiceException
    • deleteDocumentParameter

      default void deleteDocumentParameter(DocumentParameter parameter)
      Delete DocumentParameter.
      Parameters:
      parameter - the parameter object to delete
      Throws:
      NotImplementedException - if the method is not yet implemented
    • permanentlyDeleteDocument

      default void permanentlyDeleteDocument(DocumentId documentId) throws DocumentServiceException
      Deletes the document at the specified ID

      Deletes document from trash, file, spreads and previews, plannings, document parameters, workflow items and workflow todos.

      Parameters:
      documentId - the id of the document to delete
      Throws:
      DocumentServiceException
    • restoreDeletedDocument

      default void restoreDeletedDocument(DocumentId documentId) throws DocumentServiceException
      change "deleted" the flag to "0" document at the specified ID

      Restore document from the trash.

      Parameters:
      documentId - the id of the document to restore
      Throws:
      DocumentServiceException
    • assignGridPageTemplate

      default void assignGridPageTemplate(String documentId, int pageId, int pageTemplateId)
      Assigns a grid page template to a document.
      Parameters:
      documentId - the ID of the document
      pageId - the ID of the page within the document
      pageTemplateId - the ID of the grid page template to assign
      Throws:
      NotImplementedException - if the method is not implemented