Vous êtes sur la page 1sur 163

Oracle Application

Framework
- By Dinesh Kumar S

Oracle OAF - by Dinesh Kumar S 1


Introduction to
OAF

Preface

In this book I have highlighted on basics of OAF. By reading this you will get idea on
what is OAF.

Author: Dinesh Kumar S

Email: Dineshcse86@Gmail.Com

Official Post: www.Planet-Source-Code.com


2 Oracle OAF - by Dinesh Kumar S
TABLE OF CONTENTS

Introduction

Overview of OA Framework

Architecture of OAF

OAF State Management

Model Interaction

OAF Profile Options

jDeveloper IDE
Creation of Page
Java OOPS

Oracle OAF - by Dinesh Kumar S 3


Introduction

4 Oracle OAF - by Dinesh Kumar S


About Framework

Framework:

A software framework is a concrete or conceptual platform where common code with


generic functionality can be selectively specialized or overridden by developers or
users.
Frameworks take the form of libraries, where a well-defined application program
interface (API) is reusable anywhere within the software under development.
As the name suggests, a framework serves as a foundation for programming, while an
API provides access to the elements supported by the framework.
A framework may also include code libraries, a compiler, and other programs used in
the software development process.

J2EE:

The platform provides an API and runtime environment for developing and running
enterprise software, including network and web services, and other large-scale, multi-
tiered, scalable, reliable, and secure network applications.

5 Oracle OAF - by Dinesh Kumar S


Six best web frameworks in Java:

Framework From Based-on Features


Name
Java Server Sun Component Centric The most using web framework. Because of its
Faces Microsystems approach component architecture, the developer doesnt need
(JSF) to mess with writing HTML, JavaScript etc to get rich
AJAX type of functionality.

GWT Google Widgets Speed development. Easy to develop well, neat and
Browser independent Ajax applications.

Stripes Mc4j MVC architecture No Configurations. Annotation based programming


makes coding more interesting and easy.

Spring MVC SpringSource MVC architecture The Spring MVC Frameworks architecture and
design are in such a way that every piece of logic and
functionality is highly configurable.

Struts2 Apache MVC architecture No more ActionForms! Use any JavaBean to capture
form input or put properties directly on an Action
class.
Wicket Apache Component Centric Swing-like OO Component Model. This feature
approach separates Wicket from all other frameworks

6 Oracle OAF - by Dinesh Kumar S


Below two questions triggers in our mind,

Why Oracle Developed New Framework?

Why they did not use an existing java frameworks, which is based on MVC
architecture?

7 Oracle OAF - by Dinesh Kumar S


Open Systems Interconnection (OSI) & TCP/IP Model:

Application layer is the highest most layer in OSI and TCP/IP layered model. This layer
exists in both layered Models because of its significance which is interacting with user
and user applications.
This layer is for applications which are involved in communication system.
8 Oracle OAF - by Dinesh Kumar S
Software frameworks are available for use in each application layer:
user interface, business process & logic, and data access.

9 Oracle OAF - by Dinesh Kumar S


Why use a Framework?

Software Development:

Developing a software is expensive because of factors like IT Staff, Hardware,


Software.
Also, development activity involves lots of effort including skill of developers.
Companies use frameworks as a way to reduce costs and introduce a higher level of
predictability into software development.

Advantages of Framework:

1. Frameworks reduce the software development effort.


2. Frameworks provide the generic services needed by most applications. Examples
are logging, configuration, database access and caching.
3. Frameworks reduce complexity:Many of the design decisions necessary when
starting development from scratch are already built into the framework.
4. Frameworks improve productivity, quality and consistency:Frameworks make
the software development cycle a more predictable process by providing a standardized
architecture and a standardized development approach.

10 Oracle OAF - by Dinesh Kumar S


Where do Framework fit into Application Development?

Types of Framework

Software frameworks Application frameworks Solution frameworks


are the models, templates are partially built applications are completed and working
and libraries that we or application shells. These applications. They include
discussed earlier. They frameworks are working both business code and
manage discrete applications without business infrastructure code. These
components of code. Developers add the frameworks require
applications. Developers business code to the configuration and
use these frameworks to framework to complete the integration, and may require
build applications. application. a small development effort
to add or customize specific
business logic.

Note** oracle has developed an Oracle Application framework (OAF)


11 Oracle OAF - by Dinesh Kumar S
Components & Containers: (in context to GUI)

In object-oriented programming, a component is a reusable program building


block that can be combined with other components in the same or other
computers in a distributed network to form an application.
Examples of a component include: a single button in a graphical user interface.

Components can be deployed on different servers in a network and communicate


with each other for needed services.

A component runs within a context called a container.


Examples of containers include pages on a Web site, Web browsers, and word
processors.

Note** Component is nothing but web bean.

12 Oracle OAF - by Dinesh Kumar S


Web Bean:

A Web Bean is an application class that contains business logic.


Web Beans arestatefulandcontextual.
Clients executing in the same context will see the same instance of the Web Bean.
But clients in a different context will see a different instance.

<< No Interactions >>


Java EE
X Persistence
Presentation
Layer Layer
(Servlet, JSP, JSF) Web bean (JTA, JCA, JPA)

<< Close Interactions >>

Presentation Layer :The application presentation layer works as a bridge that connects the clients with
the application logic layer i.e. Graphical user interface (GUI).

Persistence Layer :It is to use a session at run time to associate mapping metadata and a data source in
order to create, read, update, and delete persistent objects using the TopLink cache.

13 Oracle OAF - by Dinesh Kumar S


Servlet:

Why Servlet?

