Groovy

Última modificación realizada por por Ricardo Rodríguez Fernández o día 2017/02/27 11:03

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@18d0caa8

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@e9b9867, com.xpn.xwiki.api.Object@93299af, com.xpn.xwiki.api.Object@5907b4e0, com.xpn.xwiki.api.Object@8f40bca, com.xpn.xwiki.api.Object@4e31ff5d, com.xpn.xwiki.api.Object@34745ac6, com.xpn.xwiki.api.Object@42f39811, com.xpn.xwiki.api.Object@684a66e, com.xpn.xwiki.api.Object@6eca8319, com.xpn.xwiki.api.Object@31651722]

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, 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

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

Etiquetas
Creado por Ricardo Rodríguez Fernández o día 2017/02/15 23:05
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 7.3 - Documentation