0

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!

buch11
  • 872
  • 3
  • 13
  • 29
  • 1
    This doesn't make sense. Guvnor is targeted towards business users. If your business users cannot fathom Guvnor how then are they going to understand lower level rule code? Have you thought about using decision tables? These are just excel sheets with Drools annotations. All business users have familiarity with Excel so the learning curve will not be steep. –  Mar 30 '14 at 01:13
  • @I.K. I was exploring drools and guvnor at that time, thanks for the "decision tables" pointer...later we used the same...Thanks! – buch11 Aug 02 '14 at 12:39

2 Answers2

1

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.

Steve
  • 9,270
  • 5
  • 47
  • 61
0

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

Jay
  • 9,189
  • 12
  • 56
  • 96