I am new to drools and I am trying to create some rules for a project. I had been able to create a couple of rules but I have found difficulty to fire the below rules so any help would be valuable and much appreciated. I have been trying for more than a day to fire the below rules and I have tried multiple combinations with no success. The model is a huge object with multiple properties so I could not provide it.
In the below rule the "header.totalGrossMassMeasure" is a bigDecimal value. It is produced from xsd with xjc plugin. I would like to check its format to be a decimal number that has 16 digits overall with maximum of 6 decimal digits I know the regex is a bit bulky but form testing it here it seems to works. However it can not get fired. Any suggestions?
rule "007"
no-loop
when
$msg : Declaration( header.totalGrossMassMeasure.toString() matches "^([0-
9]{10}(\\.[0-9]{1,6})?)$|^([0-9]{11}(\\.[0-9]{1,5})?)$|^([0-9]{12}(\\.[0-9]
{1,4})?)$|^([0-9]{13}(\\.[0-9]{1,3})?)$|^([0-9]{14}(\\.[0-9]{1,2})?)$|^([0-
9]{15}(\\.[0-9]{1})?)$|^([0-9]{16})$")
result : ValidationResult()
then
RulesValidationError error = new RulesValidationError();
error.setRuleName("007");
error.setErrorType(ErrorType.INCORECT_VALUE);
result.getErrorsList().add(error);
end