Andrejus Explains a Simple Business Logic Groups Example
By Steve Muench on Nov 03, 2009
Andrejus keeps cranking out the examples! His latest posting describes a downloadable sample that utilizes the new capability in 11g called business logic groups (covered in section 4.8 Defining Business Logic Groups of the dev guide).
This feature allows you to define a business logic discriminator attribute whose runtime value can cause a given set of attribute defaults, validation rules, and UI hints to be used. For example, given an employee you might define a business logic group named "CountryGroup" based on the "Country" attribute because there might be different defaults, validation rules, and/or UI hints for employees based on the country they are from. You could create one business logic unit for the "US" value, one business logic unit for the "UK" value and in this way US and UK employees would be treated differently based on this data-driven value. At some future point in time, you could introduce additional business logic units for countries "IT" and "DE", as well.
The business logic units in a business logic group don't have to live in the same package as the entity object that defines the business logic group. In fact, they might not even live in the same project. They provide a slightly more flexible mechanism than the standard discriminator-attribute-based inheritance support we provide because:
- You can define multiple business logic groups per entity (while Java and ADFBC only allow you to inherit from a single parent).
- New business logic units can be introduced at any time, perhaps as part of tailoring an application for a particular country (continuing with my example above).