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@717a928e

Retrieve all objects attached to this page and of class XWikiComments

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

[com.xpn.xwiki.api.Object@60b963, com.xpn.xwiki.api.Object@4e2b12c6, com.xpn.xwiki.api.Object@6dddad41, com.xpn.xwiki.api.Object@7499bec0, com.xpn.xwiki.api.Object@19ba6b0e, com.xpn.xwiki.api.Object@1dca7154, com.xpn.xwiki.api.Object@55d65113, com.xpn.xwiki.api.Object@6964e26b, com.xpn.xwiki.api.Object@5e4d14db, com.xpn.xwiki.api.Object@1694663b]

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