On Tue, Jun 2, 2009 at 22:11, Thomas Mortagne
<thomas.mortagne(a)xwiki.com> wrote:
On Tue, Jun 2, 2009 at 16:25, Asiri Rathnayake
<asiri.rathnayake(a)gmail.com> wrote:
Hi Devs,
Currently DocumentNames generated by DocumentNameFactory contains the fully
qualified document name at all times. And when they are serialized using
DocumentNameSerializer, they result in the fully qualified document name
string like "wiki:space.name".
The problem with this is that new xwiki components using
DocumentAccessBridge cannot use relative document names. For an example,
"parent" field of a document cannot be set w.r.t the current wiki because
the "wiki:" part is always appended by default (by the serializer). So we
need a mechanism to specify "what kind of document name" we mean (relative
or absolute).
We can achive this in many ways:
1. Allow pasing a Serializer into methods which takes in a DocumentName.
2. Allow associating a Serilizer with a DocumentName.
3. Use Execution as a means of passing the preferred Serializer
4. Use a flag inside DocumentName (ABSOLUTE, WIKI_RELATIVE, SPACE_RELATIVE)
which will be intepretted by the Serializer appropriately whenever a
DocumentName is serialized.
None of the above approaches are perfectly clean. But the fourth approach
seems to make more sense.
I'm +1 for 4.
Not that there is a CompactDocumentNameSerializer
(DocumentNameSerializer componenet with hint "compact"). It serialize
the given DocumentName depending of the context: if the DocumentName
wiki is the name that the current wiki, it's not serialized, same for
space.
Actually it does not handle space yet as far as i can see in the code
but it should.