I am using Groovy console and need to update title components on pages by values from page title
getNode('/content/').recurse { resourceNode ->
if (resourceNode.hasProperty('sling:resourceType')) {
final def resourceType = resourceNode.getProperty('sling:resourceType').string
if (resourceType.equals('components/title')) {
resourceNode.setProperty('jcr:title', resourceNode.parent().parent().getProperty('jcr:title')) <-problem with this line
resourceNode.save();
}
}
}
I need value from two nodes up
And i had an exception:
groovy.lang.MissingMethodException: No signature of method: org.apache.jackrabbit.oak.jcr.session.NodeImpl.parent() is applicable for argument types: () values: []
Appreciate for help