Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

Oracle Identity and Access Management
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new

Search Courses

Objective :

In this article we will discuss basics of Application Development Framework and how to use JDeveloper to develop business components. 

 

What is Application Development Framework ( ADF):

Built on top of the MVC-based JavaServer Faces framework, Oracle Application Development Framework (ADF) forms the foundation for WebCenter Portal's components and services. ADF is an innovative, yet mature Java EE development framework available from Oracle, and, unlike most other frameworks, is directly supported and enabled by the award winning development environment, Oracle JDeveloper 11g.ADF provides unified access to back-end technologies like databases, web services, XML, CSV, BPEL, and many more. Furthermore, ADF provides data binding to connect UI with back-end data controls.Out of the box, ADF provides more than 100 data aware, JSF view components. The fine-grained JAAS security model gives developers and administrators full control over all aspects of application security

It is the reference implementation of Java Server Faces (JSF) . In the year 2005/2006 Sun Microsystems has come with specifications known as  JSF. They had specification/reference and implementation both.  Earlier there were limited UI components available on other frameworks. The design goal was to put every UI components available in swing application such as mouse event, and other event sources etc into JSF that is available on the web .Now they are available as a part of JSF implementation. JSF is a specification and ADF is reference implementation of this specification. Oracle implemented ADF ,Apache implemented it and named it as MyFaces, JBoss implemented it and named it as RichFaces.Not only 100 percent implementation of the specification is done they have also added much more features which are not part of specifications such as business components, task flows , Data Visualization Tool (for a pictorial representation of data ).ADF is the framework which is used by all Fusion Middleware products which can be OIM , OAM , Webcentre  . All FMW products are developed using JDeveloper. You need basic knowledge of ADF is required to for customization / to modify the existing task flows or pages.

 

Business Components in ADF:

Business logic and data access logic are available in Business Components. In essence, there are three types of Business Components available.

1) Entity Objects( EO):

Some of the frameworks are available to communicate with the database . Being a java programmer everyone one wants to view even the database in the form of java object. For that, there are so many frameworks introduced and they are called as Object Relational Mapping(ORM) framework. Here the tables are converted into java classes and each row will be converted into an object and that represents one row of that table. For example, let’s say we have a table called Student and has the following columns.

Column Name

Data Type

RollNo

int

Name

varchar(30)

Address

Varchar(30)

What this ORM framework does is it creates a class with the same mapping to the table . For example it generates the  following class Student based on table having the variables mapping to the columns of the Student table and has getter/setter methods corresponding to the variables .

class Student

{

int rollno;

String name;

String address;

Student(int r, String n, String ad)  // Constructor which will be called when the object is created

{

rollno=r;

name=n;

address=ad

}

public void setRollno(int roll)

{

rollno=roll;

}

public int rollno()

{

return rollno;

}

public void setName(String na)

{

name=na;

}

public int name()

{

return name;

}

public void setAddress(String addr)

{

address=addr;

}

public String getAddress()

{

return address;

}

}

Now we will create an object of the class Student.

Student s = new Student(21,”John”,”New York”);  

Once you create the object, the constructor will be called and the values passed to the constructor will be saved into the variables of the class. Also, one new record will be inserted in the table Student. Now, this we call it as entity object since it represents one entity of the table. We can modify the values by calling setter method.

s.setRollNo(45);  So the roll no 23 which was inserted will be replaced by 45 i,e the corresponding row gets updated. So if you create a new object you will find a new row, if you delete the object that record gets deleted from the table. So if there are 100 records in the table you will find that 100 objects in the memory.Entity object represents each row in the table and corresponding class can be called as an entity class. Having getter/setter methods or mutators method is mandatory, apart from this custom methods can be added to define your custom logic. Suppose if you have a product table containing two columns quantity and price, and a line total is to be displayed on a page, which is not a column in the table. To display the total you can define one transient attribute as line total evaluate it to quantity * price. And we are marking it as transient so that it will not be persisted to the table but you can display it on the screen.Likewise, you can define your own logic in the entity classes

 

2)View Objects( VO):

