Enhanced notification filters AST (Abstract Syntax Tree)

Last modified by Vincent Massol on 2021/04/06

In XWiki 9.7RC1, we have introduced an Abstract Syntax Tree (AST) to generate the query that fetch the events we want to display as notifications.

This AST has been created for 2 reasons:

  • in the future, the events might be stored in a different way, and the current HQL query might be not effective on a different storage (such as NoSQL). This AST abstracts the language so the query could still be effective, as soon as we have a translator for the target language.
  • it's easier for developers to write a NotificationFilter by generating an AST than generating a good HQL query that must escape its values and co-exists with other filters...

In this release, we have rewritten the whole internal query, and we had to introduce new types of ExpressionNode to handle all use-cases. This new nodes are:

  • BooleanValueNode to handle a boolean value
  • DateValueNode to handle a date
  • EntityReferenceNode to handle an EntityReference without manual serialization
  • GreaterThanNode to handle >= comparison
  • InNode to check if a property or a value is contained in a list
  • LesserThanNode to handle <= comparison
  • StartsWith to check if a value or a property starts with some other value

Since theses nodes have been created for our own implementation needs, please open a JIRA issue if you wish to have more.

Tags:
   

Get Connected