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 Type
    Method
    Description
    beginRecord(String contentId, String contentPath)
    Begins a new unit of content migration work item which can be identified by either contentId or contentPath.
    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)
    Reads sourceFile containing a ContentNode data in JSON format and returns a parsed ContentNode object.
    org.onehippo.forge.content.pojo.model.ContentNode
    readContentNodeFromXmlFile(org.apache.commons.vfs2.FileObject sourceFile)
    Reads sourceFile containing a ContentNode data in XML format and returns a parsed ContentNode object.
    void
    setLogger(org.slf4j.Logger logger)
    Sets a logger to be used by this task.
    void
    Starts this task.
    void
    Stops this task.
    void
    writeContentNodeToJsonFile(org.onehippo.forge.content.pojo.model.ContentNode contentNode, org.apache.commons.vfs2.FileObject targetFile)
    Writes contentNode object into targetFile in JSON format.
    void
    writeContentNodeToXmlFile(org.onehippo.forge.content.pojo.model.ContentNode contentNode, org.apache.commons.vfs2.FileObject targetFile)
    Writes contentNode object into targetFile 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

      ContentMigrationRecord beginRecord(String contentId, String contentPath)
      Begins a new unit of content migration work item which can be identified by either contentId or contentPath.
      Parameters:
      contentId - content identifier for this unit of content migration work
      contentPath - content path for this unit of content migration work
      Returns:
      a new ContentMigrationRecord instance
    • 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
      Reads sourceFile containing a ContentNode data in JSON format and returns a parsed ContentNode object.
      Parameters:
      sourceFile - source file containing a ContentNode 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
      Writes contentNode object into targetFile in JSON format.
      Parameters:
      contentNode - a ContentNode object
      targetFile - target file to write the contentNode
      Throws:
      ContentMigrationException - if writing fails.
    • readContentNodeFromXmlFile

      org.onehippo.forge.content.pojo.model.ContentNode readContentNodeFromXmlFile(org.apache.commons.vfs2.FileObject sourceFile) throws ContentMigrationException
      Reads sourceFile containing a ContentNode data in XML format and returns a parsed ContentNode object.
      Parameters:
      sourceFile - source file containing a ContentNode 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
      Writes contentNode object into targetFile in XML format.
      Parameters:
      contentNode - a ContentNode object
      targetFile - target file to write the contentNode
      Throws:
      ContentMigrationException - if writing fails.