Copy to clipboard failed. Open the code and copy it manually.
importPackage(javax.jcr);
var qm = session.getWorkspace().getQueryManager();
var migrated = 0;
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.syndication.service.RSS']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramNode = node.getNode("ametys:service_parameters");
var feedsNode = paramNode.getNode("ametys:feeds");
if (feedsNode.hasNodes())
{
var position = 1;
var feedNodes = feedsNode.getNodes();
while (feedNodes.hasNext())
{
var entryNode = feedNodes.next();
if (!entryNode.hasProperty("ametys:id"))
{
entryNode.setProperty("ametys:id", position.toString());
position++;
needSave = true;
}
}
if (needSave)
{
node.save();
migrated++;
}
}
}
println(migrated + ' service(s) have been migrated.');
var credentials = new SimpleCredentials('ametys', []);
var liveSession = repository.login(credentials, 'live');
qm = liveSession.getWorkspace().getQueryManager();
migrated = 0;
query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.syndication.service.RSS']", javax.jcr.query.Query.XPATH);
nodes = query.execute().getNodes();
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramNode = node.getNode("ametys:service_parameters");
var feedsNode = paramNode.getNode("ametys:feeds");
if (feedsNode.hasNodes())
{
var position = 1;
var feedNodes = feedsNode.getNodes();
while (feedNodes.hasNext())
{
var entryNode = feedNodes.next();
if (!entryNode.hasProperty("ametys:id"))
{
entryNode.setProperty("ametys:id", position.toString());
position++;
needSave = true;
}
}
if (needSave)
{
node.save();
migrated++;
}
}
}
println(migrated + ' service(s) have been migrated in LIVE.');
importPackage(javax.jcr);
var qm = session.getWorkspace().getQueryManager();
var migrated = 0;
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.syndication.service.RSS']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramNode = node.getNode("ametys:service_parameters");
var feedsNode = paramNode.getNode("ametys:feeds");
if (feedsNode.hasNodes())
{
var position = 1;
var feedNodes = feedsNode.getNodes();
while (feedNodes.hasNext())
{
var entryNode = feedNodes.next();
if (!entryNode.hasProperty("ametys:id"))
{
entryNode.setProperty("ametys:id", position.toString());
position++;
needSave = true;
}
}
if (needSave)
{
node.save();
migrated++;
}
}
}
println(migrated + ' service(s) have been migrated.');
var credentials = new SimpleCredentials('ametys', []);
var liveSession = repository.login(credentials, 'live');
qm = liveSession.getWorkspace().getQueryManager();
migrated = 0;
query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.syndication.service.RSS']", javax.jcr.query.Query.XPATH);
nodes = query.execute().getNodes();
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramNode = node.getNode("ametys:service_parameters");
var feedsNode = paramNode.getNode("ametys:feeds");
if (feedsNode.hasNodes())
{
var position = 1;
var feedNodes = feedsNode.getNodes();
while (feedNodes.hasNext())
{
var entryNode = feedNodes.next();
if (!entryNode.hasProperty("ametys:id"))
{
entryNode.setProperty("ametys:id", position.toString());
position++;
needSave = true;
}
}
if (needSave)
{
node.save();
migrated++;
}
}
}
println(migrated + ' service(s) have been migrated in LIVE.');
importPackage(javax.jcr);
var qm = session.getWorkspace().getQueryManager();
var migrated = 0;
var query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.syndication.service.RSS']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramNode = node.getNode("ametys:service_parameters");
var feedsNode = paramNode.getNode("ametys:feeds");
if (feedsNode.hasNodes())
{
var position = 1;
var feedNodes = feedsNode.getNodes();
while (feedNodes.hasNext())
{
var entryNode = feedNodes.next();
if (!entryNode.hasProperty("ametys:id"))
{
entryNode.setProperty("ametys:id", position.toString());
position++;
needSave = true;
}
}
if (needSave)
{
node.save();
migrated++;
}
}
}
println(migrated + ' service(s) have been migrated.');
var credentials = new SimpleCredentials('ametys', []);
var liveSession = repository.login(credentials, 'live');
qm = liveSession.getWorkspace().getQueryManager();
migrated = 0;
query = qm.createQuery("//element(*, ametys:zoneItem)[@ametys-internal:type='SERVICE' and @ametys-internal:service='org.ametys.plugins.syndication.service.RSS']", javax.jcr.query.Query.XPATH);
nodes = query.execute().getNodes();
while (nodes.hasNext())
{
var needSave = false;
var node = nodes.next();
var paramNode = node.getNode("ametys:service_parameters");
var feedsNode = paramNode.getNode("ametys:feeds");
if (feedsNode.hasNodes())
{
var position = 1;
var feedNodes = feedsNode.getNodes();
while (feedNodes.hasNext())
{
var entryNode = feedNodes.next();
if (!entryNode.hasProperty("ametys:id"))
{
entryNode.setProperty("ametys:id", position.toString());
position++;
needSave = true;
}
}
if (needSave)
{
node.save();
migrated++;
}
}
}
println(migrated + ' service(s) have been migrated in LIVE.');