Shortly after the Web began to be used for delivering services, service providers
recognized the need for dynamic content. Applets, one of the earliest attempts
toward this goal, focused on using the client platform to deliver dynamic user
experiences. At the same time, developers also investigated using the server platform
for the same purpose.
Initially, Common Gateway Interface (CGI) server-side scripts were the main
technology used to generate dynamic content. Although widely used, CGI scripting
technology had many shortcomings, including platform dependence and lack of
scalability.
To address these limitations, Java Servlet technology was created as a portable way to
provide dynamic, user-oriented content.

They are commonly used to extend the applications hosted by web


servers, so they can be thought of as Java applets that run on servers instead
of in web browsers.

14 Oracle OAF - by Dinesh Kumar S


Servlets are most often used to:

Process or store data that was submitted from an HTML form.

Provide dynamic content such as the results of a database query.

Manage state information that does not exist in the stateless HTTP protocol, such
as filling the articles into the shopping cart of the appropriate customer

Servlet Advantage:

Servlets provide a way to generate dynamic documents that is both easier to


write and faster to run.
provide all the powerful features of JAVA, such as Exception handling and
garbage collection.
Servlet enables easy portability across Web Servers.
Servlet can communicate with different servlet and servers.
Since all web applications are stateless protocol, servlet uses its own API to
maintain session.
15 Oracle OAF - by Dinesh Kumar S
Overview of OA Framework

16 Oracle OAF - by Dinesh Kumar S


What is OAF

Oracle Application Framework(OA Framework or OAF) is a proprietary


framework developed byOracle Corporationfor application development within
theOracle E-Business Suite(EBS).

Customers can personalize, customize and develop custom-application.

It helps in creating Self Service pages in Oracle EBS and It controls the flow of the
application.

This framework works on the basis of Java EEprinciples and it also supports various
standards like HTML, XML, SQL, and JSP.

We can view OA Framework pages in mobile phones which contain Internet browsing
feature.

Pre Requisites:

We must know the Basics of Core Java and Java OOPS Concepts to learn and
incorporate OAF.

17 Oracle OAF - by Dinesh Kumar S


OAF Key Features

Declarative Environment: Standard Compliance:

Supports, 100% Java & XML J2EE based, middle-


Personalization tier application framework and
Customization services provide for rapid
Extensions development & deployment

OAF

MVC Design:

A component-based design with clean


interfaces among model, view, and
controller objects.

18 Oracle OAF - by Dinesh Kumar S


OAF

Advantages: Dis Advantages:


1. End user Productivity 1. Cannot see the layout at design time.

2. Performance and Scalability 2. OAF Pages are integrated / compatible


only with the Oracle Apps.
3. Highly extensible Architecture
3. Drag and Drop options are not
4. These pages have only region and available.
items, so we can develop pages faster.
4. More work is required to design a
5. Transaction rate is high when form layout which is time consuming.
compared to internet.

6. Application Customizability.

19 Oracle OAF - by Dinesh Kumar S


Difference b/w OAF & Forms

Factors OAF Oracle FORMS

Architecture OAF Follows MVC and Client Server Forms Follows only Client Server
Architecture Architecture
Components These pages are light weight These are not light weight
components i.e. Implementing Look & Feel components
using Java rather than delegating to native
peer (OS).
Mobile Supported by all mobiles. Does not support mobile.
Compatibility
Look & Feel High Standard Low Standard

Application top Integrated with Java Top Integrated with Application Top

Commit Action Commit command always occurs in the The COMMIT_FORM or


Application Modules (AM) Java code. By DO_KEY(COMMIT_FORM)
this command, the data is transferred commands can be invoked by any
from OAF Cache to database. trigger that allows restricted
procedures.
Layout A page is divided into regions. Regions A form is divided into blocks; blocks
Components contain items like fields, buttons, tables, contain the fields, buttons, and other
and other components. components.

20 Oracle OAF - by Dinesh Kumar S


Overview of OA Framework

MVC Architecture
Structure in OAF
Onion Structure of OAF

21 Oracle OAF - by Dinesh Kumar S


MVC Architecture

22 Oracle OAF - by Dinesh Kumar S


About MVC:

q MVC was first introduced by Trygve Reenskaug, a Smalltalk developer at the Xerox
Palo Alto Research Center in 1979.

q It is a widely used design pattern, especially popular in graphical user interface (GUI)
programming.

q JDK & MVC combining together allows for a generic implementation of the MVC
design pattern, freeing the programmer from,

writing code that handles the registration and notification of listeners


writing getter and setter methods for the properties of models.

23 Oracle OAF - by Dinesh Kumar S


Generic MVC Model in Java

The idea behind MVC is to break up an application into three parts/elements:

Amodelthat holds part of the current state of the application.In short it


is data and its properties.

Aviewthat is, for whatever reason, interested in knowing the current


state of the application.A view registers itself with a model as alisteneron the
model. Whenever the state of a model changes, the model notifies its registered
listeners. In GUI programming, a view often does nothing more than display the
state of the model through some graphical component.

Acontrollerthat changes the properties of the model.When and how a


controller changes a property is at the discretion of the controller. In GUI
programming, a controller is often something that takes input from the user; for
example, a button or a text field

24 Oracle OAF - by Dinesh Kumar S


MVC Elements

Three major elements,

1) Model

2) View

3) Controller

A good real time example to


understand MVC model is
Binocular.

View
Controller

User Model

25 Oracle OAF - by Dinesh Kumar S


About Model

26 Oracle OAF - by Dinesh Kumar S


The entire Database related transactions in OAF pages will be taken care by the MODEL.

Model is where the application implements business logic.

Model component is implemented using BC4J (Business Component for Java).

BC4J Components Additional Components

Entity Object (EO) Callable Statement


View Objects (VO) Prepare Statement
Application Module (AM) OADB Transactions

Note** Model contains total of six components which includes BC4J components &
additional three components.

