On Tue, Jun 2, 2009 at 16:25, Asiri Rathnayake
<[email protected]> 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.

So there is already a way to serialize a relative document name by
making setting the context correctly. This serializer is used in
XWikiDocument#getUniqueLinkedPages for example.

>
> Thanks.
>
> - Asiri
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>



-- 
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to