public class MoveContentToDamMigrationTask extends AbstractPropertyValueSearchDamMigrationTask
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.
Modifier and Type | Field and Description |
---|---|
protected javax.jcr.Session |
contentSession |
protected javax.jcr.Session |
damSession |
Constructor and Description |
---|
MoveContentToDamMigrationTask(String taskName,
String taskDescription,
String contentRepository,
List<String> contentPathsList,
String targetSubPath,
String searchPropertyValue)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
buildI18nSuffixPropertyName, createQuery, executeQuery, getI18nLocalBasedOnPropertyName, getPropertyNameWithoutLocalSuffix, getPropertyValue, isPropertyNameI18nBased, setPropertyValue
protected javax.jcr.Session damSession
protected javax.jcr.Session contentSession
public MoveContentToDamMigrationTask(String taskName, String taskDescription, String contentRepository, List<String> contentPathsList, String targetSubPath, String searchPropertyValue)
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.public void doExecute(info.magnolia.module.InstallContext ctx) throws info.magnolia.module.delta.TaskExecutionException
doExecute
in class info.magnolia.module.delta.AbstractRepositoryTask
info.magnolia.module.delta.TaskExecutionException
protected void handleUploadReferenceForNode(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected String copyToDam(javax.jcr.Node dataNodeResource) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2015 Magnolia International Ltd.. All rights reserved.