Thursday 29 January 2015

3. Creating and Running ADF BC

Here is an example of how to create business components (EO, VO and AM) and then running the same using ADF model tester.

In JDeveloper, create a new application of type Fusion Web Application (ADF) as shown below:


This will open a wizard where we provide application and project names. ADF application creates two projects: one is model (for business components) and other is viewController (for ADF faces and task flows). Once we finish the wizard, two projects get created:



ADF Business Components are created under model project. There are two ways in which we can create ADF BC.
Right click on Model > New > ADF Business Components > Business Components from Tables. Using this method, all the components i.e. Eos, VOs, AM can be created in a single go. Another advantage is that we can create more than one component of each type.
Another way is to create each component separately using, Model > New > ADF Business Components > Entity Object OR View Object OR Application Module.
For now, we are using the first method.


When we select Business Components from Tables, it will prompt us to create a DB connection. Provide all the details and click OK.
In the first step, we create two entity objects on EMPLOYEES and DEPARTMENTS tables. Query the data dictionary and shuttle these two tables on the right. Modify the package name to ‘model.eo’ for separating the components logically. Also you can optionally rename the entity object by providing EO as suffix:


Next step is to create updatable view objects based on the entity objects. Here again modify the package name to ‘model.vo’, shuttle both Eos to right and rename VOs by giving VO as suffix:


In next step we can create read-only view objects (NOT based on entity objects). For now skip this step and click next to create application module. Here provide the application module name and package name such as ‘model.services’.


Click on next and then finish. If there are any relationships already defined in DB among tables, corresponding associations and view links get created automatically. This is how all these three packages would look:


At this point, we can test our application module by right clicking > Run. This will open the ADF Model Tester (swing based application) where we can execute the data model exposed through application module:












No comments:

Post a Comment