Thomas Mortagne wrote:
> On Tue, Jun 2, 2009 at 22:11, Thomas Mortagne <[email protected]>
> wrote:
>> 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.
>
> Actually it does not handle space yet as far as i can see in the code
> but it should.
So why aren't we using that one for setting the parent?
Actually, why aren't we using _any serializer_ for the parent?
public void setParent(DocumentName parentName)
{
this.parent = parentName.toString();
}
DocumentName
@Override
public String toString()
{
return getWiki() + ":" + getSpace() + "." + getPage();
}
Is there some reason for this or we just forgot about it?
Happy hacking all,
Anca
>
>> 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