BASH-Skript um UUID's (in OpenCms or Magnolia) zu ersetzen

In Content Management Systemen wie OpenCms oder Magnolia gibt es häufig ein Problem mit mehrfach vorkommenden UUID's. Ich habe ein kleines BASH-Skript geschrieben um diese zu ersetzen.


import info.magnolia.importexport.DataTransporter
import javax.jcr.ImportUUIDBehavior
import groovy.io.FileType

def list = []
def dir = new File('/home/marc/c3/eos/EOS_01112018/')
dir.eachFileRecurse (FileType.FILES) { file ->
  list << file
}

list.each {
  path = it.path
  fileName = it.name
  print 'fileName = ' + fileName
  // currently path may not contain "(" and "."
  int indexOf = fileName.lastIndexOf(" (")
  if (indexOf < 0) indexOf = fileName.indexOf(".")
  workspace = fileName.substring(0, indexOf)
  println ' workspace = ' + workspace

hm = ctx.getJCRSession(workspace)
workspaceRoot = hm.getRootNode()
    
xmlFile = new File(path)
DataTransporter.importFile(xmlFile, workspace, '/', false,
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true, true) 
}

I'd be happy to hear from you to support you in any Magnolia (CMS) or OpenCms project as a freelancer (Freiberufler).