Hi,
You need to be aware that the method you are trying results in specifying
the space name, not the space reference, so instead of creating the space
reference "A.B" (i.e. "B", child of "A"), you are creating a
reference to
"A\.B" (i.e. space called "A.B", at the top level).
You`re probably looking for the Nested Spaces specific signature of the
createDocumentReference method:
public DocumentReference createDocumentReference(String wiki,
List<String> spaces, String page, String hint) [1]
e.g.: $services.model.createDocumentReference('', ['XApp',
'Data'],
'WebHome')
Another option is the more generic approach, using the resolveDocument
method:
public DocumentReference resolveDocument(String stringRepresentation,
Object... parameters) [2]
e.g.: $services.model.resolveDocument('XApp.Data.WebHome')
Hope this helps,
Eduard
----------
[1]
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/or…
[2]
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/or…
On Thu, Sep 15, 2016 at 3:50 PM, D R <rir.ceg(a)gmail.com> wrote:
Hi guys,
I'm having a hard time accessing the fields of an application (prepared via
App Within Minutes) document from another document.
I have those 2 documents:
1. XApp / Data / 123456789
2. Test / Testscript
I try to prepare an event listener to rename new documents according to
some of their fields.
For example I have the field 'ddlCategory' and I want the name of all new
documents of the XApp application to be "XP-<category>-DateTime".
To get the doc before accessing the objects of the class I tested
retrieving XApp.WebHome:
#set($docRef = $services.model.createDocumentReference('', 'XApp',
'WebHome'))
#set($document = $xwiki.getDocument($docRef))
"$document.getContent()" shows me the content.
Now I want to get the nested Data space (where the documents are stored and
which contains the livetable):
#set($docRef = $services.model.createDocumentReference('',
'XApp.Data',
'WebHome'))
#set($document = $xwiki.getDocument($docRef))
"$document.getContent()" is not replaced, the resulting page shows
"$document.getContent()" so it can't find the XApp.Data.WebHome.
In the reference I tried different things (ie "Xapp\.Data") but it also
fails.
So how to retrieve a nested document in velocity?
Thanks in advance,
Dennis
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users