How about this:
rule "Valid Format"
when
$status : RuleResult()
Identifier(value matches "^([0-9]{9})$")
then
$status.addErrorMessage("Identifier does not match required format");
end
http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.h...
On Dec 19, 2007 9:48 AM, <John.Dubchak(a)wellsfargo.com> wrote:
Hi,
We are using Jboss-rules 3.0.5 and I have written a simple rule:
rule "Valid Format"
when
$status : RuleResult()
$id : Identifier()
eval ($id.getValue() != null)
eval (!$id.getValue().matches("^([0-9]{9})$"))
then
$status.addErrorMessage("Identifier does not match required
format");
end
In my unit test, I create an instance of the Identifier object and do not
set the Value, therefore it is null by default. I have an earlier rule that
checks for this null value and places an error message in the result object
appropriately. I would expect this error to fail and not see this error
message in the result, but instead see the missing value error message. The
problem is that I see both.
It appears as though the eval null check is failing. Am I misunderstanding
how this rule should work?
Any insight and/or answers are really appreciated.
Thanks,
John
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users