Hello
2017-05-18 9:10 GMT+02:00 Thomas Mortagne <thomas.mortagne(a)xwiki.com>om>:
I'm not sure I understand the goal here.
For me what we need to do is provide a wiki version of
org.xwiki.eventstream.RecordableEventDescriptor and then send events
of that type using the script service but here you seems to be
designing a way to send events trough xobject creating which does not
make sense to me.
What I have in mind was not to create a script service to send events, but
a system that send automatically a recordable event when an XObject of a
certain type is saved.
Let me explain with an example.
Image a descriptor that say:
* listen to all DocumentUpdatedEvent and DocumentCreatedEvent
* if the saved page hold an XObject "Blog.BlogPost"
* then send a RecordableEvent with a parameter "eventType" to
"blogPostPublished"
Then, somewhere, a listener that listen to every RecordableEvent receives
the event with the parameter "blogPostPublished", and saves into the Event
Stream the event with the type "blogPostPublished".
Currently, to have this behaviour, the blog application has to create a
subclass of RecordableEvent, a RecordableEventDescriptor and a listener
that check when an blog post is saved. It's a lot of work and must be done
in java.
But I am convinced that it is a frequent use-case. Having an XObject saying
"every time the object Blog.BlogPost is saved, then send and record a
custom RecordableEvent with the eventType "blogPostPublished" will help a
lot and will not require any java dependency.
Thanks
On Wed, May 17, 2017 at 11:29 PM, Clément Aubin <clement.aubin(a)xwiki.com>
wrote:
Hi everyone,
I’m currently working on a feature that should allow users to define
custom notification types in XWiki only through the definition of an
XObject (link to the issue :
https://jira.xwiki.org/browse/XWIKI-14119).
In this context, I wanted to know your thoughts about what properties
should be proposed by this XObject.
Currently, here is my proposition :
- The application name (applicationName) : the event application name
- A unique ID for the event (eventId)
- An event «pretty» name / description (eventPrettyName)
- An event icon, mainly displayed in the user notification preferences
pane (eventIcon)
- An event type (eventType) : the name of the event that should trigger
the notification (such as org.xwiki.bridge.event.DocumentUpdatedEvent)
- An object type (objectType) : an XObject that _has_ to be associated
with the document triggering the event in order to trigger the custom
notification
- A validation expression (validationExpression) : a script that will be
parsed in the event context in order to filter certain event kinds.
- A notification template (notificationTemplate) : the template that
should be used for rendering the notification in the notification center
To summarize, a custom notification is triggered if the following
expression is fully satisfied :
«The (eventType) has been triggered on a document having (objectType) in
his XObjects and the (validationExpression) is true in the current
context».
What do you think ?
Thanks,
-- Clément Aubin Web Developer Intern @XWiki SAS clement.aubin(a)xwiki.com
More about us at
http://www.xwiki.com
--
Thomas Mortagne
--
Guillaume Delhumeau (guillaume.delhumeau(a)xwiki.com)
Research & Development Engineer at XWiki SAS
Committer on the
XWiki.org project