Wiki source code of Reference builder

Last modified by Vincent Massol on 2024/11/19 16:12

Show last authors
1 {{include document="XWiki.DesignClassSheet"/}}
2
3 = Goal =
4
5 Make easier to deal with reference in script languages like Velocity
6
7 = Proposal =
8
9 See http://xwiki.markmail.org/message/n2fwmlmiugqxb3aq for the original mail.
10
11 Pretty much all that takes one class with few methods and covers a lots of use cases.
12
13 == Service name ==
14
15 * ##$services.ref##: short but a bit cryptic
16
17 * ##$services.model.builder##: a bit too long
18
19 == Examples ==
20
21 ==== references ====
22
23 ##$services.ref.wikiname.spacename.pagename.reference##: gets reference of document "wikiname:spacename.pagename"
24
25 ##$services.ref.wikiname.spacename.space("subspacename").pagename.reference##: gets reference of document "wikiname:spacename.subspacename.pagename"
26
27 ##$services.ref.get("wik:iname").spacename.pagename.reference##: gets reference of document "wik\:iname:spacename.pagename"
28
29 ##$services.ref.page("pagename").reference##: gets "pagename" document in current spaces and current wiki
30
31 ##$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
32
33 ##$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"
34
35 ##$services.ref.wikiname.getReference("default")##: gets home page reference (i.e. the wiki "wikiname" with the default space and default page)
36
37 === also documents ===
38
39 Problem is not technical but more that exposing an API which return "old" Document object will be hard to get rid of
40
41 ##$services.ref.wikiname.spacename.pagename.document##: gets document "wikiname:spacename.pagename"
42
43 ##$services.ref.document##: gets current document

Get Connected