On 05/18/2017 02:17 PM, Thomas Mortagne wrote: > On Thu, May 18, 2017 at 2:11 PM, Thomas Mortagne > <thomas.morta...@xwiki.com> wrote: >> On Thu, May 18, 2017 at 10:34 AM, Clément Aubin <clement.au...@xwiki.com> >> wrote: >>> On 05/18/2017 10:18 AM, Guillaume Delhumeau wrote: >>>> Hi Clément >>>> >>>> 2017-05-17 23:29 GMT+02:00 Clément Aubin <clement.au...@xwiki.com>: >>>> >>>>> 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) >>>>> >>>> >>>> What does it mean? If the ID is unique, it must be computed every time an >>>> event is created and it's not the job of the event descriptor to generate >>>> this. >>> >>> This event ID is used to uniquely identify an event type (I should maybe >>> rename it to eventTypeID in order to avoid some confusion), but the idea >>> of generating this ID automatically is very interesting ! >> >> You already have another field with the event type so I still don't >> see what this eventid field is about.
Here, eventId is used to uniquely identify an event. If I take the exemple of the application-blog, this eventId would be «BlogPostPublishedEvent». Note that, as Guillaume suggested, I plan to rename it eventType in order to avoid confusion. The current «eventType» field will be renamed «listenTo» or «eventTrigger». >>>>> - 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 > > Should be optional IMO and most of the time the class should be the > document in which the event type descriptor it's stored like I > explained in my example. > Ok ! >>>>> - 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 > > What do you mean exactly by "template" ? A reference to a template, > the actual wiki content that will do the display ? > Currently, it’s the actual wiki content that will be displayed. >>>>> 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.au...@xwiki.com More about us at http://www.xwiki.com