Fork me on GitHub

Tutorial - Cleaning Hippo Mirror Docbase Values

The code snippets are excerpts (or slightly simplififed ones) from Example_Clean_Hippo_Mirror_Docbase_Values_Having_Paths.


When a document contains mirror link nodes to other documents, the mirror links nodes have hippo:docbase string property containing a UUID of the referenced document handle node.

As explained in Tutorial: Exporting Document Content, the UUIDs might have been replaced by the node paths of the referenced document handle nodes during exporting process.

In this case, you can create a simple Groovy Updater script like explained in this page to update the docbase node paths by docbase UUIDs.

Select Hippo Mirror Nodes Having Paths in Groovy Updater

You can use JCR query like the following example in a Groovy Updater script to select all the mirror nodes having a path (e.g, /content/documents/...) in hippo:docbase property instead of UUID.


Updating Hippo Mirror Docbase Properties

    // 1. Read the current hippo:docbase property value.
    def docbasePath = node.getProperty("hippo:docbase").getString()

    // 2. If the hippo:docbase property value starts with '/' and there exists a node at the path,
    //    then replace the path by UUID.
    if (StringUtils.startsWith(docbasePath, "/") && node.session.nodeExists(docbasePath)) {
      def docbase = node.session.getNode(docbasePath).getIdentifier()
      node.setProperty("hippo:docbase", docbase)