Hi vidar,

I have not a simpler solution but I would like to have a some "generic"
scripts or servlets for doing something like this.

Christophe

2009/11/12 Vidar Ramdal <[email protected]>

> On Thu, Nov 12, 2009 at 2:49 PM, Christophe Lombart
> <[email protected]> wrote:
> > Hi all,
> >
> > Are there some tools/servlets/scripts or whatever to make massive updates
> on
> > node properties ?
> > I would like to have some tools to make some modifications in the repo if
> > the content model has to be changed for a new release of our Sling based
> > application.
> > In the first time, I'm mainly focusing only on node property massive
> updates
> > (not on update on child nodes).
> >
> > Here some use cases of what I'm thinking about :
> >
> > - Update all contents based on the resource type "MyContentType" where
> > myprop = 123 and createDate < last month - set anotherProp = "new value"
> > - Remove the property myprop for resourceType "MyOtherContentType"
> > - Rename prop 'myprop' into "mynewpropname"  where resource type is
> > "MyContentType"
>
> In our project, we usually do that kind of stuff in a .esp script.
> We get the nodes we need to change with an XPath query, and iterate
> over the result, doing the changes we need to do on each node.
> E.g., your "Remove the property myprop for resourceType
> 'MyOtherContentType'" example:
> <%
> var nodes =  resource.resourceResolver.findResources(str,
> "/jcr:root//*...@sling:resourceType='MyOtherContentType']");
> for each (node in nodes) {
>  node.setProperty("myprop", null);
> }
> %>
>
> That works well for us - but if you have a simpler solution, that
> would certainly be interesting.
>
> --
> Vidar S. Ramdal <[email protected]> - http://www.idium.no
> Sommerrogata 13-15, N-0255 Oslo, Norway
> + 47 22 00 84 00 / +47 21 531941, ext 2070
>

Reply via email to