I have created sample application - BC_Inheritance.zip, which shows how you can use inheritance with your business components. For the data source is used EMPLOYEES table from standard HR schema. The logic is the same as I have described it above - there is base View object and two extended. Business Components diagram for this sample:
EmployeesHighSalaryView retrieves records from database with salary value greater than entered, and EmployeesLowSalaryView with lower. Both of those View objects differs from their base View object by query Where clause.
How you can create extended View objects? There is nothing simpler - just use Oracle JDeveloper wizard. You should open Create View Object dialog and in the first step specify base View object you want to extend:
Other steps are the same as for usual View object.
In Presentation layer, View objects extended from base View object are used in similar way as usual View objects. In this sample I have added to the Data Model only extended View Objects, without base object. Data control looks like:
Sample application logic - user enters salary value and submits it by pressing Show button. When button is pressed, the same value is passed to both extended View objects. First View object shows employees with salary higher than entered and second View object with lower. This screen shows how it looks in practice:
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.
No comments:
Post a Comment