Hi devs.

In XWiki, we have the ability to create wiki components. It means that each
extension can define a custom XClass which is used to create a component
when a corresponding XObject exists.

Sometimes, this XObject contains a textarea where the developer could write
velocity code. The velocity code is rendered, and the result is parsed in
order to complete other actions. For example, velocity can render a
boolean, or a list of documents, etc... The reason why Velocity is used is
because it does not require programming rights. On the other-side, it can
only return a string: the rendered content.

My use-case is to generate a specific list of users when an event is
triggered, to perform some actions with these users.

Currently, we have no recommended practice about this
"velocity-rendered-fields".

That's what I propose to always use JSON when velocity is used to render
data in a wiki component. The reason is that JSON is standard and easy to
parse.

Use case:
In the Event Stream module [1], the XClass
"XWiki.EventStream.Code.EventClass" is used to trigger custom events when
some event occurs.
Example: if a DocumentUpdatedEvent is triggered and that event contains an
XObject of type "Meeting", you can send a new "Meeting Created" event.
There is a "Validation Expression" field used to determine either or not
the custom event should be sent. Now I need to add an other field to
determine which user should receive the event notifications. For example:
if userA and userB have been invited to MeetingC, I need to send an event
"Meeting Created" only for user A and user B.

Here is my +1,

Thanks,

[1]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Event%20Stream%20Module#HDefinecustomeventsinwikipages

--
Guillaume Delhumeau ([email protected])
Research & Development Engineer at XWiki SAS
Committer on the XWiki.org project

Reply via email to