Sergiu Dumitriu wrote:
Tiago Rinck Caveden wrote:
Hello,
I'm using XWiki notification API (
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Notifications) and
now I
need to change a property of the document that is being changed by the
user.
I tried simply changing the value but this does not persist it - after
rebooting the server the value is not there anymore.
Using the context.getWiki.saveDocument method was not a very bright idea
either because it started an infinite recursion - it called my
notification
code back again.
So, does anybody know what could I do?
Yes, use prenotifications. This means that instead of putting the code
in verify(), put it in preverify(), and use the constructor with 3
arguments.
I hit Send to soon, and my notification knowledge is a bit rusty...
I mean, when creating the notification rule (DocChangeRule or whichever you're using),
use the
constructor with 3 arguments, and use true for the second argument, false for the third
one. If the
Rule doesn't have such a constructor, call setPostverify(false) and
setPreverify(true). That's all
you need to do.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/