View Objects are created by keeping the web page in mind. So, for example on a web page, I want to display all the students. There can be 100 students that are to display, so all 100 entity objects are encapsulated in VO and the data required to be displayed on the page will be available in this VO. For example entity object may have a name , roll no , address, class, blood group, class etc, probably all these values are not required to displayed on page, so you can add all the 100 entity objects to the VO and you can remove the attributes which you are not displaying on the page . Ultimately the data required to be displayed on UI page is available with VO.It may also have some associated entity objects, For example, we may have two different objects employee and department entity objects. If you want to display the employee and its department, then on a VO we can add employee entity object and department entity object associates them with an association and displays it on a page. VO can have one or more entity objects of different types which are associated.

 

3)Application Modules (AM):

It manages the transaction. It provides all the required transaction services. Application Modules are created by keeping user task in mind. To complete one end user task what all you need is added to to the application module. Application Module encapsulates all the VO’s which are required to complete one end user task/ use case. For example, to transfer money from my account, I will open Internet Banking Application. In the first page, I will select my account, on the second page I will select the beneficiary,  on the third page I will enter OTP / some credit/debit card details and on the fourth page, I will transfer it. So this is what I have completed one user task(use case). All these 4 pages will be having 4 VO’s in the background, and all 4 VO’s will be added to the application module so that it manages the transaction for all those VO’s.If anything goes wrong in the third page everything gets rolled back.It also used to expose the business services to the world. For example, consider HDFC bank’s loan department.There are so many financial firms that provide the loan on behalf of HDFC bank. So those should be able to submit the loan applications to the HDFC bank and retrieve the rate of interest and all those details. For that bank has to make its business services available to their business partner’s applications.

 

Using JDeveloper :

JDeveloper is the tool / IDE/editor meant for developing ADF Application.

Simple ADF application demonstration:

  1. 1)We will start the integrated Weblogic Server or OIM server can also be used as well.

  2. Click on Run > Start Server Instance (IntegratedWebLogicServer)

  

2) Create a New Application by clicking on New Application.

 

3)Name the application for example as CerebraApp and select Fusion Web Application (ADF) as Application Template and click Next.

4) By default, Project name will be Model we will change it to BusinessServices and click Next.

5) Leave the default package name as model and click on Next .

6) Change the default ViewController project name to UIProject and click on Next .

7) Keep the default Package name as view and click on Finish.

8) Two projects will be created  BusinessServices & UIProject within CerebraApp one for Busines services and one for UI. Also, there will be checklists

 

Check List:

  1. Plan your application and check it to Done once complete

You can click on Developer Guide and download the ADF guide.

b.  Connect to a Database. If your application uses database you will have to create a Database Connection.

Currently, we will not perform this step since we don’t want database connection.Similarly, each of the tasks can be performed and mark it as done. It helps the developer how to start with. We will directly start with the project currently and ignore the check list.

 

9) Now in BusinessServices project I will add my business components.

-> Right click BusinessServices project and click on New.

-> Select ADF Business Components under Business Tier from Categories and Business Components from Tables and click on Ok

-> It will ask for connection, we will add one database connection. Click on the GREEN PLUS sign to add a new database connection.

 

  

Once you Test Connection it should be successful.If not you need to enter correct database details. 

 

-->  The wizard shown in the following screen shot will create all business components entity objects, view objects and Application Modules. Click on query button to create a SQL query.

 

-> Clicking on query will list all the available tables in HR database

 

→ Select EMPLOYEES table> Rename entity name to EmployeeEO> Next

→ It will create the Updatable View Object, Select the EmployeeEO and shift it to Selected column

 

 

In 'Object name' rename it to EmployeeEO and click on Next

-> We are not creating any Read-only View Object so we will click on Next again.

 

→ Select the Checkbox to create  Application Module and Click on Next.

-> Click on Next. After clicking Next it will start creating the business components.

 

-> Business components will be created

9) You can test Business components locally with a standalone application. To test Application Module Right click on 'AppModule' and click on Run. 

 

->After running Business Component browser will be executed which is a swing application and you can test it before deploying it to Weblogic.

 

