Reference builder
Description
Goal
Make easier to deal with reference in script languages like Velocity
Proposal
See http://xwiki.markmail.org/message/n2fwmlmiugqxb3aq for the original mail.
Pretty much all that takes one class with few methods and covers a lots of use cases.
Service name
- $services.ref: short but a bit cryptic
- $services.model.builder: a bit too long
Examples
references
$services.ref.wikiname.spacename.pagename.reference: gets reference of document "wikiname:spacename.pagename"
$services.ref.wikiname.spacename.space("subspacename").pagename.reference: gets reference of document "wikiname:spacename.subspacename.pagename"
$services.ref.get("wik:iname").spacename.pagename.reference: gets reference of document "wik\:iname:spacename.pagename"
$services.ref.page("pagename").reference: gets "pagename" document in current spaces and current wiki
$services.ref.space("spacename").pagename.relativeReference: gets "spacename.pagename" relative entity reference, could be $services.model.page("pagename").getReference(false) also but parameters are a bit less script oriented I find
$services.ref.page("pagename").getReference("default"): gets "pagename" document in default space and default wiki, "default" is the identifier of the resolver to use, the default being "current"
$services.ref.wikiname.getReference("default"): gets home page reference (i.e. the wiki "wikiname" with the default space and default page)
also documents
Problem is not technical but more that exposing an API which return "old" Document object will be hard to get rid of
$services.ref.wikiname.spacename.pagename.document: gets document "wikiname:spacename.pagename"
$services.ref.document: gets current document
Thomas Mortagne