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@297e1456

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@52c61f3a, com.xpn.xwiki.api.Object@4d2c434a, com.xpn.xwiki.api.Object@14f5d6db, com.xpn.xwiki.api.Object@17ecce9d, com.xpn.xwiki.api.Object@3bf0b1b0, com.xpn.xwiki.api.Object@3721b88e, com.xpn.xwiki.api.Object@6db8ee9, com.xpn.xwiki.api.Object@38836683, com.xpn.xwiki.api.Object@3abf3f71]

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

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

[XWiki.RicardoRodriguezFernandez, XWiki.RicardoRodriguezFernandez, XWiki.RicardoRodriguezFernandez, XWiki.RicardoRodriguezFernandez, XWiki.IsabelListaGarcia, Anonymous, XWiki.YolandaMariaListeMartinez, XWiki.RicardoRodriguezFernandez, XWiki.RicardoRodriguezFernandez]

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

println objs[0].author

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