Business rules: How I can make two rules mutually exclusive?
Hi all soa gurus :)
I am using business rules to validate the input data in a process, according to the business logic. I've, for example, two validations: first, validate required fields in the request and second, validate the AUTHOR_NAME value (incoming in the input) is equal to "William Shakespeare".
I've created a ruleset with two rules and looks like this
Rule 1
IF(Request.TITLE== null or Request.AUTHOR_NAME!= null)
THEN assert new Error (error = true)
Rule 2 IF(Request.AUTHOR_NAME != "William Shakespeare")
THEN assert new Error (error = true)
When I deployed the aplication and tested the process service with the folloing request values TITLE = null and AUTHOR_NAME = null I got an exception related to Error type (the output variable in the decision function) is instanciated several times.
I think this happen because both rules in the ruleset are taking place.
The questions are: Is there any way to make something like "Don't care" in decision tables that can be applied in IF/THEN rules? Or any way to especify thet when a rule is checked and IF sentence is evaluated to true do not check the other rules?
The example is pretty easy by my request contains around 15 fields to validate and create a rule for all factible combination I think is not a nice job although is neccesary, what can I do, but I really need another aproach.
Any suggestion will be welcome.
Thanks in advance,
isabelbernely