The AppModule with EmployeeVO1 is an application managing one VO. Run time instance name of that VO is EmployeeVO1

If we add one more View Object the name of run time instance VO will be VO2. Double click on EmployeeVO

 

→ Employee details will be listed in the Business Component Browser.

You can also modify the details and add a new record by clicking on green + button.

 

-> To delete a record click on the red cross button. To commit a transaction, click the button with green tick, next to it.

 

This internally updates entity objects based on what you are modifying here on View Object. Entity object, in turn, updates the table. For example, deletes a row in this case. This is how the Business component process works.

Objective : In this article we will discuss basics of Application Development Framework and how to use JDeveloper to develop applications

Application Development Framework ( ADF):

It is reference implementation of Java Server Faces(JSF) . In the year 2005/2006 Sun Microsystems has come with specifications known as  JSF. They had specification / reference and implementation both .  . Earlier there were limited UI components available on other  framework . The design goal was to put  every UI components available in swing application such as mouse event , and other event sources etc into JSF that is available on web .Now they are  available as a part of JSF implementation . JSF is a specification and ADF is reference implementation of  this specification . Oracle implemented ADF ,Apache implemented it  and named it as MyFaces , JBoss implemented it and named it as RichFaces .Not only 100 percent implementation of specification is done  they have also added much more

features which are not part of specifications such as business components , task flows , Data Visualization Tool (for pictorial representation of data ) .ADF is the framework which is used by all Fusion Middleware products which can be OIM , OAM , Webcentre  . All FMW products are developed using JDeveloper . You need basic knowledge of ADF is required to  for customization / to modify the existing  task flows or pages .


Business Components in ADF:

Business logic and data access logic are available in Business Components. In essence there are three types of Business Components available .

1) Entity Objects( EO):

Some of the frameworks are available to communicate with database . Being a java programmer everyone one wants to view even the database in the form of java object . .For that there are so many frameworks introduced and they are called as Object Relational Mapping(ORM) framework. Here the tables are converted into java classes and each row will be converted into an object and that represents one row of that table. For example let’s say we have table called Student and has the following columns .


Column Name

Data Type

RollNo

int

Name

varchar(30)

Address

Varchar(30)


What this ORM framework does is it creates a class with the same mapping to the table . For example it generates the  following class Student based on table having the variables mapping to the columns of the Student table and has getter/setter methods corresponding to the variables .

class Student

{

int rollno;

String name;

String address;


Student(int r, String n, String ad)  // Constructor which will be called when the object is created

{

rollno=r;

name=n;

address=ad

}


public void setRollno(int roll)

{

rollno=roll;

}

public int rollno()

{

return rollno;

}

public void setName(String na)

{

name=na;

}

public int name()

{

return name;

}

public void setAddress(String addr)

{

address=addr;

}

public String getAddress()

{

return address;

}


}


Now we will create an object of the class Student.

Student s = new Student(21,”John”,”New York”);  

Once you create the object, constructor will be called and the values passed to the constructor will be saved into the variables of the class . Also one new record will be inserted in the table Student . Now this we call it as entity object since it represents one entity of the table. We can modify the values by calling setter method .

s.setRollNo(45);  So the rollno 23 which was inserted will be replaced by 45 i,e the corresponding row gets updated . So if you create a new object you will find a new row , if you delete the object that record gets deleted from the table . So if there are 100 records in the table you will find that 100 objects in the memory .Entity object represents each row in the table and corresponding class can be called as an entity class . Having getter/setter methods or mutators method is mandatory , apart from this custom methods can be added to define your custom logic . Suppose if you have a product table containing two columns quantity and price , and a line total is to be displayed on a page , which is not a column in the table . To display the total you can define one transient attribute as line total evaluate it to quantity * price . And we are marking it as transient so that it will not be persisted to the table but you can display it on the screen .Likewise you can define your own logic in the entity classes


2)View Objects( VO):

