I have a requirement to set a new property (example: unique ID) to each and every rule and access it from action part of the respective rules during the execution. For example: If the age of person is more than 18 then set the output to the ID of the rule.
(Here ID should come from the new property being added.)
I am using IBM ODM 8.5. Please suggest what are all the ways get unique ID from business rules?
In the B2X mapping of virtual method, I printed the rule.properties map using instance.getRule().properties
. I was expecting custom properties and all other rule properties. However, the properties map only had a handful of following six:
key: ilog.rules.business_name value: test score
key: ilog.rules.package_name value: check score
key: requestorMail value:
key: status value: new
key: ilog.rules.package value: check_score
key: ilog.rules.group value: check_score.test_score
You can customize rule model with Model extension and add your custom property (YOUR_PROPERTY_NAME) to the rule artefact.
You can acces this by adding a virtual method (static method in the BOM! don't use a xom! simply add it with the BOM editor) verbalized YOUR_VERBALISATION.
instance.getRule().getPropertyValue("YOUR_PROPERTY_NAME")
; (instance is a runtime variable containing the IlrRuleInstance
of the current Rule)