Reputation: 1
I am using IBM ILOG JRules for doing a POC and I'm new to JRules. I have a business requirement in which:
In Rule Studio, I will create a Decision Table with the following condition for each role:
If Document Class is <abc> and User Role is <xyz>
Then Return Properties <P1, P2,…> as editable.
Can anyone please provide me help as to how I can achieve it in a simple way using IRL code?
Upvotes: 0
Views: 1495
Reputation: 1421
if you are new to JRules then keep in mind that you write business rules artifacts (Business rules, Decision Tables, Decision Trees) on whatever is defined in JRules and "verbalised".
What you are trying to do is just wrong in a BRMS point of view.
In a Decision Table (DT) you could have hundreds of lines, meaning hundreds of individuals rules. Each line is translated into a single rule.
So if you do that you will call hundreds of times the DB which is not what you want.
One could argue you can use fastPath algorithm in your rule task but you are new to JRules and I just want to remind you this point.
What you want is:
1/ Create an object model in Java.
2/ Create the BOM in JRules based on the object model (Java library).
3/ Verbalise your BOM (can be automated at design time during the import in JRules).
4/ write your DT
5/ create a call to the DB in your orchestration layer in Java.
6/ populate the objects instances and attributes from the orchestration layer.
7/ export a ruleset from your rule project with the correct input/output (ruleset parameters).
8/ make a call to the engine with your ruleset
9/ retrieve the result
Job's done
Keep in mind that a call to a DB from the rule engine at execution time is most probably a wrong idea because your rules can be tested multiple times and hence call the DB n times which is not efficient.
Upvotes: 1
Reputation: 21713
Try loading the data from the data base beforehand. JRules should be called with the loaded data and should return the result to the calling system which then stores the data back to the DB. A direct integration with the DB is not something I would recommend.
If the data from the DB doesn't change often and you can redeploy whenever a change happen, you can load the data into the BOM itself. If this is the case, you can load the data using the dynamic domain plug-in which inserts the data into your BOM, but as I said, this requires a redeployment of your RuleApp.
Upvotes: 0