Hi Pascal,
thanks for your work :-) It's great to have people working on improving this
since it's at the heart of what makes XWiki powerful.
do you remember my work on classes and objects?
I fear the answer is "no" :)
We certainly do :-)
Anyway, I have been working on some other critical
projects so I haven't
been able to work on that for some time.
But, now I have restarted my study for my current needs.
The idea was to provide a simple way to manage classes, to delete/restore
class properties and to synchronize objects with these classes.
As I was not really happy about the result of my previous work based on
class versioning (I found it too much intrusive in XWiki code and
complicated), I totally changed my approach into something much lighter.
The idea is really simple:
I propose to add the feature of enabling/disabling class properties.
* If you disable a property, it is only "hidden" without being deleted so
you can modify the structure of the class without losing anything.
* Then the disabled properties are also "hidden" for the objects
instantiating this class and the valued fields are also not lost.
* If you add a new property to the class, all objects will inherit a new
field with the default value.
* If you enable a disabled property, all the objects owning the field
re-find it and the objects not having the field now have it with the
default
value.
* you could also delete a disabled field from an object for some
optimization issues.
That sounds god as it solves the issue without deleting the data. The
developer shouldn't forget to update his / her ClassSheet pages in order to
remove the $doc.display('NowHiddenProperty') afterwards I guess...
I also propose to add the "remove property"
feature which would be quite
protected but which is useful: you simply delete the property from the
class.
* All objects having the "removed" field are no more synchronized with the
class.
* the removed field still exist in the object but is no more available to
classical display functions which use "class properties" to find object
fields.
* the removed field can be deleted from the object to resynchronize the
object to the class
* if a new property with the same type and name is re-added to the class,
the object re-finds its existing field.
What about adding the ability to automatically synchronize all objects at
once (that is, deleting the property from all objects) ? This feature would
be even more protected, but I can see its usefulness (for instance, when
I've just started writing a class, added a couple objects then thought about
a better way to do what I wanted -> little data to lose, would help me gain
some time & avoid having me go to 10 objects to delete the property from
each of them).
The way to do it is quite simple: just add a
"enabled" field to the
PropertyClass and manage it in the code.
I have modified a bit XWiki-Core and some velocity scripts but it seems
really light without any really new logic
Are you interested in this?
I think so, though I'll let Vincent / Sergiu provide a Developer / Committer
answer.
By the way, you might also be interested in
http://dev.xwiki.org/xwiki/bin/view/Design/OverhaulOfXWikiClassesAndObjects…...
Guillaume