Hi Vincent, On 12/31/2009 01:39 PM, Vincent Massol wrote: > Hi devs, > > I'm almost done with my entity reference refactoring and I've just > realized I have missed something I think. So far the implementation > only supports Absolute references (i.e the entity reference factory > always return a reference with all parts filled - you choose to use a > default factory or a current entity depending on how you wish to > resolve the names when they have not been provided in the passed > reference string). > > I now think we must also support relative references (i.e. when some > parts can be null) and that it's up to the user of the api to decide > if they want to convert a relative reference to an absolute one or not. > > Here's a use case: renaming of documents. For exemple documents have > links specified as a string representing the target doc name. If we > don't have relative references then we need to decide if we want to > use the default serializer (all parts printed including wiki name) or > the compact serializer (only parts different from context reference > printed). This doesn't support printing only what the user had decided > to fill. For ex a user might have specified voluntarily the space and > page name and right now with my implementation he'll get only the page > name specified if the new space is the same as the space for the > current doc. > > So here's my proposal: > > * Entity Reference Factory leaves parts to null when not specified in > the string representation. > * We add a EntityReference.getAbsoluteReference(EntityReference base) > method to return an absolute reference. It's resolved against the > passed base reference (i.e. parts not specified are taken from it)
+1 Happy coding (and new year), Anca > > WDYT? > > I'm going to start refactoring my code to do this later today so > please let me know if you see any pb with it. > > Thanks > -Vincent > > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

