Created
May 11, 2016 16:53
-
-
Save yesil/d0e939ec34a8b2c867f7f9d63fcf21db to your computer and use it in GitHub Desktop.
groovy script to load in oak-run in order to rename protected node names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.jackrabbit.oak.spi.commit.CommitInfo | |
import org.apache.jackrabbit.oak.spi.commit.EmptyHook | |
def fixNodeType(session, nodeType) { | |
def rootB = session.store.root.builder() | |
def nodeTypeB = rootB.getChildNode("jcr:system").getChildNode("jcr:nodeTypes").getChildNode(nodeType) | |
def propertyDefinitionB = nodeTypeB.getChildNode("jcr:propertyDefinition") | |
def move = propertyDefinitionB.moveTo(nodeTypeB,"jcr:propertyDefinition[1]") | |
session.store.merge(rootB, EmptyHook.INSTANCE, CommitInfo.EMPTY) | |
println move ? "success" : "error" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment