Class WorkflowDocumentManagerImpl

java.lang.Object
org.onehippo.forge.content.exim.core.impl.WorkflowDocumentManagerImpl
All Implemented Interfaces:
DocumentManager

public class WorkflowDocumentManagerImpl extends Object implements DocumentManager
Default implementation for DocumentManager using Hippo Workflow APIs.
  • Constructor Details

    • WorkflowDocumentManagerImpl

      public WorkflowDocumentManagerImpl(Session session)
      Constructs with session.
      Parameters:
      session - JCR session to use
  • Method Details

    • getLogger

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

      public void setLogger(org.slf4j.Logger logger)
      Sets a logger to DocumentManager.
      Specified by:
      setLogger in interface DocumentManager
      Parameters:
      logger - the logger to be used by DocumentManager
    • getContentNodeBinder

      public org.onehippo.forge.content.pojo.binder.ContentNodeBinder<Node,org.onehippo.forge.content.pojo.model.ContentItem,Value> getContentNodeBinder()
      Returns ContentNodeBinder instance. If not set, returns a default implementation.
      Returns:
      ContentNodeBinder instance. If not set, returns a default implementation
    • setContentNodeBinder

      public void setContentNodeBinder(org.onehippo.forge.content.pojo.binder.ContentNodeBinder<Node,org.onehippo.forge.content.pojo.model.ContentItem,Value> contentNodeBinder)
      Sets ContentNodeBinder instance.
      Parameters:
      contentNodeBinder - ContentNodeBinder instance
    • getContentNodeBindingItemFilter

      public org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem> getContentNodeBindingItemFilter()
      Returns ContentNodeBindingItemFilter instance. If not set, returns a default implementation.
      Returns:
      ContentNodeBindingItemFilter instance. If not set, returns a default implementation
    • setContentNodeBindingItemFilter

      public void setContentNodeBindingItemFilter(org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem> contentNodeBindingItemFilter)
      Sets ContentNodeBindingItemFilter instance.
      Parameters:
      contentNodeBindingItemFilter - ContentNodeBindingItemFilter instance
    • getDocumentWorkflowCategory

      public String getDocumentWorkflowCategory()
      Returns the document workflow category.
      Returns:
      the document workflow category
    • setDocumentWorkflowCategory

      public void setDocumentWorkflowCategory(String documentWorkflowCategory)
      Sets the document workflow category
      Parameters:
      documentWorkflowCategory - the document workflow category
    • getDefaultWorkflowCategory

      public String getDefaultWorkflowCategory()
      Returns the default workflow category.
      Returns:
      the default workflow category
    • setDefaultWorkflowCategory

      public void setDefaultWorkflowCategory(String defaultWorkflowCategory)
      Sets the default workflow category.
      Parameters:
      defaultWorkflowCategory - the default workflow category
    • getFolderWorkflowCategory

      public String getFolderWorkflowCategory()
      Returns the folder workflow category.
      Returns:
      the folder workflow category
    • setFolderWorkflowCategory

      public void setFolderWorkflowCategory(String folderWorkflowCategory)
      Sets the folder workflow category.
      Parameters:
      folderWorkflowCategory - the folder workflow category
    • getFolderTranslationWorkflowCategory

      public String getFolderTranslationWorkflowCategory()
      Returns the folder translation workflow category.
      Returns:
      the folder translation workflow category
    • setFolderTranslationWorkflowCategory

      public void setFolderTranslationWorkflowCategory(String folderTranslationWorkflowCategory)
      Sets the folder translation workflow category.
      Parameters:
      folderTranslationWorkflowCategory - the folder translation workflow category
    • getDocumentTranslationWorkflowCategory

      public String getDocumentTranslationWorkflowCategory()
      Returns the document translation workflow category.
      Returns:
      the document translation workflow category
    • setDocumentTranslationWorkflowCategory

      public void setDocumentTranslationWorkflowCategory(String documentTranslationWorkflowCategory)
      Sets the document translation workflow category.
      Parameters:
      documentTranslationWorkflowCategory - the document translation workflow category
    • getSession

      public Session getSession()
      Returns the JCR session.
      Specified by:
      getSession in interface DocumentManager
      Returns:
      the JCR session
    • documentExists

      public boolean documentExists(String documentLocation) throws DocumentManagerException
      Description copied from interface: DocumentManager
      Returns true if a document exists at documentLocation.
      Specified by:
      documentExists in interface DocumentManager
      Parameters:
      documentLocation - document handle node path
      Returns:
      true if a document exists at documentLocation
      Throws:
      DocumentManagerException - if fails to process
    • getExistingDocumentPath

      public String getExistingDocumentPath(String documentLocation) throws DocumentManagerException
      Description copied from interface: DocumentManager
      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 DocumentManager.getExistingDocumentHandleNode(String).
      Specified by:
      getExistingDocumentPath in interface DocumentManager
      Parameters:
      documentLocation - logical document location
      Returns:
      the physical document handle node path for the logical document location
      Throws:
      DocumentManagerException - if fails to process
    • getExistingDocumentHandleNode

      public Node getExistingDocumentHandleNode(String documentLocation) throws DocumentManagerNotFoundException, RepositoryException
      Description copied from interface: DocumentManager
      Returns the physical document handle node for the logical document location. Throws a DocumentManagerNotFoundException if document doesn't exist at the location, unlike DocumentManager.getExistingDocumentPath(String).
      Specified by:
      getExistingDocumentHandleNode in interface DocumentManager
      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

      public boolean folderExists(String folderLocation) throws DocumentManagerException
      Description copied from interface: DocumentManager
      Returns true if a folder exists at folderLocation.
      Specified by:
      folderExists in interface DocumentManager
      Parameters:
      folderLocation - folder node path
      Returns:
      true if a folder exists at folderLocation
      Throws:
      DocumentManagerException - if fails to process
    • getExistingFolderPath

      public String getExistingFolderPath(String folderLocation) throws DocumentManagerException
      Description copied from interface: DocumentManager
      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 DocumentManager.getExistingFolderNode(String).
      Specified by:
      getExistingFolderPath in interface DocumentManager
      Parameters:
      folderLocation - logical folder location
      Returns:
      the physical folder node path for the logical folder location
      Throws:
      DocumentManagerException - if fails to process
    • getExistingFolderNode

      public Node getExistingFolderNode(String folderLocation) throws DocumentManagerNotFoundException, RepositoryException
      Description copied from interface: DocumentManager
      Returns the physical folder node for the logical folder location. Throws a DocumentManagerNotFoundException if folder doesn't exist at the location, unlike DocumentManager.getExistingDocumentPath(String).
      Specified by:
      getExistingFolderNode in interface DocumentManager
      Parameters:
      folderLocation - logical folder location
      Returns:
      the physical folder node for the logical folder location
      Throws:
      RepositoryException - if any repository exception occurs
      DocumentManagerNotFoundException
    • createDocument

      public String createDocument(String folderLocation, String primaryTypeName, String nodeName, String locale, String localizedName) throws DocumentManagerException
      Creates a document in the specific folderLocation.
      Specified by:
      createDocument in interface DocumentManager
      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

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

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

      public 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.
      Specified by:
      updateEditableDocument in interface DocumentManager
      Parameters:
      editableDocument - Document instance to edit
      sourceContentNode - source content node
      Throws:
      DocumentManagerException - if fails to process
    • disposeEditableDocument

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

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

      protected org.hippoecm.repository.api.Document disposeEditableDocument(Node documentHandleNode) throws DocumentManagerException
      Discards the draft variant which is currently being edited.
      Throws:
      DocumentManagerException
    • commitEditableDocument

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

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

      protected org.hippoecm.repository.api.Document commitEditableDocument(Node documentHandleNode) throws DocumentManagerException
      Commits the draft variant which is currently being edited.
      Throws:
      DocumentManagerException
    • publishDocument

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

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

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

      public String copyDocument(String sourceDocumentLocation, String targetFolderLocation, String targetDocumentNodeName) 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).
      Specified by:
      copyDocument in interface DocumentManager
      Parameters:
      sourceDocumentLocation - source document handle path
      targetFolderLocation - target folder path
      targetDocumentNodeName - target document handle node name
      Returns:
      the copied target document handle path
      Throws:
      DocumentManagerException - if fails to process
    • translateFolder

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

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

      public org.onehippo.repository.documentworkflow.DocumentWorkflow getDocumentWorkflow(Node documentHandleNode) throws RepositoryException
      Returns a document workflow on documentHandleNode.
      Specified by:
      getDocumentWorkflow in interface DocumentManager
      Parameters:
      documentHandleNode - document handle node
      Returns:
      a document workflow on documentHandleNode
      Throws:
      RepositoryException - if unexpected repository exception occurs
    • getFolderWorkflow

      protected org.hippoecm.repository.standardworkflow.FolderWorkflow getFolderWorkflow(Node folderNode) throws RepositoryException
      Returns a folder workflow instance on folderNode.
      Parameters:
      folderNode - folder node
      Returns:
      a folder workflow instance on folderNode
      Throws:
      RepositoryException - if unexpected repository exception occurs
    • getDefaultWorkflow

      protected org.hippoecm.repository.standardworkflow.DefaultWorkflow getDefaultWorkflow(Node documentHandleNode) throws RepositoryException
      Returns a DefaultWorkflow instance on documentHandleNode.
      Parameters:
      documentHandleNode - document handle node
      Returns:
      DefaultWorkflow instance on documentHandleNode
      Throws:
      RepositoryException - if unexpected repository exception occurs
    • getFolderTranslationWorkflow

      protected org.hippoecm.repository.translation.TranslationWorkflow getFolderTranslationWorkflow(Node folderNode) throws RepositoryException
      Returns a folder TranslationWorkflow instance on folderNode.
      Parameters:
      folderNode - folder node
      Returns:
      a folder TranslationWorkflow instance on folderNode
      Throws:
      RepositoryException - if unexpected repository exception occurs
    • getDocumentVariantTranslationWorkflow

      protected org.hippoecm.repository.translation.TranslationWorkflow getDocumentVariantTranslationWorkflow(Node documentVariantNode) throws RepositoryException
      Returns a document TranslationWorkflow instance on documentVariantNode.
      Parameters:
      documentVariantNode - document variant node
      Returns:
      a document TranslationWorkflow instance on documentVariantNode
      Throws:
      RepositoryException - if unexpected repository exception occurs