Interface ContentMigrationTask
- All Known Subinterfaces:
BinaryExportTask
,BinaryImportTask
,DocumentVariantExportTask
,DocumentVariantImportTask
- All Known Implementing Classes:
AbstractContentExportTask
,AbstractContentImportTask
,AbstractContentMigrationTask
,DefaultBinaryExportTask
,DefaultBinaryImportTask
,WorkflowDocumentVariantExportTask
,WorkflowDocumentVariantImportTask
public interface ContentMigrationTask
Content Migration (Export or Import) Task interface.
-
Method Summary
Modifier and TypeMethodDescriptionbeginRecord
(String contentId, String contentPath) Begins a new unit of content migration work item which can be identified by eithercontentId
orcontentPath
.Ends the current unit of content migration work item.Returns the collection containing all the content migration work item records.org.slf4j.Logger
Returns logger used by this task.long
Returns the started time milliseconds.long
Returns the stopped time milliseconds.Return the execution summary.void
Logs the execution summary by using the logger.org.onehippo.forge.content.pojo.model.ContentNode
readContentNodeFromJsonFile
(org.apache.commons.vfs2.FileObject sourceFile) ReadssourceFile
containing aContentNode
data in JSON format and returns a parsedContentNode
object.org.onehippo.forge.content.pojo.model.ContentNode
readContentNodeFromXmlFile
(org.apache.commons.vfs2.FileObject sourceFile) ReadssourceFile
containing aContentNode
data in XML format and returns a parsedContentNode
object.void
setLogger
(org.slf4j.Logger logger) Sets a logger to be used by this task.void
start()
Starts this task.void
stop()
Stops this task.void
writeContentNodeToJsonFile
(org.onehippo.forge.content.pojo.model.ContentNode contentNode, org.apache.commons.vfs2.FileObject targetFile) WritescontentNode
object intotargetFile
in JSON format.void
writeContentNodeToXmlFile
(org.onehippo.forge.content.pojo.model.ContentNode contentNode, org.apache.commons.vfs2.FileObject targetFile) WritescontentNode
object intotargetFile
in XML format.
-
Method Details
-
getLogger
org.slf4j.Logger getLogger()Returns logger used by this task.- Returns:
- logger used by this task
-
setLogger
void setLogger(org.slf4j.Logger logger) Sets a logger to be used by this task.- Parameters:
logger
- logger to be used by this task
-
start
void start()Starts this task. By 'starting', this task is supposed to reset its content migration records and initialize the internal data. e.g, started time milliseconds. -
stop
void stop()Stops this task. By 'stopping', this task is supposed to update the internal data. e.g, stopped time milliseconds. But this task is supposed to keep the content migration records even after stopping for reporting purpose. -
getStartedTimeMillis
long getStartedTimeMillis()Returns the started time milliseconds.- Returns:
- the started time milliseconds
-
getStoppedTimeMillis
long getStoppedTimeMillis()Returns the stopped time milliseconds.- Returns:
- the stopped time milliseconds
-
beginRecord
Begins a new unit of content migration work item which can be identified by eithercontentId
orcontentPath
.- Parameters:
contentId
- content identifier for this unit of content migration workcontentPath
- content path for this unit of content migration work- Returns:
- a new
ContentMigrationRecord
instance
-
endRecord
ContentMigrationRecord endRecord()Ends the current unit of content migration work item.- Returns:
- the current
ContentMigrationRecord
instance
-
getContentMigrationRecords
Collection<ContentMigrationRecord> getContentMigrationRecords()Returns the collection containing all the content migration work item records.- Returns:
- the collection containing all the content migration work item records
-
getSummary
String getSummary()Return the execution summary.- Returns:
- the execution summary
-
logSummary
void logSummary()Logs the execution summary by using the logger. -
readContentNodeFromJsonFile
org.onehippo.forge.content.pojo.model.ContentNode readContentNodeFromJsonFile(org.apache.commons.vfs2.FileObject sourceFile) throws ContentMigrationException ReadssourceFile
containing aContentNode
data in JSON format and returns a parsedContentNode
object.- Parameters:
sourceFile
- source file containing aContentNode
data in JSON format- Returns:
- a parsed
ContentNode
object - Throws:
ContentMigrationException
- if reading fails.
-
writeContentNodeToJsonFile
void writeContentNodeToJsonFile(org.onehippo.forge.content.pojo.model.ContentNode contentNode, org.apache.commons.vfs2.FileObject targetFile) throws ContentMigrationException WritescontentNode
object intotargetFile
in JSON format.- Parameters:
contentNode
- aContentNode
objecttargetFile
- target file to write thecontentNode
- Throws:
ContentMigrationException
- if writing fails.
-
readContentNodeFromXmlFile
org.onehippo.forge.content.pojo.model.ContentNode readContentNodeFromXmlFile(org.apache.commons.vfs2.FileObject sourceFile) throws ContentMigrationException ReadssourceFile
containing aContentNode
data in XML format and returns a parsedContentNode
object.- Parameters:
sourceFile
- source file containing aContentNode
data in XML format- Returns:
- a parsed
ContentNode
object - Throws:
ContentMigrationException
- if reading fails.
-
writeContentNodeToXmlFile
void writeContentNodeToXmlFile(org.onehippo.forge.content.pojo.model.ContentNode contentNode, org.apache.commons.vfs2.FileObject targetFile) throws ContentMigrationException WritescontentNode
object intotargetFile
in XML format.- Parameters:
contentNode
- aContentNode
objecttargetFile
- target file to write thecontentNode
- Throws:
ContentMigrationException
- if writing fails.
-