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@3ebe60ca

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@7ee9e261, com.xpn.xwiki.api.Object@2d0d8f5f, com.xpn.xwiki.api.Object@553fbd14, com.xpn.xwiki.api.Object@4b9697c5, com.xpn.xwiki.api.Object@bc62d48, com.xpn.xwiki.api.Object@7fc6d801, com.xpn.xwiki.api.Object@578f6b30, com.xpn.xwiki.api.Object@8c64939, com.xpn.xwiki.api.Object@11f141af, com.xpn.xwiki.api.Object@760f515c]

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