View Objects are created by keeping the web page in mind . So, for example on a web page I want to display all the students . There can be 100 students that are to displayed , so all 100 entity objects are encapsulated in VO and the data required to be displayed on the page will be available in this VO . For example entity object may have name , rollno , address , class , blood group , class etc , probably all these values are not required to displayed on page , so you can add all the 100 entity objects to the VO and you can remove the attributes which you are not displaying on the page . Ultimately the data required to be displayed on UI page is available with VO  .It may also have some associated entity objects For example we may have two different objects employee and department entity objects . If you want to display the employee and its department , then on a VO we can add employee entity object  and department entity object associate them with an association and display it on a page . VO can have one or more entity objects of different types which are associated .


3)Application Modules (AM):

It manages the transaction. It provides all the required transaction services . Application Modules are created by keeping user task in mind . To complete one end user task what all you need is added to to the application module. Application Module encapsulates all the VO’s which are required to complete one end user task/ use case . For example to transfer  money from my account  ,I will open Internet Banking Application . In the first page I will select my account , in the second page I will select the beneficiary ,  in third page I will enter OTP / some credit/debit card details and on the fourth page I will transfer it . So this is what I have completed one user task(use case) . All these 4 pages will be having 4 VO’s in the background , and all 4 VO’s will be added to the application module so that it manages the transaction for all those VO’s.If anything goes wrong in third page everything gets rolled back .It also used to expose the the business services to the world . For example consider HDFC bank’s loan department .There are so many financial firms that provide the loan on behalf of HDFC bank . So those should be able to submit the loan applications to the HDFC bank and retrieve the rate of interest and all those details . For that bank has  to make its  business services available to their business partner’s applications .

Using JDeveloper :

JDeveloper is the tool / IDE / editor meant for developing ADF Application .

Simple ADF application demonstration:

  1. We will start the integrated Weblogic Server  or OIM server can also be used as well .




2) Create a New Application by clicking on New Application .



3)Name the application for example as CerebraApp and select Fusion Web Application(ADF) as Application Template and click on Next.


4) By default Project name will be Model we will change it to BusinessServices and click on Next .

5) Leave the default package name as model and click on Next .


6) Change the default ViewController project name to UIProject and click on Next .


7) Keep the default Package name as view and click on Finsh.


8) Two projects will be created  BusinessServices & UIProject within CerebraApp one for Busines services and one for UI . Also there will be checklists

Check List:

  1. Plan your application and check it to Done once complete

You can click on Developer Guide and download the ADF guide .

b.  Connect to a Database . If your  application  uses  database you will have to create a Database Connection .

Currently we will not perform this step since we don’t want database connection .


Similarly each of the task can be performed and mark it as done . It helps  the developer how to start with . We will directly start with the project currently and ignore the check list .


9) Now in BusinessServices project I will add my business components .

-> Right click BusinessServices project and click on New.


-> Select ADF Business Components under Business Tier from Categories and Business Components from Tables and click on Ok



-> It will ask for connection  , we will add one database connection .

Once you Test Connection it should be successful .If not you need enter correct database details .





-->  The wizard shown in following screen shot will create  all business components entity objects , view objects  and Application Modules . Click on query button to create a sql query.






-> Clicking on query will list all the available tables in HR database



→ Select EMPLOYEES table


→ It will create the Updataable View Object , Select the EmployeeEO.



-> We are not creating any Read-only View Object so we will click on Next.


→ Select the Checkbox to create  Application Module and Click on Next.


-> Click on Next. After clicking Next it will start creating the business components.


-> Business components will be created


9) You can test Business components locally with a standalone application . To test Application Module Right click and click on Run .


->After running Business Component browser will be executed which is a swing application and you can test it before deploying it to Weblogic.



If we add one more View Object the name of run time instance VO will be VO2 . Double click on EmployeeVO

→ Employee details will be listed in the Business Component Browser .


You can also modify  the details and add a new record by clicking on  + button .



-> To delete a record click on cross button .


This internally updates entity objects based on what you are modifying here on View Object . Entity object in turn updates the table.For example deletes a row in this case . This is how Business component process works .








Kashif Baksh

Add comment


Security code
Refresh

About the Author

Kashif Baksh

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  May 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
    1  2  3  4  5
  6  7  8  9101112
13141516171819
20212223242526
2728293031  

Enquire For Training

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner