Hi,
I can't understand an error when I launch a groovy script from a wiki page but I
haven't error when my groovy script is launched in scheduler...
My nice script delete previous version of MyPage with removeVersions methods:
MyGroupAuto = xwiki.getDocument("Space.MyPage")
// remove last version
gArch = MyGroupAuto.getDocumentArchive()
gArch.removeVersions(gArch.getLatestVersion(),
gArch.getPrevVersion(gArch.getPrevVersion(gArch.getLatestVersion())), context)
MyGroupAuto.save()
***************
public void removeVersions(org.suigeneris.jrcs.rcs.Version newerVersion,
org.suigeneris.jrcs.rcs.Version olderVersion,
XWikiContext context)
throws XWikiException
Remove document versions from vfrom to vto, inclusive.
***************
When I launch same script in a wiki page (betwwen {{groovy}} tags and page recorded by
Admin with PR), I obtain this error and my script stopped but same script working well in
scheduler:
Caused by: javax.script.ScriptException: javax.script.ScriptException:
groovy.lang.MissingMethodException: No signature of method:
com.xpn.xwiki.doc.XWikiDocumentArchive.removeVersions() is applicable for argument types:
(org.suigeneris.jrcs.rcs.Version, org.suigeneris.jrcs.rcs.Version,
com.xpn.xwiki.api.Context) values: [29.1, 27.1, com.xpn.xwiki.api.Context@3f45ea13]
Possible solutions: removeVersions(org.suigeneris.jrcs.rcs.Version,
org.suigeneris.jrcs.rcs.Version, com.xpn.xwiki.XWikiContext)
at
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:151)
All ideas why this behavours is welcome :-)
thxs
Pascal B
Show replies by date