27 Oracle OAF - by Dinesh Kumar S


28 Oracle OAF - by Dinesh Kumar S
Entity Object (EO)

Entity Objects: BC4J Components

The entity objects are used if one wishes to do some insert/update operations.
It represents a Data Base Row of a table.
EO will be based on the View (Oracle View), Synonyms or Snapshots.
We need to create Entity Object if we want to perform DML operations on the
OAF Page.
All the Entity Objects end with EO.

When we create Entity Object (EO) one Subclass will generate.

RequisitionEO

29 Oracle OAF - by Dinesh Kumar S


Types of EO

PL/SQL based Entity


Java based Entity Objects
Objects
To perform the DML operations on To perform the DML operations on
the standard (Seeded) table then we the Custom table then we go for Java
go for PL/SQL based Entity Object based Entity Object

Entity Association: When Entity Association is used?

Entity Association is the relationship If we want to perform DML


between two Entity Objects having one operations on Master Detail page
common column. then we go for Entity Association.

All the Entity Association ends with If we want to know


AO (Association Object). Commoncolumn between two
tables then we will go for Entity
Entity Association i.e. Association.
POLinesAO

POHeadersEO POLinesEO
30 Oracle OAF - by Dinesh Kumar S
View Object (VO)

BC4J Components
View Objects:

View Objects are used when we want some data to be displayed on page.
They are used just for displaying purpose.
VO access the result set of a SQL statement, it can be either based on the Entity
Object or plain SQL query.
All the view objects ends with the VO.

When we create the View Object (VO) one subclass will be generated with Setters and
Getters method.

RequisitionVO

31 Oracle OAF - by Dinesh Kumar S


Types of VO

Manual VO Automatic VO Validation VO Property VO

If we are writing our own SQL query Validating data in DB i.e. using
then it will be called as Manual VO. WHERE condition in the SELECT
statement.

Automatic VO is when we select an Attributes / columns which are not DB


Entity Object automatically it will Table Columns. They are also called as
select the Query Transient attributes.

For Example, Summary columns in


reports 6i/9i/10g.

Note** when we create VO (View Object) all the table columns will be converted into attributes,
hence all columns will be referred as attributes.

32 Oracle OAF - by Dinesh Kumar S


Application Module (AM)

BC4J Components

Its a main component.


An application module is a container for related BC4J components.
All OAF pages will be attached to some application module.
It is the one which governs the entire session pool, access to database and the business
logic components.
AM is connected to Database and is responsible for commit and Rollback Transactions.
It is interface b/w Client & DB transactions.
All the application module objects end with AM.

When we create the Application Module (AM) one subclass will be generated.

RequisitionAM
33 Oracle OAF - by Dinesh Kumar S
Types of AM

Root AM Nested AM
If we are attaching AM to the If we are attaching AM to the
Main Region of the page it is called Child Region of the page it is called
Root AM. Nested AM.

RequisitionVO Root AM Main Region

StoresVO Nested AM Child Region1

MyRequisitionVO
Nested AM Child Region2

MyNotificationVO
Nested AM Child Region3
Note**
VO associated to Root AM is Global and can be used across any regions within the page.
VO associated to Nested AM is Local i.e. can be used only to Child Region it is mapped.

34 Oracle OAF - by Dinesh Kumar S


35 Oracle OAF - by Dinesh Kumar S
Statements & Transactions

Callable & Prepared Statements: Additional Components

Once a connection is obtained we can interact with the database. The


JDBCCallableStatement,andPreparedStatementinterfaces define the methods and
properties that enable you to send SQL or PL/SQL commands and receive data
from your database.

Statement Recommended Use


PreparedStatement Use when you plan to use the SQL statements many times.
The PreparedStatement interface accepts input parameters at
runtime.
CallableStatement Use when you want to access database stored procedures.
The CallableStatement interface can also accept runtime input
parameters.

OADB Transactions:

Each OAF page associates with Root AM. It contains the OADB transaction.
This OADB transaction responsible for storing the data across EO and VO's.

36 Oracle OAF - by Dinesh Kumar S


About View

37 Oracle OAF - by Dinesh Kumar S


View is the actual output of OAF page that is displayed to the user.
View is implemented using UIX Technology.
UIX (User Interface XML) is a set of technologies that constitute a framework for building web
applications. The main focus of UIX is the user presentation layer of an application, with additional
functionality for managing events and for managing the state of the application flow.
The power of UIX is that allows metadata to be translated to an HTML page for a web browser or
mobile device browsers.

HTML Format of OAF Page

Converted UI Hands the Whenever we want to move the


to X generated web.xml file into the server side , the
XML MDS repository is used to move
the web.xml file into the server.
Web.XML file
Acts like Cache file. MDS stands for Meta Data
Service and in the application top
jDeveloper Reads Metadata we will be having MDS folder.
Definitions Web bean Hierarchy When we deploy OAF pages the
Created destination path & regions will be
MDS stored in MDS Tables.
Repository Server

When a OA Page is
Requested

38 Oracle OAF - by Dinesh Kumar S


About Controller

39 Oracle OAF - by Dinesh Kumar S


The Controller's job is to translate incoming requests into outgoing responses.
It manages the flow between pages i.e. responds to the user action &
directs the application flow.
All the controllers end with CO.

When we create Controller (CO) one subclass will be generated.

ReqCheckoutPageCO

40 Oracle OAF - by Dinesh Kumar S


Controller Methods

Process Request Process Form Request


Process Form Data
(HTTP Get) (HTTP Post)

Request / Methods Description


GET Request data from specific resource. It is used while loading the
page.
POST Submit data to be processed to specific resource. After loading the
page if any changes required this is used.
Process Request While loading the page to display default items.
Process Form Request After loading the page, if we want to perform an action.
Process Form Data This page is invoked upon a browser post. In this phase the
framework will automatically applies changes back to the underlying
view objects

