Monday, 2 December 2019

Creating first oracle ADF Application

In this post, I will show how to create an oracle ADF application and create Entity Object and ViewObject and test the Business Component.

We will create the following in the blog below.
  1. Create an oracle ADF Application.
  2. Create an Entity Object.
  3. Create a View Object.
  4. Create an Application Module.

Let's start.

1. Creating an ADF Application.

 

Open JDeveloper and create a new Application.


Then from the dialogue select Applications->ADF Fusion Web Application. JDeveloper IDE can be used to make many types of Applications. Oracle ADF Applications are made under this head.


Creating an Application involves 6 Steps.
In first you have to write Application Name and Application Package Name. In this case, I have used the name "EmployeeDetailsAPP". I have also given the package name as "employeedetailsapp"
.

ADF Application support MVC and an Application is divided into 3 parts
  • Model (Business Layer)
  • View (View layer)
  • Controller. (Control Flow)
An ADF application is divided into two Projects, one is Model and other is ViewController.
The windows below show the first project i.e. Model and its constituents.



The windows below show the second project i.e. ViewController and its constituents.



This is the last step, here leave the selection to default.


Now application structure is made. In the middle section you can see the steps for developing the application which is shown by default.


After that you have to create database connection which will be used in the Application.



As we have created the Database Connection, the next step is to create an Entity Object.


Select the database connection which will be used for creating the Entity Object.


Now we have to select the Database Table i.e. DEPARTMENTS for which Entity Object will be created.


Click on next. Now you can see the Attributes of the Table DEPARTMENTS


In this dialog you can see the attribute properties. All the properties are inherited from Database Table. e.g. you can see the Attribute "DepartmentId" is Primary key and a mandatory column. From here the properties can be changes as per the need, but it is advised not to change these.



In this window from will see the summary. Now click on Finish.


Here is DepartmentEO which we have created.


Here are the business rules of the table which are inherited by Entity Object.


As we have created the Entity Object, now we will create a View Object based on Entity Object. This is also called updateable ViewObject.



Here we have to specify the name of the ViewObject. In the Data Source selection select Entity.


In the Entity Object section select the Entity Object for which you want to create View Object.



Then in the next dialog you will have option to select the attributes of Entity Object which will be considered while creating ViewObject.


Select the select all icon to select all the attributes.


Here you can see the attributes properties.


In this dialog you can select order by clause for your ViewObject.


This is the summary.


Now as you can see we have created DepartmentsEO and DepartmentVO.


Now to run the ViewObject we need to create an Application Module. Application Module is the Transaction Controller of the ADF Application. All the database activity are performed by Application Module.


As the name of the Application is EmployeeDetailsApp, I have names Application Module as EmployeeDetailsAM. Its good practice to give name to Application name.



Now as we have created the ApplicationModule. Go to the Data Model Section and add a instance of ViewObject from the Left panel.


Now as we have created all the needed Business components we need to run and test the Application Module.


When you run the application a tester window will appear as you can see the image below. As you can see that the fields such as DepartmentName,DepartmentId,etc. are editable. As this ViewObject is based on EntityObject, this can be used for performing CRUD operations.


In this blog i have demonstrated till the Model Layer. In the Next blog i will show you how we can perform CRUD operation on a Web page.

Followup post coming soon.... ☺️


Next Post : https://adfjavacodes.blogspot.com/2020/01/crud-operation-on-webpage-in-adf.html

No comments:

Post a Comment