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 forDocumentManager
using Hippo Workflow APIs.
-
-
Constructor Summary
Constructors Constructor Description WorkflowDocumentManagerImpl(javax.jcr.Session session)
Constructs withsession
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.hippoecm.repository.api.Document
commitEditableDocument(String documentLocation)
Commits the draft variant which is currently being edited.protected org.hippoecm.repository.api.Document
commitEditableDocument(javax.jcr.Node documentHandleNode)
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.String
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
).String
createDocument(String folderLocation, String primaryTypeName, String nodeName, String locale, String localizedName)
Creates a document in the specificfolderLocation
.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.protected org.hippoecm.repository.api.Document
disposeEditableDocument(javax.jcr.Node documentHandleNode)
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 atdocumentLocation
.boolean
folderExists(String folderLocation)
Returns true if a folder exists atfolderLocation
.org.onehippo.forge.content.pojo.binder.ContentNodeBinder<javax.jcr.Node,org.onehippo.forge.content.pojo.model.ContentItem,javax.jcr.Value>
getContentNodeBinder()
ReturnsContentNodeBinder
instance.org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem>
getContentNodeBindingItemFilter()
ReturnsContentNodeBindingItemFilter
instance.protected org.hippoecm.repository.standardworkflow.DefaultWorkflow
getDefaultWorkflow(javax.jcr.Node documentHandleNode)
Returns aDefaultWorkflow
instance ondocumentHandleNode
.String
getDefaultWorkflowCategory()
Returns the default workflow category.String
getDocumentTranslationWorkflowCategory()
Returns the document translation workflow category.protected org.hippoecm.repository.translation.TranslationWorkflow
getDocumentVariantTranslationWorkflow(javax.jcr.Node documentVariantNode)
Returns a documentTranslationWorkflow
instance ondocumentVariantNode
.org.onehippo.repository.documentworkflow.DocumentWorkflow
getDocumentWorkflow(javax.jcr.Node documentHandleNode)
Returns a document workflow ondocumentHandleNode
.String
getDocumentWorkflowCategory()
Returns the document workflow category.javax.jcr.Node
getExistingDocumentHandleNode(String documentLocation)
Returns the physical document handle node for the logical document location.String
getExistingDocumentPath(String documentLocation)
Returns the physical document handle node path for the logical document location.javax.jcr.Node
getExistingFolderNode(String folderLocation)
Returns the physical folder node for the logical folder location.String
getExistingFolderPath(String folderLocation)
Returns the physical folder node path for the logical folder location.protected org.hippoecm.repository.translation.TranslationWorkflow
getFolderTranslationWorkflow(javax.jcr.Node folderNode)
Returns a folderTranslationWorkflow
instance onfolderNode
.String
getFolderTranslationWorkflowCategory()
Returns the folder translation workflow category.protected org.hippoecm.repository.standardworkflow.FolderWorkflow
getFolderWorkflow(javax.jcr.Node folderNode)
Returns a folder workflow instance onfolderNode
.String
getFolderWorkflowCategory()
Returns the folder workflow category.org.slf4j.Logger
getLogger()
Returns the logger used by DocumentManager.javax.jcr.Session
getSession()
Returns the JCR session.org.hippoecm.repository.api.Document
obtainEditableDocument(String documentLocation)
Obtains an editable draft variantDocument
under the given document handle path (documentLocation
).org.hippoecm.repository.api.Document
obtainEditableDocument(javax.jcr.Node documentHandleNode)
Obtains an editable draft variantDocument
of the given document handle node (documentHandleNode
).boolean
publishDocument(String documentLocation)
Publishes the document at the given document handle path (documentLocation
).void
setContentNodeBinder(org.onehippo.forge.content.pojo.binder.ContentNodeBinder<javax.jcr.Node,org.onehippo.forge.content.pojo.model.ContentItem,javax.jcr.Value> contentNodeBinder)
SetsContentNodeBinder
instance.void
setContentNodeBindingItemFilter(org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem> contentNodeBindingItemFilter)
SetsContentNodeBindingItemFilter
instance.void
setDefaultWorkflowCategory(String defaultWorkflowCategory)
Sets the default workflow category.void
setDocumentTranslationWorkflowCategory(String documentTranslationWorkflowCategory)
Sets the document translation workflow category.void
setDocumentWorkflowCategory(String documentWorkflowCategory)
Sets the document workflow categoryvoid
setFolderTranslationWorkflowCategory(String folderTranslationWorkflowCategory)
Sets the folder translation workflow category.void
setFolderWorkflowCategory(String folderWorkflowCategory)
Sets the folder workflow category.void
setLogger(org.slf4j.Logger logger)
Sets a logger to DocumentManager.org.hippoecm.repository.api.Document
translateDocument(String sourceDocumentLocation, String targetLanguage, String targetDocumentNodeName)
Translates a document at the document handle path (sourceDocumentLocation
) toname
inlanguage
.org.hippoecm.repository.api.Document
translateFolder(String sourceFolderLocation, String targetLanguage, String targetFolderNodeName)
Translates a folder at the folder path (sourceFolderLocation
) toname
inlanguage
.void
updateEditableDocument(org.hippoecm.repository.api.Document editableDocument, org.onehippo.forge.content.pojo.model.ContentNode sourceContentNode)
Update editableDocument
instance (editableDocument
) by the content of the givensourceContentNode
.
-
-
-
Method Detail
-
getLogger
public org.slf4j.Logger getLogger()
Returns the logger used by DocumentManager.- Specified by:
getLogger
in interfaceDocumentManager
- Returns:
- the logger used by DocumentManager
-
setLogger
public void setLogger(org.slf4j.Logger logger)
Sets a logger to DocumentManager.- Specified by:
setLogger
in interfaceDocumentManager
- Parameters:
logger
- the logger to be used by DocumentManager
-
getContentNodeBinder
public org.onehippo.forge.content.pojo.binder.ContentNodeBinder<javax.jcr.Node,org.onehippo.forge.content.pojo.model.ContentItem,javax.jcr.Value> getContentNodeBinder()
ReturnsContentNodeBinder
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<javax.jcr.Node,org.onehippo.forge.content.pojo.model.ContentItem,javax.jcr.Value> contentNodeBinder)
SetsContentNodeBinder
instance.- Parameters:
contentNodeBinder
-ContentNodeBinder
instance
-
getContentNodeBindingItemFilter
public org.onehippo.forge.content.pojo.binder.ContentNodeBindingItemFilter<org.onehippo.forge.content.pojo.model.ContentItem> getContentNodeBindingItemFilter()
ReturnsContentNodeBindingItemFilter
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)
SetsContentNodeBindingItemFilter
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 javax.jcr.Session getSession()
Returns the JCR session.- Specified by:
getSession
in interfaceDocumentManager
- Returns:
- the JCR session
-
documentExists
public boolean documentExists(String documentLocation) throws DocumentManagerException
Description copied from interface:DocumentManager
Returns true if a document exists atdocumentLocation
.- Specified by:
documentExists
in interfaceDocumentManager
- 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, unlikeDocumentManager.getExistingDocumentHandleNode(String)
.- Specified by:
getExistingDocumentPath
in 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 javax.jcr.Node getExistingDocumentHandleNode(String documentLocation) throws DocumentManagerNotFoundException, javax.jcr.RepositoryException
Description copied from interface:DocumentManager
Returns the physical document handle node for the logical document location. Throws aDocumentManagerNotFoundException
if document doesn't exist at the location, unlikeDocumentManager.getExistingDocumentPath(String)
.- Specified by:
getExistingDocumentHandleNode
in interfaceDocumentManager
- Parameters:
documentLocation
- logical document location- Returns:
- the physical document handle node for the logical document location
- Throws:
DocumentManagerNotFoundException
- if cannot find a documentjavax.jcr.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 atfolderLocation
.- Specified by:
folderExists
in interfaceDocumentManager
- 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, unlikeDocumentManager.getExistingFolderNode(String)
.- Specified by:
getExistingFolderPath
in 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 javax.jcr.Node getExistingFolderNode(String folderLocation) throws DocumentManagerNotFoundException, javax.jcr.RepositoryException
Description copied from interface:DocumentManager
Returns the physical folder node for the logical folder location. Throws aDocumentManagerNotFoundException
if folder doesn't exist at the location, unlikeDocumentManager.getExistingDocumentPath(String)
.- Specified by:
getExistingFolderNode
in interfaceDocumentManager
- Parameters:
folderLocation
- logical folder location- Returns:
- the physical folder node for the logical folder location
- Throws:
javax.jcr.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:
createDocument
in 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 variantDocument
under the given document handle path (documentLocation
).- Specified by:
obtainEditableDocument
in interfaceDocumentManager
- 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(javax.jcr.Node documentHandleNode) throws DocumentManagerException
Obtains an editable draft variantDocument
of the given document handle node (documentHandleNode
).- Specified by:
obtainEditableDocument
in interfaceDocumentManager
- 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 editableDocument
instance (editableDocument
) by the content of the givensourceContentNode
.- Specified by:
updateEditableDocument
in interfaceDocumentManager
- Parameters:
editableDocument
-Document
instance 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:
disposeEditableDocument
in interfaceDocumentManager
- 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 interfaceDocumentManager
- 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(javax.jcr.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 interfaceDocumentManager
- 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 interfaceDocumentManager
- 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(javax.jcr.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 interfaceDocumentManager
- 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 interfaceDocumentManager
- 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 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:
copyDocument
in 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
) toname
inlanguage
.- Specified by:
translateFolder
in interfaceDocumentManager
- Parameters:
sourceFolderLocation
- source folder pathtargetLanguage
- target language to translate totargetFolderNodeName
- 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
) toname
inlanguage
.- Specified by:
translateDocument
in interfaceDocumentManager
- Parameters:
sourceDocumentLocation
- source document handle pathtargetLanguage
- target language to translate totargetDocumentNodeName
- 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(javax.jcr.Node documentHandleNode) throws javax.jcr.RepositoryException
Returns a document workflow ondocumentHandleNode
.- Specified by:
getDocumentWorkflow
in interfaceDocumentManager
- Parameters:
documentHandleNode
- document handle node- Returns:
- a document workflow on
documentHandleNode
- Throws:
javax.jcr.RepositoryException
- if unexpected repository exception occurs
-
getFolderWorkflow
protected org.hippoecm.repository.standardworkflow.FolderWorkflow getFolderWorkflow(javax.jcr.Node folderNode) throws javax.jcr.RepositoryException
Returns a folder workflow instance onfolderNode
.- Parameters:
folderNode
- folder node- Returns:
- a folder workflow instance on
folderNode
- Throws:
javax.jcr.RepositoryException
- if unexpected repository exception occurs
-
getDefaultWorkflow
protected org.hippoecm.repository.standardworkflow.DefaultWorkflow getDefaultWorkflow(javax.jcr.Node documentHandleNode) throws javax.jcr.RepositoryException
Returns aDefaultWorkflow
instance ondocumentHandleNode
.- Parameters:
documentHandleNode
- document handle node- Returns:
DefaultWorkflow
instance ondocumentHandleNode
- Throws:
javax.jcr.RepositoryException
- if unexpected repository exception occurs
-
getFolderTranslationWorkflow
protected org.hippoecm.repository.translation.TranslationWorkflow getFolderTranslationWorkflow(javax.jcr.Node folderNode) throws javax.jcr.RepositoryException
Returns a folderTranslationWorkflow
instance onfolderNode
.- Parameters:
folderNode
- folder node- Returns:
- a folder
TranslationWorkflow
instance onfolderNode
- Throws:
javax.jcr.RepositoryException
- if unexpected repository exception occurs
-
getDocumentVariantTranslationWorkflow
protected org.hippoecm.repository.translation.TranslationWorkflow getDocumentVariantTranslationWorkflow(javax.jcr.Node documentVariantNode) throws javax.jcr.RepositoryException
Returns a documentTranslationWorkflow
instance ondocumentVariantNode
.- Parameters:
documentVariantNode
- document variant node- Returns:
- a document
TranslationWorkflow
instance ondocumentVariantNode
- Throws:
javax.jcr.RepositoryException
- if unexpected repository exception occurs
-
-