On Tue, Dec 1, 2015 at 2:51 PM, gervwyk <gervwyk(a)gmail.com> wrote:
Hello
I'm trying to get all the documents that list the current document as the
perant using:
List<DocumentReference> childDocs = doc.getChildrenReferences(xcontext);
where doc is the parent XWikiDocument.
However the function only return an empty list, althoug there is documents
in the space.
XWikiDocument#getChildrenReferences() takes into account only the parent
field, which was used in the past (<7.2) to organize the wiki pages in a
tree hierarchy. Starting with 7.2 the wiki pages are organized as nested
pages, see
http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki72M2#HHid…
, and the parent-child relationship has been hidden from the UI. if you wan
to get the list of child pages based on the new 'reference' hierarchy mode
(i.e. nested pages) then you need to use the QueryManager with the proper
HQL/XWQL statement.
For all descendants, see
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
For only direct children, see
https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwi…
For the future, we'll have to implement a component to provide
tree-oriented APIs regarding wiki pages.
Hope this helps,
Marius
If I print doc.getFullName() its AAA.WebHome.. And all the chldren spaces
is
listed under AAA.. how should I reference doc to get say AAA.BBB.WebHome in
the list? or where am I going wrong?
--
View this message in context:
http://xwiki.475771.n2.nabble.com/Get-all-children-from-current-document-in…
Sent from the XWiki- Users mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users