41 Oracle OAF - by Dinesh Kumar S


Controller Parameters

OAPageContext OAWebBean
To get and set values of the fields using, Each and every field we have
OAPageContext.getparatmeter properties and the properties define
OAPageContext.putparameter the behavior of item.

To call one page to another page. OAWebBean represents the


OAPageContext.setforwardURL Hierarchy/Structure of the
components in the page.
To redirect the current page.
OAPageContext.forwardImmediately WebBean represents the properties
ToCurrentPage (or) of item.
OAPageContext.sendRedirect
Similarly there are many methods available.

42 Oracle OAF - by Dinesh Kumar S


Structures in OAF

43 Oracle OAF - by Dinesh Kumar S


BC4J File Structure

Below are the Packages used in BC4J,

<Identifier>.oracle.apps.<application_short_name>.<component>.

Where, <idnetifier> It is the Database connection name given in connection wizard.

AM & VO

Database_Connection_Name.Oracle.Apps.PO.Use_Client_Name.Server
EO
Database_Connection_Name.Oracle.Apps.PO.Use_Client_Name.Schema.Server
LOV
Database_Connection_Name.Oracle.Apps.PO.Use_Client_Name.LOV.Server
Poplist
Database_Connection_Name.Oracle.Apps.PO.Use_Client_Name.poplist.Server
CO & Page
Database_Connection_Namee.Oracle.Apps.PO.Use_Client_Name.webui

44 Oracle OAF - by Dinesh Kumar S


Structure of OAF Page

Page Layout Region (Parent Region) Root AM CO

Child Regions

Region 1 Region 2 .. Region n


Nested AM Nested AM Nested AM CO
CO CO

Widgets

Widget 1

Widget 2
Widget 3

Widget 4
OAF Page

45 Oracle OAF - by Dinesh Kumar S


An OA Framework page has a collection of web beans or widgets like text
boxes, buttons, etc.

Each OAF page has containers called "Regions" for maintaining these widgets.

An OAF page contains single parent region called Page Layout Region and it
points to the Application module (AM) linked to that page.

Every region has a property of containing other regions and web beans.

A controller object may be defined for every region that exists on the page.

46 Oracle OAF - by Dinesh Kumar S


Processing Page Request

Page processing class 1 2 JDBC


AM Pool
Connection
oracle.apps.fnd.framework.webui.OAPageBean
R-AM 1 Pool
Determines Root AM Picks JDBC
OAF Page Based on Page Name Connection Connection 1
R-AM 2
Page Name Connection 2
Page Layout Region
CO R-AM n

Region 1 CO
Connection n
Transaction Context established
3
Request
Type
4 Check
5 Based on Request Type Request
OAPageBean Calls Code GET Type
OA Page bean in Controller to initiate each
bean & set properties
POST Based on
1. Valid Login
2. Request Parameter

47 Oracle OAF - by Dinesh Kumar S


The main OA Framework Page processing class is the
1 oracle.apps.fnd.framework.webui.OAPageBean.
This class uses the page name to determine which root AM is needed, so that
AM can be fetched from the AM pool.
The page layout region of the page actually holds the details of the AM to
which the page is attached.

2 The chosen AM picks a JDBC connection, from the JDBC Connection Pool, to
establish a transaction context for the page.

3 Transaction context for the page established.

4 Depending on the valid login and request parameters, it is decided whether the
request is a POST or a GET.

5 During both kinds of requests, the OAPageBean calls the code in the controller
to instantiate each of the beans, along with setting of their appropriate
properties. Certain methods which are not defined in the controller are also
called for instantiating complex web beans.

48 Oracle OAF - by Dinesh Kumar S


GET Request

Page processing class


5.1) When a request for a page is issued for the first
oracle.apps.fnd.framework.webui.OAPageBean time, the pages declarative metadata definition is read
to create the web bean hierarchy.
OAF Page
5.2) The OAPageBean class calls the page
Page Layout Region initialization code for the page in the following
CO manner:-
a) Calling the processRequest() function of the
Region 1 CO controller of the page layout region.
b) Calling prepareForRendering() for complex web
beans
c) Recursive calls to processRequest() for each of the
beans in the hierarchy (if the associated controller
objects are present).
5
OA Page bean 5.3) When this page processing completes, the
OAPageBean hands this processed XML to the
UIX which renders it in the form of HTML on the browser.

49 Oracle OAF - by Dinesh Kumar S


POST Request
5.1) When a submit command is fired on the
page, the POST request processing starts
with recreation of the web bean hierarchy if
oracle.apps.fnd.framework.webui.OAPageBean one is not present.

OAF Page 5.2) A call to processFormData() is made to write


the data to the model, and this method is
Page Layout Region called recursively on all the web beans
CO recursively.

5.3) All the attribute and entry level validations are


Region 1 CO
undertaken during calls to processFormData() and if
any errors exist, appropriate exceptions are fired.

5.4) A call to processFormRequest() of the


controller is made recursively for all the web
5 beans.
OA Page bean
5.5) When this page processing completes, the
OAPageBean hands this processed XML to the
UIX which renders it in the form of HTML on the
browser.

50 Oracle OAF - by Dinesh Kumar S


Interaction b/w MVC Components: Note: that the Model is not aware of the view or the
controller -- it simply broadcasts change notifications to all
interested listeners

Any change in data inside Model, immediately


2 broadcast Change Notification and any interested
listener can receive the same.

1
1 Model
User Action Performed Communication b/w
on View Registers as
View Listener
: Model View

:View CO Model

2 Controller bounded Process Flow:


To View
View invokes
registered listener 3
method in the
controller class Controller gives
reference to Model

Controller

51 Oracle OAF - by Dinesh Kumar S


Onion Structure

Data Push

Data Pull 0

Oracle OAF - by Dinesh Kumar S


52
OAF State Management

53 Oracle OAF - by Dinesh Kumar S


Root Application Module (AM) DB Session & Transaction State

Provides,

Transaction Context
OAF Page
JDBC Connection

OAF Page
Root AM
Associated with
Automatically Caches,

Core Application Data like BC4J etc.


Web Bean Hierarchy i.e.
Oracle.Apps.FND.Framework.OADBT_Transaction_Obj

Note** The use of the browser Back button can cause the loss of application module state.

54 Oracle OAF - by Dinesh Kumar S


q Any data stored on the DB transaction is accessible to all pages that share the same
root application module Instance.

q OA Framework provides methods that you can use to store, retrieve and remove
custom application values to/from a transaction.

q Since a single transaction can be accessed from both controller (client) and model
(server) code, these utilities are provided in both,

For Controller:
Oracle.apps.fnd.framework.webui.OAPageContext

For Model:
OADBTransaction classes.

55 Oracle OAF - by Dinesh Kumar S


Root Application Module (AM) Retention
Individual Pages
Page1

OAF Page
Root AM
Associated with

Instance 1

Page1

Root AM

Navigates from Page1


Page2

The application module instance Instance 2


associated with the previous page Page2
is "released," and a new instance is
requested from an application module
pool
56 Oracle OAF - by Dinesh Kumar S
Across Pages
Retaining Application Module - Across Pages

Note** OA Framework never releases application modules during form submit (POST) requests unless you
explicitly release the application module in a controller.

However, it is not appropriate for a multi-page flow that implements a single task, or a
series of related pages participating in a virtual transaction.

In these cases, the different pages should be associated with the same root application
module instance.

Page1

Root AM
Instance 1

To Achieve this :

1. The Root AM should be associated with the same Page2


Root Application module instance.
2. Set the retainAM=Y
57 Oracle OAF - by Dinesh Kumar S
Conditionally Retaining/Releasing an Application Module

We determine whether an application module should be released or not. It can be done by


using,

oracle.apps.fnd.framework.webui.OAReleaseListener interface for individual application


modules

Explicitly Releasing an Application Module

There are also times when you will want to explicitly release a root application module
before OA Framework would normally do this. This can be done by using method,

OAPageContext.releaseRootApplicationModule()

58 Oracle OAF - by Dinesh Kumar S


Root Application Module (AM) Servlet Session

A servlet session is a mechanism for maintaining state between HTTP requests


during a period of continuous interaction between a browser and a web application.

A session may be initiated at any time by the application, and terminated by the
application by the user closing the browser or by a period of user inactivity.

You have the option of caching small, serializable objects on the servlet session; any
data that you cache is accessible to all pages rendered within the session.

Servlet Session
Initiated
Cache by

Browser Web Application


59 Oracle OAF - by Dinesh Kumar S
Oracle Application User Session

User Together keep track of key Oracle Applications context


information like.
Log into current responsibility
organization id
various user attributes (such as user name, user id,
employee id and so on.)
OAF
Application

Creates

AOL/J oracle.apps.fnd.common.WebAppsContext
Objects
Browser Session Cookie

60 Oracle OAF - by Dinesh Kumar S


OAF Page Context

OA Framework
OAF Creates a
page context
User Request
OAPageContext

OAF Page

Note** the context persists until


the page get processed.

61 Oracle OAF - by Dinesh Kumar S


OAF Request

OA Framework For each http Request


Http Request Object will be created.
Object

Object contains following Application State,

Any URL parameters, regardless of whether the browser issued a POST or a GET
request.
All form field data is stored in a hidden field during POST request.
The web bean and event names associated with a user's selection of action/control
components for example when a button is clicked.

To access page context values use the below methods,


getParameter()
putParameter()
setForwardURL() etc.
62 Oracle OAF - by Dinesh Kumar S
Model Interaction

63 Oracle OAF - by Dinesh Kumar S


Note** Visualize the Onion Structure

1
G
Controller
Search Field O
2
Root AM
Initiates Query

3
SupplierVOIMPL
Database

Web Bean 4
SupplierVORowIMPL 6
5 EO Instance
SupplierEOIMPL
Created

Note** For the "calculated" attributes like Summary / Formula Column, the
view 64
object row retrieves the value from its own cache.
Oracle OAF - by Dinesh Kumar S
Controller

G
Search Field O 2

Root AM

3
DB
Table

Web Bean
4
6
5 EO Instance

Created

65 Oracle OAF - by Dinesh Kumar S


Process Flow: (in detail)

1 The user selects the "Search" region's "Go" button to populate search results in the
"Suppliers" table.

The "Search" region's controller handles the button press by invoking a search
2 method in the root application module, which in turn delegates to the
SuppliersVOImpl class so it can query itself.

Within the executeQuery method, the SuppliersVOImpl view object performs its
3 SQL SELECT in the database.

For each row returned in our example result set, the view object creates an
4 instance of a SupplierEOImpl entity object and sets its attribute values with the query
results.

Web bean will be defined for each View object Data binding. With the help of Web
5 bean it calls corresponding SuppliersVORowImpl object's getAttribute() method
is invoked..

6 The SuppliersVORowImpl getAttribute method in turn calls the corresponding


SupplierEOImpl getAttribute method to retrieve the value.

66 Oracle OAF - by Dinesh Kumar S


OAF Profile Options

67 Oracle OAF - by Dinesh Kumar S


Profile Name Profile Value

FND: Diagnostics Yes displays About this Page link at bottom of


each page.

Personalize Self-Service Defn Yes Allow Personalize page link @ right top of
each page.

