On Feb 7, 2010, at 9:05 PM, Vincent Massol wrote:
On Feb 7, 2010, at 8:55 PM, Vincent Massol wrote:
Hi,
Just to let you know I've found an important problem in XEM, caused by the changes
brought by the entity references.
The pb is in XWikiDocument's code for object manipulation. I've replaced the Map
of String that was used to store objects with a Map of DocumentReference.
So when you have code like:
XWikiDocument doc = context.getWiki().getDocument("wiki:space.page",
context);
BaseObject obj = doc.getObject("XWiki.SomeClass);
And if context.getDatabse() = "currentWiki" (with "currentWiki" !=
"wiki")
Then doc.getObject will check if there's an object of ref
"currentWiki:XWiki.SomeClass" in doc, which won't be found since there might
indeed be an object but of ref "wiki:XWiki.SomeClass"...
Basically we now allow objects and classes in a document to reference classes located in
another wiki.
To fix this all calling code should be modified to use full references. However since
this isn't going to happen fast enough for 2.2 final and since in any case it could
break user's code I think we need to modify XWikiDocument so that all class/object
methods ignore the wiki part of the references, thus assuming all classes/objects refer to
classes/objects in the current wiki, as it was assumed before...
Let me know if you agree. I'll start looking at the code to see how much there is to
do that in the meantime.
hmm actually it might be even a bit more complex since I think were actually supporting
using an object from a class defined in another wiki. In other words we had the notion of
relative and absolute references before (using strings).
This is going to be hard to solve... still thinking....
ok there's a simple solution I think:
* If the new APIs are called (for ex: doc.getObject()) then if there's no wiki part
specified in the string, use the document's wiki reference
* If the new APIs are called (for ex: doc.getXObject()) then use the passed reference as
is. If you're using the new APIs then you're constructing a real Doc reference and
you'll have to pay attention to the wiki part anywya.
Thanks
-Vincent