Groovy


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

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

com.xpn.xwiki.api.Object@3ee379ad

Retrieve all objects attached to this page and of a certain class and one of their properties

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

[com.xpn.xwiki.api.Object@652a20a3, com.xpn.xwiki.api.Object@30c4e138, com.xpn.xwiki.api.Object@4d9e3c8b, com.xpn.xwiki.api.Object@4f98f17c, com.xpn.xwiki.api.Object@42162cb7, com.xpn.xwiki.api.Object@3dd1c446, com.xpn.xwiki.api.Object@16acef5f, com.xpn.xwiki.api.Object@3397519a, com.xpn.xwiki.api.Object@136e6fec]

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