68 Oracle OAF - by Dinesh Kumar S


Profile Name Profile Value

FND: Personalization Region Link Yes Displays personalize links for all the regions
Enabled available in OAF page.

Disable Self-Service Personal Yes Disables all OAF personalization in all pages
based on the profile level.

69 Oracle OAF - by Dinesh Kumar S


Profile Name Profile Value

FND: Personalization Document This is required to migrate OAF personalization. Set


Root Path a directory path details for this profile which has valid
read & write permission.

FND:OA:Enable Defaults Yes Allows item values to be defaulted from OAF


personalization.

70 Oracle OAF - by Dinesh Kumar S


jDeveloper IDE

71 Oracle OAF - by Dinesh Kumar S


About jDeveloper

Oracle JDeveloper is a free integrated development environment that simplifies the


development of Java-based SOA and Java EE applications.

Main features

Integrated enterprise development environment


Visual and declarative editors
Complete development lifecycle coverage
Built-in development framework
Advanced features for Java, Database, Web services, SOA, and Web
development

72 Oracle OAF - by Dinesh Kumar S


jDeveloper Version Information

73 Oracle OAF - by Dinesh Kumar S


1. Set profile FND: Diagnostics to enable About this Page link.

2. Log into application & Click About this Page link

3. Go to Technology Components tab and under Product/Component


Version identify the Version of OA framework.

4. Now download the jDeveloper Patch based on the OAF Version.

5. Extract the Zip.

74 Oracle OAF - by Dinesh Kumar S


Step 1:

Step 2:

75 Oracle OAF - by Dinesh Kumar S


Step 3:

76 Oracle OAF - by Dinesh Kumar S


Step 4:
Download jDeveloper from below link,

http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html

(or) Search in google type Oracle jDeveloper 12.1.X download.

Step 5: Once the Zip is extracted, it will create below 3 directories.

77 Oracle OAF - by Dinesh Kumar S


jDeveloper Installation

78 Oracle OAF - by Dinesh Kumar S


Navigate to the below link access the jDeveloper executable based on the OS
environment i.e. UNIX / Windows.

Navigation:
For UNIX

jdevbin jdev bin jdev (for UNIX)


jdevbin jdev bin jdevW (for windows)

For Windows

79 Oracle OAF - by Dinesh Kumar S


jDeveloper Configuration

80 Oracle OAF - by Dinesh Kumar S


Step 1:

Set Environment variables.

Navigation: Rt Click My Computer Properties Advance (Tab) Click


Environment Variables

Under User Variables click New

81 Oracle OAF - by Dinesh Kumar S


Provide the below details,

Variable Name: JDEV_USER_HOME


Variable Value: D:\jdevhome\jdevhome\jdev

82 Oracle OAF - by Dinesh Kumar S


Step 2:

Download the DBCFILE from oracle Server and Copy it into below folder,

Jdevhome jdev dbc_files Secure

After downloading naora1.dbc paste it in above mentioned folder.

83 Oracle OAF - by Dinesh Kumar S


Step 3:

Open jDeveloper and Create Database Connection.

Select Database Folder & Rt. Click


and select New Database
Connection

84 Oracle OAF - by Dinesh Kumar S


(or) File New Connections Database Connection

85 Oracle OAF - by Dinesh Kumar S


86 Oracle OAF - by Dinesh Kumar S
87 Oracle OAF - by Dinesh Kumar S
88 Oracle OAF - by Dinesh Kumar S
Note** cross check the connection details from DBC/TNSNAMES.ORA file.

89 Oracle OAF - by Dinesh Kumar S


Check Database connection.

90 Oracle OAF - by Dinesh Kumar S


Connection
successfully created

91 Oracle OAF - by Dinesh Kumar S


Creation of Page

92 Oracle OAF - by Dinesh Kumar S


Steps to create a Page

1. Create a Java Workspace

2. Create a Java Project

3. Create Runtime Connections

4. Design Database Connections

5. Create BC4J (Business Component for Java)

Create AM (Application Module)

6. Create a Page

7. Attach the Page to AM

8. Run the Page.


Can be setup during jDeveloper configuration (or) after project
Creation.
93 Oracle OAF - by Dinesh Kumar S
Step 1: Create Java Workspace

Navigation: File New General Workspace Configuration for Oracle Applications

94 Oracle OAF - by Dinesh Kumar S


95 Oracle OAF - by Dinesh Kumar S
Step 2: Create Java Project

96 Oracle OAF - by Dinesh Kumar S


97 Oracle OAF - by Dinesh Kumar S
98 Oracle OAF - by Dinesh Kumar S
Oracle Apps
Username & Password

Note** do not provide oracle database username password in this setup.


99 Oracle OAF - by Dinesh Kumar S
Click Finish to complete the project setup.

100 Oracle OAF - by Dinesh Kumar S


Workspace
Project

101 Oracle OAF - by Dinesh Kumar S


Step 3: Create Runtime Connections

Select the project created and Set Default Project Properties.

Tools Default project Properties.

Note** this step can be performed during jDeveloper configuration (or) after project creation.
102 Oracle OAF - by Dinesh Kumar S
Oracle apps username &
password

Click Ok to complete the configuration process.


103 Oracle OAF - by Dinesh Kumar S
OADeveloperMode provides extra code checking and standards checking at runtime.

OADiagnostic enables the Diagnostics button in the global buttons at the top of the
page, overriding any corresponding profile option set for the application.

You should always have these two modes turned on during development.

104 Oracle OAF - by Dinesh Kumar S


Step 4: Design Database Connections

Design time connection is used while building model BC4J components like EOs,VOs, AMs
etc.

We have already created the below database connections.

Note** this step can be performed during


