Hi,

I moved a page in the website. In some other pages I had dialog selectors had 
created that pointed to it (to later use as links in the ftl).

After I moved it, as expected, these references did not update. Can I update 
that through a groovy script?

I tried this, but I get an "Unable to perform operation. Node is protected." 
error:

{code}
import info.magnolia.jcr.predicate.NodeTypePredicate;
import info.magnolia.importexport.DataTransporter;
import java.io.ByteArrayOutputStream;
import javax.jcr.PropertyType;
import info.magnolia.ui.vaadin.integration.jcr;


    session = ctx.getJCRSession("website")
    def collection = NodeUtil.collectAllChildren(session.getRootNode())

        collection.each { node->
            def properties = node.getProperties()
            
            while (properties.hasNext()) {
                def property = properties.nextProperty()
                if (property.getType() == PropertyType.STRING)
                    try {
                        property.setValue(
                                property.getString().replaceAll( 
/\/OldPagePath/, "/NewPagePath" )
                        )
                    } catch (Exception e) {
                       println e.message
                    }
            }
        
        }


{code}

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=17394ea5-6d47-450d-822e-f6af9631cdc1


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to