info.magnolia.ui.contentapp.setup
Class AbstractDataTypeMigrationTask

java.lang.Object
  extended by info.magnolia.module.delta.AbstractTask
      extended by info.magnolia.ui.contentapp.setup.AbstractDataTypeMigrationTask
All Implemented Interfaces:
info.magnolia.module.delta.Task

public abstract class AbstractDataTypeMigrationTask
extends info.magnolia.module.delta.AbstractTask

Migrate a Data type repository to a new workspace.
This migration task:
- keep the current node identifier
- remove the metaData sub nodes

Steps:
- Copy the Data repository (data/categorization) to the new workspace (categorization)
- For every element of the 'oldToNewNodeTypeMapping'
-- Change the primary NodeType (from 'category' to 'mgnl:category')
- Remove all metaData nodes.


Constructor Summary
AbstractDataTypeMigrationTask(String taskName, String taskDescription, String dataPath, String newPath, String newWorkspaceName)
           
 
Method Summary
 void execute(info.magnolia.module.InstallContext installContext)
           
protected abstract  void initOldToNewNodeTypeMappingElement(HashMap<String,String> oldToNewNodeTypeMapping)
          Set the HashMap of nodeType to change.
key: oldType ('dataFolder')
value: newType ('mgnl:folder')
Order is important
Define first the simple node type and the the types with restriction
For example, if you have a node type for images that have a constraint for a custom data type (for binary).
- First define your custom data type addOldToNewNodeTypeMappingElement("dataFolder", "mgnl:folder"); addOldToNewNodeTypeMappingElement("category", "mgnl:category"); addOldToNewNodeTypeMappingElement("dataItemNode", "mgnl:content");
 
Methods inherited from class info.magnolia.module.delta.AbstractTask
getDescription, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractDataTypeMigrationTask

public AbstractDataTypeMigrationTask(String taskName,
                                     String taskDescription,
                                     String dataPath,
                                     String newPath,
                                     String newWorkspaceName)
Parameters:
dataPath - path from the data to migrate ('/category'). If set to root, the task will not be executed.
newPath - new path where the content of dataPath will be copied.
newWorkspaceName - new workspace name.
Method Detail

execute

public void execute(info.magnolia.module.InstallContext installContext)
             throws info.magnolia.module.delta.TaskExecutionException
Throws:
info.magnolia.module.delta.TaskExecutionException

initOldToNewNodeTypeMappingElement

protected abstract void initOldToNewNodeTypeMappingElement(HashMap<String,String> oldToNewNodeTypeMapping)
Set the HashMap of nodeType to change.
key: oldType ('dataFolder')
value: newType ('mgnl:folder')
Order is important
Define first the simple node type and the the types with restriction
For example, if you have a node type for images that have a constraint for a custom data type (for binary).
- First define your custom data type addOldToNewNodeTypeMappingElement("dataFolder", "mgnl:folder"); addOldToNewNodeTypeMappingElement("category", "mgnl:category"); addOldToNewNodeTypeMappingElement("dataItemNode", "mgnl:content");



Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.