jDeveloper configuration (or) after project
creation.

105 Oracle OAF - by Dinesh Kumar S


Step 5: Create BC4J Component Application Module

Rt. Click the Project


MyFirstPRJ and click
New.

106 Oracle OAF - by Dinesh Kumar S


Select item as Application Module

107 Oracle OAF - by Dinesh Kumar S


Select the Database
connection created and
click OK then Login
dialogue box opens as
below, click OK.

Then Application Module wizard


opens.

108 Oracle OAF - by Dinesh Kumar S


109 Oracle OAF - by Dinesh Kumar S
Note** before clicking next change the package name from .webui to .server

110 Oracle OAF - by Dinesh Kumar S


111 Oracle OAF - by Dinesh Kumar S
No changes just Click Next.
112 Oracle OAF - by Dinesh Kumar S
No changes just Click Next.

113 Oracle OAF - by Dinesh Kumar S


Click Next.

You can see AM class is created.

Note: tick checkbox Generate Java File(s) if not defaulted


manually enable it.

114 Oracle OAF - by Dinesh Kumar S


Click Finish to complete the AM setup.

115 Oracle OAF - by Dinesh Kumar S


Once the AM is
Successfully created the
below folders will be
created automatically,

Application Sources
Resources

116 Oracle OAF - by Dinesh Kumar S


Step 6: Create a Page

We have already discussed lets recall the structure of page.

Components

Components are Page, Regions, widgets/beans in a OAF Page.

117 Oracle OAF - by Dinesh Kumar S


Since Page is a component, we need to create it as OA Component. To create a
page follow below steps.

Rt. Click Resources.


Click New.

118 Oracle OAF - by Dinesh Kumar S


Web Tier OA Components Page

119 Oracle OAF - by Dinesh Kumar S


Give a name for your page and no changes in the Package section.

120 Oracle OAF - by Dinesh Kumar S


In Application Sources we can see
the Project, AM & Page details.

121 Oracle OAF - by Dinesh Kumar S


Below is the XML page structure.

122 Oracle OAF - by Dinesh Kumar S


Step 7: Attach the page to AM

Now select the xml file under


Webui hierarchy.

123 Oracle OAF - by Dinesh Kumar S


Now select the page region1.

Once it is selected we can view


the Property inspector.

124 Oracle OAF - by Dinesh Kumar S


Change the below properties,

7.1) Change the page name as your choice.

125 Oracle OAF - by Dinesh Kumar S


7.2) Now we need to select the AM from LOV

Select the AM from list of values.

126 Oracle OAF - by Dinesh Kumar S


7.3) Visual Properties

Setup the Window Title and Title details as shown above.

127 Oracle OAF - by Dinesh Kumar S


Step 8: Run the Page

Now select the xml file under


Webui hierarchy.

Save the Project.

Rt. Click MyFirstPG.xml


Click Run.

Each time you make changes to your layout (by adding regions or items, modifying properties, or
changing code), you must run your page again to see your changes. If the Run process seems to hang for
several minutes after you have already run your page previously, you may need to terminate the OC4J
server using
Run > Terminate > Embedded OC4J Server main menu option, and then run again.
128 Oracle OAF - by Dinesh Kumar S
129 Oracle OAF - by Dinesh Kumar S
Java OOPS

Note** before learning/implemen2ng CO, VO, EO etc. code, we need to know


the basics of OOPS.

130 Oracle OAF - by Dinesh Kumar S


Class & Objects
Encapsulation
Polymorphism
Method Overloading
Inheritance
Method Overriding
Abstraction
Interface
Package
Some code examples References:
http://www.studytonight.com/java/
http://www.javatpoint.com/

131 Oracle OAF - by Dinesh Kumar S


Class Implements Class 1 Same method
name with diff.
Parent parameters.
Interface Overloading

Variables F1( 1)
F1(1,2)

Methods
Inheritance F1(1,2,3)
Class 2
(Can be declare but Same method
not implemented) & definitions
Child like Parent
J Private Fields class methods
a
v F1( 1)
a F1(1,2)
O F1(1,2,3)
O Encapsulation
P Overriding
S
Abstraction Hid Class n
Imp ing Me
lem t
enta hod
Package tion
Methods
Java packages are a mechanism to groupJava
classesthat are related to each other, into the same Sub Class
"module.

132 Oracle OAF - by Dinesh Kumar S


Classes & Objects

Java classes are a mechanism used to group data and Java code together into modules".

Class
Obj
Fields

Constructor

Methods

133 Oracle OAF - by Dinesh Kumar S


Fields:
They are variables (data) that are local to the class,
or instances (object) of that class.

Constructors:
Class They are methods that initialize an instance
Obj of the class. Typically a constructor sets the
Fields values of fields in the given instance.

Constructor

Methods
Methods:
They are operations that the class or
instances of that class can perform. For
Objects: instance, a method may perform an
Objects are instances of Class. operation like validation, update/change
Object has state and behavior in Java. values etc.
State is represented using instance variable and
static variable in Java class and behaviors are
implemented using methods in Java.

134 Oracle OAF - by Dinesh Kumar S


Model and design concept:
To build a Car or Vehicle a design is created which specifies How many
gears car should have, how many seats, how it will start, stop etc. All
details of it is captured. This is a class which can be created using class
keyword in Java.

Actual cars which will be produced based upon those blueprints they are called
objects.
Class (Blue Print)

Objec
t

135 Oracle OAF - by Dinesh Kumar S


Syntax for Class Definition:

For example,

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file
then open the file again. If the red x still appears, you may have to delete the image and then insert it again. again. If the red x still appears, you may have to delete the image and then insert it again.

136 Oracle OAF - by Dinesh Kumar S


Creating Instance of Class

To create an instance of a class, you have to:


