Groovy

Última modificación por Ricardo Rodríguez Fernández el 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@6d528164

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@47aa7e8c, com.xpn.xwiki.api.Object@a5a3e16, com.xpn.xwiki.api.Object@78c60a1c, com.xpn.xwiki.api.Object@11c1f236, com.xpn.xwiki.api.Object@5404c055, com.xpn.xwiki.api.Object@3ef378b, com.xpn.xwiki.api.Object@4e2788b1, com.xpn.xwiki.api.Object@57f448d, com.xpn.xwiki.api.Object@666d87cc, com.xpn.xwiki.api.Object@20ee969d]

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 el 2017/02/15 23:05
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 7.3 - Documentation