Link directory services migration


Link directory services migration

Run the following script to migrate your link directory services

Script service migration

var ConsoleHelper = Java.type('org.ametys.workspaces.repository.ConsoleHelper');  
  
var qm = session.getWorkspace().getQueryManager();  
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.linkdirectory.DirectoryService']", javax.jcr.query.Query.XPATH);  
var nodes = query.execute().getNodes();  
  
var count = 0;  
while (nodes.hasNext())  
{  
    var node = nodes.next();  
    var paramsNode = node.getNode('ametys:service_parameters');  
  
    if (ConsoleHelper.convertSingleToMultipleProperty(paramsNode, "ametys:themes"))  
    {  
          paramsNode.save();  
          count++  
    }   
}  
print(count + " link services have been migrated");  
      

 

Back to top