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@80c2ea4

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@71899970, com.xpn.xwiki.api.Object@b8c24c, com.xpn.xwiki.api.Object@61dc0bf2, com.xpn.xwiki.api.Object@35946f0f, com.xpn.xwiki.api.Object@24075d44, com.xpn.xwiki.api.Object@5f7c2dd6, com.xpn.xwiki.api.Object@51a56d93, com.xpn.xwiki.api.Object@43bcf7c5, com.xpn.xwiki.api.Object@2b2ec941]

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