21 Feb 2016

Custom View Criteria Item Operators

There is a nice feature in JDeveloper 12c which allows to define custom where clauses for View Criteria Items declaratively.

Let's say there is a view object CountryVO. I need to define a view criteria PopularCountriesCriteria for this VO. So, basically, I need a where clause like this:  "Code IN (select code from VPopularCountryCodes)".

In order to do that before 12c we had to ether update View Object source XML code or override ViewObjectImpl methods such as getCriteriaItemClause or getViewCriteriaClause. Now we can do that in a bit more civilized way.

There is Custom Operators tab on the Edit View Criteria screen where we can define our custom POPULAR operator:

Having done that, we can use POPULAR operator while defining a view criteria item:

That's it!