public class ChangeDataDmsReferenceToDamMigrationTask
extends info.magnolia.module.delta.AbstractRepositoryTask
Iterate the list of contentPathsList, Perform a JCR query that search for properties named 'imgUUID' and return the related node. Iterate the query result list For every Node, If the identifier exist in the dam repository as an Asset. Transform the identifier as an Asset composite id (assetProviderId:AssetIdentifier) Update the 'img' link to the corresponding path. Else Remove the property.
Normal handling: Move from: property sv:name="img" sv:type="String" value = /demo-project/img/bk/Stage/v-light-4 property sv:name="imgUUID" sv:type="String" value = 4c291aa5-9807-4bbe-b372-ce523f82e600 To: property sv:name="imgUUID" sv:type="String" value = jcr:4c291aa5-9807-4bbe-b372-ce523f82e600 OR Move from: property sv:name="img" sv:type="String" value = dms property sv:name="imgUUID" sv:type="String" value = 4c291aa5-9807-4bbe-b372-ce523f82e600 To: property sv:name="img" sv:type="String" value = jcr:4c291aa5-9807-4bbe-b372-ce523f82e600 Specific handling: In case of the UUID does not exist any more, remove properties.
Constructor and Description |
---|
ChangeDataDmsReferenceToDamMigrationTask(String taskName,
String taskDescription,
String contentRepository,
List<String> contentPathsList,
String identifierPropertyName,
String pathPropertyName)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
doExecute(info.magnolia.module.InstallContext ctx) |
protected void |
handleDataReference(javax.jcr.Property identifierProperty,
javax.jcr.Property pathProperty,
javax.jcr.Node assetNode,
String compositeId)
Set the composite id to the identifierProperty (imgUUID) value.
|
protected void |
handleDmsReference(javax.jcr.Property identifierProperty,
javax.jcr.Property pathProperty,
javax.jcr.Node assetNode,
String compositeId)
Set the composite id to the pathProperty (img) value, and remove the identifierProperty (imgUUID).
|
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 handleDataReference(javax.jcr.Property identifierProperty, javax.jcr.Property pathProperty, javax.jcr.Node assetNode, String compositeId) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void handleDmsReference(javax.jcr.Property identifierProperty, javax.jcr.Property pathProperty, javax.jcr.Node assetNode, String compositeId) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2015 Magnolia International Ltd.. All rights reserved.