THANKS !!! This is absolutly helpful
2014-06-10 15:46 GMT+01:00 [email protected] <[email protected]>: > Hi, > > On 10 Jun 2014 at 16:40:19, walid yaich ([email protected](mailto: > [email protected])) wrote: > > > Hi community, > > > > I have a listener on DocumentUpdateEvent > > List getEvents() > > { > > return Arrays.asList(new DocumentUpdateEvent()) > > 1) This doesn’t exist… It’s DocumentUpdatedEvent… > > BTW you can write: return [new DocumentUpdatedEvent()] > > 2) This is the wrong event, you should use DocumentUpdatingEvent, i.e. > before the save is done and no need to save the doc it’s going to be done > for you. > > You should check this tutorial I wrote: > > http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial > > Specifically: > http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial#HAddingcontenttopagesonsave > > > } > > > > > > void onEvent(Event event, Object source, Object data) > > { > > println "onEvent start !" > > > > def obj = source.getObject("Revision.RevisionClass") > > source.setComment('this is listener comment') > > println obj.getName() > > obj.set("approvedRev", '1.1', data) > > > > println "onEvent end" > > } > > > > I'm sure onEvent is executed but the document is not saved. > > The same problem with DocumentUpdatedEvent > > > > when i added saveDocument, i got stackoverflow. > > This is normal… you’re saving the doc and thus onEvent gets called again… > forever… > > Thanks > -Vincent > > > > > I tried on XWIKI 4.4 and 5.4.5, with no success > > > > Thanks in advance :) > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

