Page 1 of 1

Ninja Rules Engine

PostPosted: Tue Jul 17, 2018 7:18 am
by red1
With the satisfying success of my pet project, Ninja to handle AD tasks and app plugin development faster, i now set my mind on a constant recurring but elusive theme in super app building - the use of an easy Rules Engine.

I caught this fluff again while putting the Kanban Board to talk to Libero, i began to think what if the logic involved can be put into a template model without needing to code in the Model class. So i began drawing first a kanban based doc event handling format but then quickly evolve to more abstract use. Below is the initial schema of the model. All done for Ninja to generate quickly.

RulesDesign.png
RulesDesign.png (114.35 KiB) Viewed 1039 times
This framework is initiated during the DocEventHandling regime occuring in every plugin handling of a full DocType i.e. possessing DocAction/DocStatus elements.

The system will extract the associated model for the Table and its accompanying event. It first examines its non-rules, i.e. conditions that this rule will not be executed and maintain the status quo. it will refer a table and column value as described and there can be a series of consecutive conditions with OR clause. An AND clause will qualify even the first one that stops it. There will be use of WHERE RecordID passed from the calling event.

After that it will examine the supported actions based on positive conditions. The actions can be CRUD type and even processes. Again they can iterate consecutively.

As this whole elaborate scheme can be messy and bulky (a main reason why present Rules Engine are complex and possessing a steep learning curve to integrate as well as been too generic for iDempiere mind-set), i am devising a RulesStatement to translate from a pseudo statement into this schema.