Interface DocumentManager
- All Known Implementing Classes:
WorkflowDocumentManagerImpl
public interface DocumentManager
Hippo CMS Document/Folder Workflow manager.
-
Method Summary
Modifier and TypeMethodDescriptionorg.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 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.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.repository.documentworkflow.DocumentWorkflow
getDocumentWorkflow
(Node documentHandleNode) Returns a document workflow ondocumentHandleNode
.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.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 variantDocument
under the given document handle path (documentLocation
).org.hippoecm.repository.api.Document
obtainEditableDocument
(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
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
) toname
inlanguage
.org.hippoecm.repository.api.Document
translateFolder
(String sourceFolderLocation, String language, String name) 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 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
Returns true if a document exists atdocumentLocation
.- Parameters:
documentLocation
- document handle node path- Returns:
- true if a document exists at
documentLocation
- Throws:
DocumentManagerException
- if fails to process
-
getExistingDocumentPath
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, unlikegetExistingDocumentHandleNode(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 aDocumentManagerNotFoundException
if document doesn't exist at the location, unlikegetExistingDocumentPath(String)
.- 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
Returns true if a folder exists atfolderLocation
.- Parameters:
folderLocation
- folder node path- Returns:
- true if a folder exists at
folderLocation
- Throws:
DocumentManagerException
- if fails to process
-
getExistingFolderPath
Returns the physical folder node path for the logical folder location. Returns null if folder doesn't exist at the location, without any exception, unlikegetExistingFolderNode(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 aDocumentManagerNotFoundException
if folder doesn't exist at the location, unlikegetExistingDocumentPath(String)
.- Parameters:
folderLocation
- logical folder location- Returns:
- the physical folder node for the logical folder location
- Throws:
DocumentManagerException
- if cannot find a folderRepositoryException
- if any repository exception occursDocumentManagerNotFoundException
-
createDocument
String createDocument(String folderLocation, String primaryTypeName, String nodeName, String locale, String localizedName) throws DocumentManagerException Creates a document in the specificfolderLocation
.- 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
org.hippoecm.repository.api.Document obtainEditableDocument(String documentLocation) throws DocumentManagerException Obtains an editable draft variantDocument
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 variantDocument
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 editableDocument
instance (editableDocument
) by the content of the givensourceContentNode
.- Parameters:
editableDocument
-Document
instance to editsourceContentNode
- 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
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
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
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 pathtargetFolderLocation
- target folder pathtargetDocumentName
- 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
) toname
inlanguage
.- Parameters:
sourceFolderLocation
- source folder pathlanguage
- target language to translate toname
- 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
) toname
inlanguage
.- Parameters:
sourceDocumentLocation
- source document handle pathlanguage
- target language to translate toname
- 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 ondocumentHandleNode
.- Parameters:
documentHandleNode
- document handle node- Returns:
- a document workflow on
documentHandleNode
- Throws:
RepositoryException
- if unexpected repository exception occurs
-