I am building a validation policy, the rule sets will validate the xml document I passed in, raise different kind of validation errors if anything invalid is found. However, I want to buld one additional rule that says ‘if no validation error is found, do something’. Is it possible to archieve this and how?
i.e. rule looks like this
if doc.firstname=dog
then isDocumentValidate=false; failedReason=’must be a human’
if doc.age=0
then isDocumentValidate=false; failedReason=’must be an adult’
if isDocumentValidate=true
then doSomething
Yes, you can set a priority on each rule within the policy (click on the rule and examine its properties). The rules will execute from the highest priority number to the lowest. You can also use negative numbers. After you “invalidate” a document, you can stop firing additional rules (example of this here).
However for your example, if possible I would suggest that you have the default value for
isDocumentValidate=true, and the BRE will only need to worry about changing the value on invalid instances.A rule with an condition of
1 is equal to 1will always be true. Have that rule be your lowest priority.