Hi Sean,

instead of writing a task in a JSP I recommend to use my BeanShell module which is available as a community module

(http://svn.magnolia.info/svn/modules/community/magnolia-module-remote-shell/)

It allows direct scriting in BeanShell. The module installs a page in the Tools section of AdminCentral where you can execute the scripts.

This script will do the job for you:

//===============================
import info.magnolia.cms.core.search.Query;
import info.magnolia.cms.util.QueryUtil;
import info.magnolia.cms.core.Content;

statement = "//element(*,mgnl:contentNode)[jcr:contains(MetaData/@mgnl:template,'link')]";
repository = "website";

nodes = QueryUtil.query(repository, statement, Query.XPATH, "nt:base");
for (it = nodes.iterator(); it.hasNext();) {
 node = it.next();
 print(node.getHandle() + ":" + node.getMetaData().getTemplate());
 node.getMetaData().setTemplate("texasLink");
 node.save();
}
//===============================

Maybe you try this with a copy of your repository first ;-)

If you want to, I can send you an installable module for Magnolia 3.5

Best regards,

Ralf



McMains, Sean A schrieb:
We have a page with several hundred links on it. We need to update these
existing links (which used to rely on the sample module before we stopped
including it in our build) to be a new type of paragraph, simply by changing
the template property for that paragraph from "link" to "texasLink".

We've done this with a script run through a JSP page before without any
trouble, and I can do that again if need be. However, since we've been using
the Delta mechanism when we upgrade our module, it has made our lives much
easier when we go to deploy a new version. I've thus been trying to figure
out how to accomplish the same thing from there.

I could write a new Task from scratch to do this sort of thing, but wanted
to see if it might be accomplished with the existing ones. It looks like
some combination of the AllModulesNodeOperation and
CheckAndModifyPropertyValueTask might do the trick, but I've not been able
to figure out how to wire them together.

Thanks in advance for any help,

Sean


----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to