info.magnolia.dam.setup.migration
Class MoveContentToDamMigrationTask
java.lang.Object
info.magnolia.module.delta.AbstractTask
info.magnolia.module.delta.AbstractRepositoryTask
info.magnolia.dam.setup.migration.AbstractPropertyValueSearchDamMigrationTask
info.magnolia.dam.setup.migration.MoveContentToDamMigrationTask
- All Implemented Interfaces:
- info.magnolia.module.delta.Task
- Direct Known Subclasses:
- MoveFCKEditorContentToDamMigrationTask, MoveFileContentToDamMigrationTask, MoveUploadedContentToDamMigrationTask
public class MoveContentToDamMigrationTask
- extends AbstractPropertyValueSearchDamMigrationTask
This task copy uploaded documents stored in the content repository (for
example website) into the DAM repository.
Steps:
Iterate the list of contentPathsList,
Perform a JCR query that search for properties containing 'upload' and return the related node.
Iterate the query result list
For every Node,
Node has a Binary child node
Copy and transform the binary node into an Asset node in the DAM workspace.
Copy the value of the newly created identifier into index (image)
Remove the related binary node from the content workspace.
No Binary child node found
Remove the index property.
Normal handling:
Move from:
property sv:name="teaserImg" sv:type="String"
value = upload
node sv:name="teaserImgBinary"
property sv:name="jcr:primaryType" sv:type="Name"
value = mgnl:resource
To:
property sv:name="teaserImg" sv:type="String"
value = 4c291aa5-9807-4bbe-b372-ce523f82e600
Specific handling:
In case of No Binary child node found, remove properties.
In any case if a property named index+DmsUUID (like imageDmsUUID) found remove it.
Fields inherited from class info.magnolia.module.delta.AbstractTask |
DO_NOTHING |
Method Summary |
protected String |
copyToDam(javax.jcr.Node dataNodeResource)
Duplicate Data to the DAM repository. |
void |
doExecute(info.magnolia.module.InstallContext ctx)
|
protected void |
handleUploadReferenceForNode(javax.jcr.Node node)
Handle each filtered properties related to the found node. |
Methods inherited from class info.magnolia.module.delta.AbstractRepositoryTask |
execute |
Methods inherited from class info.magnolia.module.delta.AbstractTask |
getDescription, getName, toString |
damSession
protected javax.jcr.Session damSession
contentSession
protected javax.jcr.Session contentSession
MoveContentToDamMigrationTask
public MoveContentToDamMigrationTask(String taskName,
String taskDescription,
String contentRepository,
List<String> contentPathsList,
String targetSubPath,
String searchPropertyValue)
- Default constructor.
- Parameters:
contentPathsList
- list on content path to handle like "/demo-project"targetSubPath
- Sub path of the DAM repository used to store the Data. If a uploaded data is found under
(websiterepo)/demo-project/about/subsection-articles/article/content/01 and damUploadSubroot = uploaded
the data will be stored under
(damrepo)/uploaded/demo-project/about/subsection-articles/article/content/01propertyToSearch
- property value used to identify a node having a linked binary.
doExecute
public void doExecute(info.magnolia.module.InstallContext ctx)
throws info.magnolia.module.delta.TaskExecutionException
- Specified by:
doExecute
in class info.magnolia.module.delta.AbstractRepositoryTask
- Throws:
info.magnolia.module.delta.TaskExecutionException
handleUploadReferenceForNode
protected void handleUploadReferenceForNode(javax.jcr.Node node)
throws javax.jcr.RepositoryException
- Handle each filtered properties related to the found node.
- Throws:
javax.jcr.RepositoryException
copyToDam
protected String copyToDam(javax.jcr.Node dataNodeResource)
throws javax.jcr.RepositoryException
- Duplicate Data to the DAM repository.
Steps: Create the new Data folder
Create an asset Node and populate property (name of the asset is the name of the Data file)
Copy the original binary node as child of the asset node
- Throws:
javax.jcr.RepositoryException
Copyright © 2014 Magnolia International Ltd.. All Rights Reserved.