Class WorkflowDocumentManagerImpl
java.lang.Object
org.onehippo.forge.content.exim.core.impl.WorkflowDocumentManagerImpl
- All Implemented Interfaces:
DocumentManager
Default implementation for
DocumentManager using Hippo Workflow APIs.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.hippoecm.repository.api.DocumentcommitEditableDocument(String documentLocation) Commits the draft variant which is currently being edited.protected org.hippoecm.repository.api.DocumentcommitEditableDocument(Node documentHandleNode) Commits the draft variant which is currently being edited.org.hippoecm.repository.api.DocumentcommitEditableDocument(org.hippoecm.repository.api.Document editableDocument) Commits the draft variant which is currently being edited.copyDocument(String sourceDocumentLocation, String targetFolderLocation, String targetDocumentNodeName) 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 specificfolderLocation.voiddeleteDocument(String documentLocation) Deletes a document at at the given document handle path (documentLocation).booleandepublishDocument(String documentLocation) Takes offline the document at the given document handle path (documentLocation).org.hippoecm.repository.api.DocumentdisposeEditableDocument(String documentLocation) Discards the draft variant which is currently being edited.protected org.hippoecm.repository.api.DocumentdisposeEditableDocument(Node documentHandleNode) Discards the draft variant which is currently being edited.org.hippoecm.repository.api.DocumentdisposeEditableDocument(org.hippoecm.repository.api.Document editableDocument) Discards the draft variant which is currently being edited.booleandocumentExists(String documentLocation) Returns true if a document exists atdocumentLocation.booleanfolderExists(String folderLocation) Returns true if a folder exists atfolderLocation.org.onehippo.forge.content.pojo.binder.ContentNodeBinder<Node,org.onehippo.forge.content.pojo.model.ContentItem, Value> ReturnsContentNodeBinderinstance.org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem>ReturnsContentNodeBindingItemFilterinstance.protected org.hippoecm.repository.standardworkflow.DefaultWorkflowgetDefaultWorkflow(Node documentHandleNode) Returns aDefaultWorkflowinstance ondocumentHandleNode.Returns the default workflow category.Returns the document translation workflow category.protected org.hippoecm.repository.translation.TranslationWorkflowgetDocumentVariantTranslationWorkflow(Node documentVariantNode) Returns a documentTranslationWorkflowinstance ondocumentVariantNode.org.onehippo.repository.documentworkflow.DocumentWorkflowgetDocumentWorkflow(Node documentHandleNode) Returns a document workflow ondocumentHandleNode.Returns the document workflow category.getExistingDocumentHandleNode(String documentLocation) 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.protected org.hippoecm.repository.translation.TranslationWorkflowgetFolderTranslationWorkflow(Node folderNode) Returns a folderTranslationWorkflowinstance onfolderNode.Returns the folder translation workflow category.protected org.hippoecm.repository.standardworkflow.FolderWorkflowgetFolderWorkflow(Node folderNode) Returns a folder workflow instance onfolderNode.Returns the folder workflow category.org.slf4j.LoggerReturns the logger used by DocumentManager.Returns the JCR session.org.hippoecm.repository.api.DocumentobtainEditableDocument(String documentLocation) Obtains an editable draft variantDocumentunder the given document handle path (documentLocation).org.hippoecm.repository.api.DocumentobtainEditableDocument(Node documentHandleNode) Obtains an editable draft variantDocumentof the given document handle node (documentHandleNode).booleanpublishDocument(String documentLocation) Publishes the document at the given document handle path (documentLocation).voidsetContentNodeBinder(org.onehippo.forge.content.pojo.binder.ContentNodeBinder<Node, org.onehippo.forge.content.pojo.model.ContentItem, Value> contentNodeBinder) SetsContentNodeBinderinstance.voidsetContentNodeBindingItemFilter(org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem> contentNodeBindingItemFilter) SetsContentNodeBindingItemFilterinstance.voidsetDefaultWorkflowCategory(String defaultWorkflowCategory) Sets the default workflow category.voidsetDocumentTranslationWorkflowCategory(String documentTranslationWorkflowCategory) Sets the document translation workflow category.voidsetDocumentWorkflowCategory(String documentWorkflowCategory) Sets the document workflow categoryvoidsetFolderTranslationWorkflowCategory(String folderTranslationWorkflowCategory) Sets the folder translation workflow category.voidsetFolderWorkflowCategory(String folderWorkflowCategory) Sets the folder workflow category.voidsetLogger(org.slf4j.Logger logger) Sets a logger to DocumentManager.org.hippoecm.repository.api.DocumenttranslateDocument(String sourceDocumentLocation, String targetLanguage, String targetDocumentNodeName) Translates a document at the document handle path (sourceDocumentLocation) tonameinlanguage.org.hippoecm.repository.api.DocumenttranslateFolder(String sourceFolderLocation, String targetLanguage, String targetFolderNodeName) Translates a folder at the folder path (sourceFolderLocation) tonameinlanguage.voidupdateEditableDocument(org.hippoecm.repository.api.Document editableDocument, org.onehippo.forge.content.pojo.model.ContentNode sourceContentNode) Update editableDocumentinstance (editableDocument) by the content of the givensourceContentNode.
-
Constructor Details
-
WorkflowDocumentManagerImpl
Constructs withsession.- Parameters:
session- JCR session to use
-
-
Method Details
-
getLogger
public org.slf4j.Logger getLogger()Returns the logger used by DocumentManager.- Specified by:
getLoggerin interfaceDocumentManager- Returns:
- the logger used by DocumentManager
-
setLogger
public void setLogger(org.slf4j.Logger logger) Sets a logger to DocumentManager.- Specified by:
setLoggerin interfaceDocumentManager- 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, getContentNodeBinder()Value> ReturnsContentNodeBinderinstance. If not set, returns a default implementation.- Returns:
ContentNodeBinderinstance. 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) SetsContentNodeBinderinstance.- Parameters:
contentNodeBinder-ContentNodeBinderinstance
-
getContentNodeBindingItemFilter
public org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem> getContentNodeBindingItemFilter()ReturnsContentNodeBindingItemFilterinstance. If not set, returns a default implementation.- Returns:
ContentNodeBindingItemFilterinstance. 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) SetsContentNodeBindingItemFilterinstance.- Parameters:
contentNodeBindingItemFilter-ContentNodeBindingItemFilterinstance
-
getDocumentWorkflowCategory
Returns the document workflow category.- Returns:
- the document workflow category
-
setDocumentWorkflowCategory
Sets the document workflow category- Parameters:
documentWorkflowCategory- the document workflow category
-
getDefaultWorkflowCategory
Returns the default workflow category.- Returns:
- the default workflow category
-
setDefaultWorkflowCategory
Sets the default workflow category.- Parameters:
defaultWorkflowCategory- the default workflow category
-
getFolderWorkflowCategory
Returns the folder workflow category.- Returns:
- the folder workflow category
-
setFolderWorkflowCategory
Sets the folder workflow category.- Parameters:
folderWorkflowCategory- the folder workflow category
-
getFolderTranslationWorkflowCategory
Returns the folder translation workflow category.- Returns:
- the folder translation workflow category
-
setFolderTranslationWorkflowCategory
Sets the folder translation workflow category.- Parameters:
folderTranslationWorkflowCategory- the folder translation workflow category
-
getDocumentTranslationWorkflowCategory
Returns the document translation workflow category.- Returns:
- the document translation workflow category
-
setDocumentTranslationWorkflowCategory
Sets the document translation workflow category.- Parameters:
documentTranslationWorkflowCategory- the document translation workflow category
-
getSession
Returns the JCR session.- Specified by:
getSessionin interfaceDocumentManager- Returns:
- the JCR session
-
documentExists
Description copied from interface:DocumentManagerReturns true if a document exists atdocumentLocation.- Specified by:
documentExistsin interfaceDocumentManager- Parameters:
documentLocation- document handle node path- Returns:
- true if a document exists at
documentLocation - Throws:
DocumentManagerException- if fails to process
-
getExistingDocumentPath
Description copied from interface:DocumentManagerReturns the physical document handle node path for the logical document location. Returns null if document doesn't exist at the location, without any exception, unlikeDocumentManager.getExistingDocumentHandleNode(String).- Specified by:
getExistingDocumentPathin interfaceDocumentManager- 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:DocumentManagerReturns the physical document handle node for the logical document location. Throws aDocumentManagerNotFoundExceptionif document doesn't exist at the location, unlikeDocumentManager.getExistingDocumentPath(String).- Specified by:
getExistingDocumentHandleNodein interfaceDocumentManager- Parameters:
documentLocation- logical document location- Returns:
- the physical document handle node for the logical document location
- Throws:
DocumentManagerNotFoundException- if cannot find a documentRepositoryException- if any repository exception occurs
-
folderExists
Description copied from interface:DocumentManagerReturns true if a folder exists atfolderLocation.- Specified by:
folderExistsin interfaceDocumentManager- Parameters:
folderLocation- folder node path- Returns:
- true if a folder exists at
folderLocation - Throws:
DocumentManagerException- if fails to process
-
getExistingFolderPath
Description copied from interface:DocumentManagerReturns the physical folder node path for the logical folder location. Returns null if folder doesn't exist at the location, without any exception, unlikeDocumentManager.getExistingFolderNode(String).- Specified by:
getExistingFolderPathin interfaceDocumentManager- 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:DocumentManagerReturns the physical folder node for the logical folder location. Throws aDocumentManagerNotFoundExceptionif folder doesn't exist at the location, unlikeDocumentManager.getExistingDocumentPath(String).- Specified by:
getExistingFolderNodein interfaceDocumentManager- Parameters:
folderLocation- logical folder location- Returns:
- the physical folder node for the logical folder location
- Throws:
RepositoryException- if any repository exception occursDocumentManagerNotFoundException
-
createDocument
public String createDocument(String folderLocation, String primaryTypeName, String nodeName, String locale, String localizedName) throws DocumentManagerException Creates a document in the specificfolderLocation.- Specified by:
createDocumentin interfaceDocumentManager- Parameters:
folderLocation- destination folder pathprimaryTypeName- primary node type name of document to be creatednodeName- document node namelocale- locale for the document display name. e.g, "en"localizedName- localized document name associated with thelocale- 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 variantDocumentunder the given document handle path (documentLocation).- Specified by:
obtainEditableDocumentin interfaceDocumentManager- Parameters:
documentLocation- document handle path- Returns:
- a
Documentinstance 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 variantDocumentof the given document handle node (documentHandleNode).- Specified by:
obtainEditableDocumentin interfaceDocumentManager- Parameters:
documentHandleNode- document handle node- Returns:
- a
Documentinstance 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 editableDocumentinstance (editableDocument) by the content of the givensourceContentNode.- Specified by:
updateEditableDocumentin interfaceDocumentManager- Parameters:
editableDocument-Documentinstance to editsourceContentNode- 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:
disposeEditableDocumentin interfaceDocumentManager- Parameters:
documentLocation- document handle path- Returns:
Documentinstance 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:
disposeEditableDocumentin interfaceDocumentManager- Parameters:
editableDocument- document object- Returns:
Documentinstance 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:
commitEditableDocumentin interfaceDocumentManager- Parameters:
documentLocation- document handle path- Returns:
Documentinstance 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:
commitEditableDocumentin interfaceDocumentManager- Parameters:
editableDocument- document object- Returns:
Documentinstance 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
Publishes the document at the given document handle path (documentLocation).- Specified by:
publishDocumentin interfaceDocumentManager- Parameters:
documentLocation- document handle path- Returns:
- true if the operation was successful, false otherwise
- Throws:
DocumentManagerException- if fails to process
-
depublishDocument
Takes offline the document at the given document handle path (documentLocation).- Specified by:
depublishDocumentin interfaceDocumentManager- Parameters:
documentLocation- document handle path- Returns:
- true if the operation was successful, false otherwise
- Throws:
DocumentManagerException- if fails to process
-
deleteDocument
Deletes a document at at the given document handle path (documentLocation).- Specified by:
deleteDocumentin interfaceDocumentManager- 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:
copyDocumentin interfaceDocumentManager- Parameters:
sourceDocumentLocation- source document handle pathtargetFolderLocation- target folder pathtargetDocumentNodeName- 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) tonameinlanguage.- Specified by:
translateFolderin interfaceDocumentManager- Parameters:
sourceFolderLocation- source folder pathtargetLanguage- target language to translate totargetFolderNodeName- target folder node name- Returns:
- the translated target folder
Documentinstance - 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) tonameinlanguage.- Specified by:
translateDocumentin interfaceDocumentManager- Parameters:
sourceDocumentLocation- source document handle pathtargetLanguage- target language to translate totargetDocumentNodeName- target document handle node name- Returns:
- the translated target document
Documentinstance - Throws:
DocumentManagerException- if fails to process
-
getDocumentWorkflow
public org.onehippo.repository.documentworkflow.DocumentWorkflow getDocumentWorkflow(Node documentHandleNode) throws RepositoryException Returns a document workflow ondocumentHandleNode.- Specified by:
getDocumentWorkflowin interfaceDocumentManager- 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 onfolderNode.- 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 aDefaultWorkflowinstance ondocumentHandleNode.- Parameters:
documentHandleNode- document handle node- Returns:
DefaultWorkflowinstance ondocumentHandleNode- Throws:
RepositoryException- if unexpected repository exception occurs
-
getFolderTranslationWorkflow
protected org.hippoecm.repository.translation.TranslationWorkflow getFolderTranslationWorkflow(Node folderNode) throws RepositoryException Returns a folderTranslationWorkflowinstance onfolderNode.- Parameters:
folderNode- folder node- Returns:
- a folder
TranslationWorkflowinstance onfolderNode - Throws:
RepositoryException- if unexpected repository exception occurs
-
getDocumentVariantTranslationWorkflow
protected org.hippoecm.repository.translation.TranslationWorkflow getDocumentVariantTranslationWorkflow(Node documentVariantNode) throws RepositoryException Returns a documentTranslationWorkflowinstance ondocumentVariantNode.- Parameters:
documentVariantNode- document variant node- Returns:
- a document
TranslationWorkflowinstance ondocumentVariantNode - Throws:
RepositoryException- if unexpected repository exception occurs
-