1. Declare an instance identifier (instance name) of a particular class.
2. Construct the instance (i.e., allocate storage for the instance and initialize the instance)
using the "new" operator.

137 Oracle OAF - by Dinesh Kumar S


Example

138 Oracle OAF - by Dinesh Kumar S


Encapsulation

Private Fields

Encapsulation can be described as hiding implementation details behind public


programming interface (API). In other words, the user will use the class ONLY through the
public methods (API), without knowing HOW the class works because he is not able to see and
to access class members and other class code. They are hidden from the user.

Encapsulation is to hide the class members from the class user for the reason of prevention of
unauthorized use and change.

In other words, we would hide all class variables and other piece of code to prevent someone to
access it directly.

Only thing we would expose to the user will be a public methods which he can be able to see
and use. These methods are also called as Application Programming Interface or API. An user only
needs to know how to use the class and does not need to know how that class works.

139 Oracle OAF - by Dinesh Kumar S


Example

140 Oracle OAF - by Dinesh Kumar S


Polymorphism
Class 1
Polymorphism is the ability of an object to
Parent
take on many forms.

The most common use of polymorphism in


OOP occurs when a parent class reference is
used to refer to a child class object. Inheritance
Class 2
Any Java object that can pass more than one
Child
IS-A test is considered to be polymorphic.

141 Oracle OAF - by Dinesh Kumar S


Example

142 Oracle OAF - by Dinesh Kumar S


Method Overloading

If two or more methods in a class have


same name but different parameters, it is
known as method overloading.
F1( 1)
F1(1,2)
It is one way to achieve polymorphism.
F1(1,2,3)

Different ways of Overloading:

1) By Changing No. of Arguments


2) By Changing Data type of Arguments

143 Oracle OAF - by Dinesh Kumar S


Example By Changing data type of Arguments

144 Oracle OAF - by Dinesh Kumar S


Example By Changing no. of Arguments

145 Oracle OAF - by Dinesh Kumar S


Inheritance

Inheritance allows you to define a class based on the


Parent definition of another class.

The class it inherits from is called a base class or a


parent class.

Inheritance The derived class is called a subclass or child class.

The subclass gets access to the fields and methods


Child defined by the base class.

The subclass can add its own set of fields and methods
to the set it inherits from its parent.

Each subclass provides specialized state and/or behavior


in addition to the state and behavior inherited by the
parent class.

For example, a manager is also an employee but it has a


Why use Inheritance? responsibility over a department, whereas a generic
employee does not.
For Method Overriding (So Runtime
Polymorphism).

For Code Reusability.

146 Oracle OAF - by Dinesh Kumar S


Syntax of Inheritance:

Types of Inheritance:

1. Single
2. Multi Level
3. Hierarchical

147 Oracle OAF - by Dinesh Kumar S


Example

148 Oracle OAF - by Dinesh Kumar S


149 Oracle OAF - by Dinesh Kumar S
Method Overriding

Parent

F1( 1)
F1(1,2)
Inheritance F1(1,2,3)

Child

Same method
F1( 1) & definitions
F1(1,2) like Parent
F1(1,2,3) class methods

When a method in a sub class has same name and definitions as the method in its
super class, it is known as overriding.
It is also referred as runtime polymorphism.

Note** static method cannot be overridden, because the static method is bound to class,
whereas instance method is bound to object.

150 Oracle OAF - by Dinesh Kumar S


Example

151 Oracle OAF - by Dinesh Kumar S


Abstraction

Abstract Class:

o If a Class contains any Abstract Method then the class is declared as abstract Class.
o It is never instantiated i.e. an instance of an object is not created.

Abstract Method:

o Methods that are declared without any body within abstract class is know as abstract method.
o The body of the method is defined in its Sub Class.
o Abstract Method can never be final or static.
o Any Class that extends an abstract class must implement all the abstract methods declared by the
super class.

152 Oracle OAF - by Dinesh Kumar S


Example

153 Oracle OAF - by Dinesh Kumar S


Interface

Interface
Class Implements
Variables

Methods
(Can be declare but
not implemented)

An interface is a collection of abstract methods. A class implements an interface,


thereby inheriting the abstract methods of the interface.

A class describes the attributes and behaviors of an object. An interface contains


behaviors that a class implements.

154 Oracle OAF - by Dinesh Kumar S


An interface is different from a class in several ways, including:

o You cannot instantiate an interface.


o An interface does not contain any constructors.
o All of the methods in an interface are abstract.
o It cannot contain instance fields. The only fields that can appear in an interface must be
declared both static and final.
o It is not extended by a class; it is implemented by a class.
o It can extend multiple interfaces.

155 Oracle OAF - by Dinesh Kumar S


156 Oracle OAF - by Dinesh Kumar S
Example

157 Oracle OAF - by Dinesh Kumar S


158 Oracle OAF - by Dinesh Kumar S
Package

Packages are used in Java in order to prevent naming conflicts, to control access, to
make searching/locating and usage of classes, interfaces, enumerations and annotations
easier, etc.

A Package can be defined as a grouping of related types(classes, interfaces,


enumerations and annotations ) providing access protection and name space
management.
Built-in Packages

Package Forms:

1. Built-in
2. User Defined

159 Oracle OAF - by Dinesh Kumar S


Creating Package:

Import Package:

Import package using import keyword.

160 Oracle OAF - by Dinesh Kumar S


Example

161 Oracle OAF - by Dinesh Kumar S


Example

162 Oracle OAF - by Dinesh Kumar S


Thank you for reading my e-Book, I will be publishing the next part of OAF soon. Please
share your valuable feedbacks and comments to my email.

Thanks for the websites from which I have referred Java Concepts.

163 Oracle OAF - by Dinesh Kumar S