Reputation: 882
I am new to Drools. We have an app where we are consuming rules and we use Drools Guvnor to add/update rules. Now we are trying to create a UI where business users(non technical) can see/change the rules in the format that they can understand. To achieve this, we first need to fetch the rules in "java", get the LHS and RHS from them and show it in a matrix like format.
My question here is, how to fetch and play around with the rules in java code?
Please suggest if there are any alternative approaches to achieve the same.
Happy Coding!
Upvotes: 0
Views: 1468
Reputation: 9490
The rules don't exist as Java code. However, you can use the Guvnor REST API to download the DRL source code for the rules and then upload it again.
However, it sounds like you want to support round trips between rules modified in Guvnor, loaded into your UI, modified and then uploaded back to Guvnor. I can't think of a way of doing this, which would not be extremely fragile. Certainly if you are new to Drools, I would recommend staying well away from trying to implement this.
If you want to work with a completely custom UI instead of using the Guvnor rule management functionality, you would be better off storing the rules in your own domain model in a database and generating the DRL from that model. This may make Guvnor redundant in your environment. If you have other rules which still need to be managed in Guvnor, then you could generate the DRL and upload it to Guvnor using the REST API.
Upvotes: 1
Reputation: 9509
Guvnor is also meant to be used by non-programmers to play with the rules.. You could provide access to Business users to use Guvnor.
You would want to use Guvnor if
-- You have a need to control access to rules and other artifacts
-- Have a variety of non programmer users who could use graphical editors to edit rules
http://www.jboss.org/drools/drools-guvnor.html
Upvotes: 0