Interface DocumentManager

All Known Implementing Classes:
WorkflowDocumentManagerImpl

public interface DocumentManager
Hippo CMS Document/Folder Workflow manager.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.hippoecm.repository.api.Document
    commitEditableDocument(String documentLocation)
    Commits the draft variant which is currently being edited.
    org.hippoecm.repository.api.Document
    commitEditableDocument(org.hippoecm.repository.api.Document editableDocument)
    Commits the draft variant which is currently being edited.
    copyDocument(String sourceDocumentLocation, String targetFolderLocation, String targetDocumentName)
    Copies a document at the source document handle path (sourceDocumentLocation) to the target folder path (targetFolderLocation) with the given document node name (targetDocumentName).
    createDocument(String folderLocation, String primaryTypeName, String nodeName, String locale, String localizedName)
    Creates a document in the specific folderLocation.
    void
    deleteDocument(String documentLocation)
    Deletes a document at at the given document handle path (documentLocation).
    boolean
    depublishDocument(String documentLocation)
    Takes offline the document at the given document handle path (documentLocation).
    org.hippoecm.repository.api.Document
    disposeEditableDocument(String documentLocation)
    Discards the draft variant which is currently being edited.
    org.hippoecm.repository.api.Document
    disposeEditableDocument(org.hippoecm.repository.api.Document editableDocument)
    Discards the draft variant which is currently being edited.
    boolean
    documentExists(String documentLocation)
    Returns true if a document exists at documentLocation.
    boolean
    folderExists(String folderLocation)
    Returns true if a folder exists at folderLocation.
    org.onehippo.repository.documentworkflow.DocumentWorkflow
    getDocumentWorkflow(Node documentHandleNode)
    Returns a document workflow on documentHandleNode.
    Returns the physical document handle node for the logical document location.
    getExistingDocumentPath(String documentLocation)
    Returns the physical document handle node path for the logical document location.
    getExistingFolderNode(String folderLocation)
    Returns the physical folder node for the logical folder location.
    getExistingFolderPath(String folderLocation)
    Returns the physical folder node path for the logical folder location.
    org.slf4j.Logger
    Returns the logger used by DocumentManager.
    Returns the JCR session.
    org.hippoecm.repository.api.Document
    obtainEditableDocument(String documentLocation)
    Obtains an editable draft variant Document under the given document handle path (documentLocation).
    org.hippoecm.repository.api.Document
    obtainEditableDocument(Node documentHandleNode)
    Obtains an editable draft variant Document of the given document handle node (documentHandleNode).
    boolean
    publishDocument(String documentLocation)
    Publishes the document at the given document handle path (documentLocation).
    void
    setLogger(org.slf4j.Logger logger)
    Sets a logger to DocumentManager.
    org.hippoecm.repository.api.Document
    translateDocument(String sourceDocumentLocation, String language, String name)
    Translates a document at the document handle path (sourceDocumentLocation) to name in language.
    org.hippoecm.repository.api.Document
    translateFolder(String sourceFolderLocation, String language, String name)
    Translates a folder at the folder path (sourceFolderLocation) to name in language.
    void
    updateEditableDocument(org.hippoecm.repository.api.Document editableDocument, org.onehippo.forge.content.pojo.model.ContentNode sourceContentNode)
    Update editable Document instance (editableDocument) by the content of the given sourceContentNode.
  • Method Details

    • getLogger

      org.slf4j.Logger getLogger()
      Returns the logger used by DocumentManager.
      Returns:
      the logger used by DocumentManager
    • setLogger

      void setLogger(org.slf4j.Logger logger)
      Sets a logger to DocumentManager.
      Parameters:
      logger - the logger to be used by DocumentManager
    • getSession

      Session getSession()
      Returns the JCR session.
      Returns:
      the JCR session
    • documentExists

      boolean documentExists(String documentLocation) throws DocumentManagerException
      Returns true if a document exists at documentLocation.
      Parameters:
      documentLocation - document handle node path
      Returns:
      true if a document exists at documentLocation
      Throws:
      DocumentManagerException - if fails to process
    • getExistingDocumentPath

      String getExistingDocumentPath(String documentLocation) throws DocumentManagerException
      Returns the physical document handle node path for the logical document location. Returns null if document doesn't exist at the location, without any exception, unlike getExistingDocumentHandleNode(String).
      Parameters:
      documentLocation - logical document location
      Returns:
      the physical document handle node path for the logical document location
      Throws:
      DocumentManagerException - if fails to process
    • getExistingDocumentHandleNode

      Node getExistingDocumentHandleNode(String documentLocation) throws DocumentManagerNotFoundException, RepositoryException
      Returns the physical document handle node for the logical document location. Throws a DocumentManagerNotFoundException if document doesn't exist at the location, unlike getExistingDocumentPath(String).
      Parameters:
      documentLocation - logical document location
      Returns:
      the physical document handle node for the logical document location
      Throws:
      DocumentManagerNotFoundException - if cannot find a document
      RepositoryException - if any repository exception occurs
    • folderExists

      boolean folderExists(String folderLocation) throws DocumentManagerException
      Returns true if a folder exists at folderLocation.
      Parameters:
      folderLocation - folder node path
      Returns:
      true if a folder exists at folderLocation
      Throws:
      DocumentManagerException - if fails to process
    • getExistingFolderPath

      String getExistingFolderPath(String folderLocation) throws DocumentManagerException
      Returns the physical folder node path for the logical folder location. Returns null if folder doesn't exist at the location, without any exception, unlike getExistingFolderNode(String).
      Parameters:
      folderLocation - logical folder location
      Returns:
      the physical folder node path for the logical folder location
      Throws:
      DocumentManagerException - if fails to process
    • getExistingFolderNode

      Node getExistingFolderNode(String folderLocation) throws DocumentManagerNotFoundException, RepositoryException
      Returns the physical folder node for the logical folder location. Throws a DocumentManagerNotFoundException if folder doesn't exist at the location, unlike getExistingDocumentPath(String).
      Parameters:
      folderLocation - logical folder location
      Returns:
      the physical folder node for the logical folder location
      Throws:
      DocumentManagerException - if cannot find a folder
      RepositoryException - if any repository exception occurs
      DocumentManagerNotFoundException
    • createDocument

      String createDocument(String folderLocation, String primaryTypeName, String nodeName, String locale, String localizedName) throws DocumentManagerException
      Creates a document in the specific folderLocation.
      Parameters:
      folderLocation - destination folder path
      primaryTypeName - primary node type name of document to be created
      nodeName - document node name
      locale - locale for the document display name. e.g, "en"
      localizedName - localized document name associated with the locale
      Returns:
      created document handle path
      Throws:
      DocumentManagerException - if fails to process
    • obtainEditableDocument

      org.hippoecm.repository.api.Document obtainEditableDocument(String documentLocation) throws DocumentManagerException
      Obtains an editable draft variant Document under the given document handle path (documentLocation).
      Parameters:
      documentLocation - document handle path
      Returns:
      a Document instance if the operation was successful
      Throws:
      DocumentManagerException - if fails to process
    • obtainEditableDocument

      org.hippoecm.repository.api.Document obtainEditableDocument(Node documentHandleNode) throws DocumentManagerException
      Obtains an editable draft variant Document of the given document handle node (documentHandleNode).
      Parameters:
      documentHandleNode - document handle node
      Returns:
      a Document instance if the operation was successful
      Throws:
      DocumentManagerException - if fails to process
    • updateEditableDocument

      void updateEditableDocument(org.hippoecm.repository.api.Document editableDocument, org.onehippo.forge.content.pojo.model.ContentNode sourceContentNode) throws DocumentManagerException
      Update editable Document instance (editableDocument) by the content of the given sourceContentNode.
      Parameters:
      editableDocument - Document instance to edit
      sourceContentNode - source content node
      Throws:
      DocumentManagerException - if fails to process
    • disposeEditableDocument

      org.hippoecm.repository.api.Document disposeEditableDocument(String documentLocation) throws DocumentManagerException
      Discards the draft variant which is currently being edited.
      Parameters:
      documentLocation - document handle path
      Returns:
      Document instance discarded if the operation was successful
      Throws:
      DocumentManagerException - if fails to process
    • disposeEditableDocument

      org.hippoecm.repository.api.Document disposeEditableDocument(org.hippoecm.repository.api.Document editableDocument) throws DocumentManagerException
      Discards the draft variant which is currently being edited.
      Parameters:
      editableDocument - document object
      Returns:
      Document instance discarded if the operation was successful
      Throws:
      DocumentManagerException - if fails to process
    • commitEditableDocument

      org.hippoecm.repository.api.Document commitEditableDocument(String documentLocation) throws DocumentManagerException
      Commits the draft variant which is currently being edited.
      Parameters:
      documentLocation - document handle path
      Returns:
      Document instance committed if the operation was successful
      Throws:
      DocumentManagerException - if fails to process
    • commitEditableDocument

      org.hippoecm.repository.api.Document commitEditableDocument(org.hippoecm.repository.api.Document editableDocument) throws DocumentManagerException
      Commits the draft variant which is currently being edited.
      Parameters:
      editableDocument - document object
      Returns:
      Document instance committed if the operation was successful
      Throws:
      DocumentManagerException - if fails to process
    • publishDocument

      boolean publishDocument(String documentLocation) throws DocumentManagerException
      Publishes the document at the given document handle path (documentLocation).
      Parameters:
      documentLocation - document handle path
      Returns:
      true if the operation was successful, false otherwise
      Throws:
      DocumentManagerException - if fails to process
    • depublishDocument

      boolean depublishDocument(String documentLocation) throws DocumentManagerException
      Takes offline the document at the given document handle path (documentLocation).
      Parameters:
      documentLocation - document handle path
      Returns:
      true if the operation was successful, false otherwise
      Throws:
      DocumentManagerException - if fails to process
    • deleteDocument

      void deleteDocument(String documentLocation) throws DocumentManagerException
      Deletes a document at at the given document handle path (documentLocation).
      Parameters:
      documentLocation - document handle path
      Throws:
      DocumentManagerException - if fails to process
    • copyDocument

      String copyDocument(String sourceDocumentLocation, String targetFolderLocation, String targetDocumentName) throws DocumentManagerException
      Copies a document at the source document handle path (sourceDocumentLocation) to the target folder path (targetFolderLocation) with the given document node name (targetDocumentName).
      Parameters:
      sourceDocumentLocation - source document handle path
      targetFolderLocation - target folder path
      targetDocumentName - target document handle node name
      Returns:
      the copied target document handle path
      Throws:
      DocumentManagerException - if fails to process
    • translateFolder

      org.hippoecm.repository.api.Document translateFolder(String sourceFolderLocation, String language, String name) throws DocumentManagerException
      Translates a folder at the folder path (sourceFolderLocation) to name in language.
      Parameters:
      sourceFolderLocation - source folder path
      language - target language to translate to
      name - target folder node name
      Returns:
      the translated target folder Document instance
      Throws:
      DocumentManagerException - if fails to process
    • translateDocument

      org.hippoecm.repository.api.Document translateDocument(String sourceDocumentLocation, String language, String name) throws DocumentManagerException
      Translates a document at the document handle path (sourceDocumentLocation) to name in language.
      Parameters:
      sourceDocumentLocation - source document handle path
      language - target language to translate to
      name - target document handle node name
      Returns:
      the translated target document Document instance
      Throws:
      DocumentManagerException - if fails to process
    • getDocumentWorkflow

      org.onehippo.repository.documentworkflow.DocumentWorkflow getDocumentWorkflow(Node documentHandleNode) throws RepositoryException
      Returns a document workflow on documentHandleNode.
      Parameters:
      documentHandleNode - document handle node
      Returns:
      a document workflow on documentHandleNode
      Throws:
      RepositoryException - if unexpected repository exception occurs