Groovy


Retrieve the first object (index [0]) among all objects attached to this page and class XWikiComments

obj = doc.getObject('XWiki.XWikiComments')

com.xpn.xwiki.api.Object@13a4c054

Retrieve all objects attached to this page and of class XWikiComments

objs = doc.getObjects('XWiki.XWikiComments')

[com.xpn.xwiki.api.Object@7ccc4cab, com.xpn.xwiki.api.Object@48bdae8f, com.xpn.xwiki.api.Object@1d0f5398, com.xpn.xwiki.api.Object@59392f0f, com.xpn.xwiki.api.Object@3940af8c, com.xpn.xwiki.api.Object@45c52db1, com.xpn.xwiki.api.Object@143ae340, com.xpn.xwiki.api.Object@261d8920, com.xpn.xwiki.api.Object@5d15a76c]

Retrieve all objects attached to this page and of class XWikiComments and one of their properties
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor

Tags:
Created by Ricardo Rodríguez Fernández on 2017/02/15 23:05
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 7.3 - Documentation