You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Amir Mistric <am...@nemours.org> on 2007/05/17 03:17:25 UTC
Renaming node property
Hi
Here is a newbie question...
I have a node 'A' which has property 'title'...
How do I rename that property to let say 'mytitle'?
Looking through the API I couldn't find anything relevant...
Only other thing I can think of would be
1. save the value of title
2. remove title
3. add mytitle
4. set the value of mytitle using previously saved value
Any ideas?
Thanks
Amir
Re: Renaming node property
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 5/17/07, Shaun Barriball <sb...@yahoo.co.uk> wrote:
> "Actually you can't remove a property from a registered node type."
>
> Interesting. If you remove all usages of that property and then update the
> custom_nodetypes.xml to remove it (bypassing the type registration API) are
> there any side-effects?
Not really, but currently we don't have the code in place that
actually goes in and verifies that the property definition in question
isn't being used somewhere. See JCR-322 for background on this issue.
BR,
Jukka Zitting
RE: Renaming node property
Posted by Paco Avila <pa...@git.es>.
El jue, 17-05-2007 a las 08:54 +0100, Shaun Barriball escribió:
> "Actually you can't remove a property from a registered node type."
>
> Interesting. If you remove all usages of that property and then update the
> custom_nodetypes.xml to remove it (bypassing the type registration API) are
> there any side-effects?
> To be honest, I'm not clear what happens during programmatic type
> registration other than updates to the respective XML files for namepsaces
> and custom types.
This is a good experiment :) I'm not sure if this low-level modification
can corrupt the repository :/
--
Paco Avila <pa...@git.es>
RE: Renaming node property
Posted by Shaun Barriball <sb...@yahoo.co.uk>.
"Actually you can't remove a property from a registered node type."
Interesting. If you remove all usages of that property and then update the
custom_nodetypes.xml to remove it (bypassing the type registration API) are
there any side-effects?
To be honest, I'm not clear what happens during programmatic type
registration other than updates to the respective XML files for namepsaces
and custom types.
S.
-----Original Message-----
From: Paco Avila [mailto:pavila@git.es]
Sent: 17 May 2007 08:36
To: users@jackrabbit.apache.org
Subject: RE: Renaming node property
El jue, 17-05-2007 a las 07:27 +0100, Shaun Barriball escribió:
> We've found Node type modifications a little tricky to resolve.
>
> If you're changing a property name from X to Y then one solution is to:
>
> * export the affected workspace(s) to XML using exportsysview
> * empty the workspace(s)
> * update the types used by your JackRabbit install which can be
> achieved by replacing the custom_nodetypes.xml file
> * do a search and replace in your exported XML replacing X with Y.
> * reimport.
>
> Another alternative could be to update your type so that X & Y
> temporarily co-exist. Create a script to copy X values to Y, and then
remove property X.
> Modify your types to remove X. This would require some simple Java
> code to be written.
Actually you can't remove a property from a registered node type.
--
Paco Avila <pa...@git.es>
RE: Renaming node property
Posted by Paco Avila <pa...@git.es>.
El jue, 17-05-2007 a las 07:27 +0100, Shaun Barriball escribió:
> We've found Node type modifications a little tricky to resolve.
>
> If you're changing a property name from X to Y then one solution is to:
>
> * export the affected workspace(s) to XML using exportsysview
> * empty the workspace(s)
> * update the types used by your JackRabbit install which can be achieved by
> replacing the custom_nodetypes.xml file
> * do a search and replace in your exported XML replacing X with Y.
> * reimport.
>
> Another alternative could be to update your type so that X & Y temporarily
> co-exist. Create a script to copy X values to Y, and then remove property X.
> Modify your types to remove X. This would require some simple Java code to
> be written.
Actually you can't remove a property from a registered node type.
--
Paco Avila <pa...@git.es>
RE: Renaming node property
Posted by Shaun Barriball <sb...@yahoo.co.uk>.
We've found Node type modifications a little tricky to resolve.
If you're changing a property name from X to Y then one solution is to:
* export the affected workspace(s) to XML using exportsysview
* empty the workspace(s)
* update the types used by your JackRabbit install which can be achieved by
replacing the custom_nodetypes.xml file
* do a search and replace in your exported XML replacing X with Y.
* reimport.
Another alternative could be to update your type so that X & Y temporarily
co-exist. Create a script to copy X values to Y, and then remove property X.
Modify your types to remove X. This would require some simple Java code to
be written.
Hope this helps,
Shaun.
-----Original Message-----
From: Tako Schotanus [mailto:quintesse@gmail.com]
Sent: 17 May 2007 07:19
To: users@jackrabbit.apache.org
Subject: Re: Renaming node property
It depends, if the node definition allows free choice of property names you
could follow the steps that you described by deleting and re-adding it with
a new name.
But if the property name is defined by the node definition I think you're
out of luck. At least I don't think there is a simple solution.
You might be able to change the node type by removing all nodes of that type
and have some script re-add the data using the new node structure but I'm
not sure this is implemented yet in JackRabbit. So surely one of the gurus
here will correct me :-)
Cheers,
-Tako
On 5/17/07, Amir Mistric <am...@nemours.org> wrote:
> Hi
>
> Here is a newbie question...
>
> I have a node 'A' which has property 'title'...
> How do I rename that property to let say 'mytitle'?
>
> Looking through the API I couldn't find anything relevant...
> Only other thing I can think of would be 1. save the value of title 2.
> remove title 3. add mytitle 4. set the value of mytitle using
> previously saved value
>
>
> Any ideas?
>
> Thanks
> Amir
>
Re: Renaming node property
Posted by Tako Schotanus <qu...@gmail.com>.
It depends, if the node definition allows free choice of property
names you could follow the steps that you described by deleting and
re-adding it with a new name.
But if the property name is defined by the node definition I think
you're out of luck. At least I don't think there is a simple solution.
You might be able to change the node type by removing all nodes of
that type and have some script re-add the data using the new node
structure but I'm not sure this is implemented yet in JackRabbit. So
surely one of the gurus here will correct me :-)
Cheers,
-Tako
On 5/17/07, Amir Mistric <am...@nemours.org> wrote:
> Hi
>
> Here is a newbie question...
>
> I have a node 'A' which has property 'title'...
> How do I rename that property to let say 'mytitle'?
>
> Looking through the API I couldn't find anything relevant...
> Only other thing I can think of would be
> 1. save the value of title
> 2. remove title
> 3. add mytitle
> 4. set the value of mytitle using previously saved value
>
>
> Any ideas?
>
> Thanks
> Amir
>