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@1a2ef3a8

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@2ad54f43, com.xpn.xwiki.api.Object@1a46cdad, com.xpn.xwiki.api.Object@1e692655, com.xpn.xwiki.api.Object@953a60c, com.xpn.xwiki.api.Object@52ba629c, com.xpn.xwiki.api.Object@4aa01a32, com.xpn.xwiki.api.Object@5517eee4, com.xpn.xwiki.api.Object@1644e661, com.xpn.xwiki.api.Object@570f5b3, com.xpn.xwiki.api.Object@3b12bd8f]

Retrieve the author property of all objects attached to this page and of class XWikiComments

objsAuthors = doc.getObjects('XWiki.XWikiComments').author
println objsAuthors

[26/02/2017 08:50:18, 26/02/2017 08:50:26, 26/02/2017 08:50:33, 26/02/2017 08:50:43, 27/02/2017 08:19:40, 27/02/2017 08:20:00, 27/02/2017 08:20:54, 27/02/2017 10:22:23, 27/02/2017 10:23:01, 27/02/2017 10:58:47]

Retrieve the author property of the fifth object attached to this page and of class XWikiComments by index

objsAuthor = doc.getObjects('XWiki.XWikiComments')[4].author
println objsAuthor

XWiki.IsabelListaGarcia

Retrieve the author property of the first object attached to this page and of class XWikiComments by index; objs was assigned above!

println objs[0].author

XWiki.RicardoRodriguezFernandez

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