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@7fbb54ab

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@58b3dea0, com.xpn.xwiki.api.Object@8dd07df, com.xpn.xwiki.api.Object@672fc604, com.xpn.xwiki.api.Object@71716588, com.xpn.xwiki.api.Object@4bc0fde7, com.xpn.xwiki.api.Object@6b5d6f8b, com.xpn.xwiki.api.Object@434645be, com.xpn.xwiki.api.Object@3a8cdf73, com.xpn.xwiki.api.Object@76a2150c]

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