Thursday, December 23, 2010

Oracle Business Rules. validating the number (count) of elements

I have to verify that the count(Lines) is a given number in a payload. Lines is represented as a List in JAXB, and it's a "element minOccurs=0 maxOccurs=unbounded" in the XSD.

In a Rule definition, there is no way to use a XPath expression on a XML Fact.
How painful.

I had to create a Function, return type in, input parameter Lines (it is a recognized type in the Facts), and use "return Lines.size()"
Then in Business Rules you can invoke the Function to compute the number of Lines.

Roundaboutish, eh?

No comments: