Basically the code for this is written and I am waiting some more vote to commit it , I would like to have this in M2, since it will show where we use the API badly.
On Tue, Mar 27, 2012 at 09:32, Marius Dumitru Florea < [email protected]> wrote: > +0 > > Thanks, > Marius > > On Mon, Mar 26, 2012 at 4:43 PM, Thomas Mortagne > <[email protected]> wrote: > > Hi devs, > > > > we have an important inconsistency that we ignored since a long time > > and that is producing http://jira.xwiki.org/browse/XWIKI-7628. > > > > The main issue is that the storage save document containing object > > linked explicitly to another wiki without complaining which mean that > > user continue using API wrongly without really knowing it's wrong. And > > now we have lots of code badly using object class related API and > > contently creating object with absolute class references. > > > > Until now it was OK even if a mess and it's still not visible. But > > that's mostly luck... until we start copying documents from one wiki > > to another starting with 4.0 branch. What changed is that the unique > > identifier of the object in the database is "properly" generated by > > using it's reference and since a class reference in a BaseObject > > contain a wiki it's now taken into account. The old id generator used > > to use the deprecated BaseCollection#getClassName which is forced > > absolute for retro-compatibility reason even if it was actually > > possible before to put absolutely anything as class reference. > > > > So right now we have two issues: > > * store save invalid document without complaining > > * many code is wrongly using BaseObject and XWikiDocument API > > regarding class references mostly because you don't really see it > > right away when you don't use it properly. Even ObjectAddAction is > > wrong, a lot of code that was using setClassName has been badly > > converted to fix deprecated method code by resolving what was passed > > to setClassName into an absolute reference which is very wrong and not > > the behavior of setClassName. > > > > Here is what we propose with Denis: > > * 4.x (or until class coming from another wiki is supported but I > > doubt this is going to happen anytime soon with this storage): > > ** throw an exception in the storage when saving a document containing > > objects coming from another wiki > > ** to temporary limit breakage while we fix wrong code and help us > > find this wrong code, modify BaseCollection#setXClassReference to > > force it to remove the wiki from the passed reference and log a > > warning about a bad usage > > * 5.0: remove the bandage from BaseCollection#setXClassReference > > > > WDYT ? > > > > Here is my +1 > > > > -- > > Thomas Mortagne > > _______________________________________________ > > devs mailing list > > [email protected] > > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Denis Gervalle SOFTEC sa - CEO eGuilde sarl - CTO _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

