Sunday, December 29, 2013

OAF OVERVIEW

Introduction to OAF
  • Pre-requisites for learning OAF
  • OAF Architecture
  • JDeveloper tool & Versions
  • Steps to Develop/Customize of OAF pages
Registration OAF pages in Oracle  Applications11i

  • Oracle Applications Framework  is the Oracle Applications development and deployment platform for HTML-based business applications
  • OA Framework consists of a set of middle-tier runtime services and a design-time extension to Oracle9i JDeveloper called Oracle Applications Extension (OA Extension).
  • End User Productivity
  • Enterprise-Grade Performance and Scalability
  • Developer Productivity
  • Application Customizability
  • Open Standards
Pre-requisites for learning OAF

  • You need to have an Oracle Apps 11i or higher environment to play around with.
  • Basic knowledge of java is needed. Rather I would say basic knowledge of OOP [Object Oriented Programming] is needed. I mean just the concepts.
  • Understand MVC concept.

Thursday, February 7, 2013

Controller Extension in OAF


Controller Extension in OAF

Oracle does not recommend that customers extend controller objects associated with regions or webbeans in shipped E-Business Suite product pages.
Controller class (oracle.apps.fnd.framework.webui.OAControllerImpl) methods should effectively be considered private, since their implementation is subject to change. Controller extensions are therefore not considered to be durable between upgrades.
If it is absolutely essential to handle custom form submit events on a shipped product page, processFormRequest() is the only method that should be overriden in a controller class, although the risks outlined above still apply.

Let us try to Extend Controller in OAF Page –
In this exercise I am going to extend CO of SearchPG. First lets create CO for SearchPG.
Right Click PageLayoutRN under SearchPG page > Set New Controller 
Package Name -- p.oracle.apps.fnd.searchdemo.webui
Class Name --  SearchCO
Now we will extend this newly created CO under this exercise. 
The purpose of this exercise is to modify the VO query of results table. I have changed theColumn1 and Column2 fields Property Selective Search Criteria as False.
Now when we click on Go button all the records are displaying in the results table and our OBJECTIVE is to bind the VO query of results table in such a way that in result Column1 valueval5 and Column2 value val6 should not come as result on click Go button

 

Now for knowing which controller to extend we click on "About This Page" Link and select Expand All. Here we can see the Name of the controller that we need to extend



1. Create a New Workspace and Project
File > New > General > Workspace Configured for Oracle Applications
File Name – PCOExtensionDemo
Automatically a new OA Project will also be created
Project Name -- COExtensionDemo
Default Package -- prajkumar.oracle.apps.fnd.coextensiondemo

2. Create a New Java Class
Right Click on COExtensionDemo > New > General > Java Class
Name -- ExtendedCO
Package -- p.oracle.apps.fnd.coextensiondemo.server
Extends -- p.oracle.apps.fnd.searchdemo.webui.SearchCO


Note -- Give the Name of your Extended Class give its package path and in the extends property select base class


3. Write below logic in ExtendedCO Java Class
package prajkumar.oracle.apps.fnd.coextensiondemo.webui;
   
import prajkumar.oracle.apps.fnd.searchdemo.webui.SearchCO;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean;
import prajkumar.oracle.apps.fnd.searchdemo.server.SearchVOImpl;

public class XXItemSearchCO extends ItemSearchCO
{
 public XXItemSearchCO()
 {
 }
      
 public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
 {
  super.processFormRequest(pageContext, webBean);
  OAApplicationModule am = pageContext.getApplicationModule(webBean);
  OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN");
   
  //Capturing Go Button ID
  String go = queryBean.getGoButtonName();
          
  //If its Not NULL which mean user has pressed "Go" Button
  if(pageContext.getParameter(go)!=null)
  {
   // Setting whereClause at Runtime to restrict the query
   SearchVOImpl vo = (SearchVOImpl)am.findViewObject("SearchVO1");
   vo.setWhereClause(null);
   vo.setWhereClause("Column1 <>:1 AND Column2 <>:2");
   vo.setWhereClauseParam(0,"val5");
   vo.setWhereClauseParam(1,"val6");
  }
 }
}

4. Attach new controller to SearchPG through personalization
Click on Personalize Page link on top right hand side of your page


Note -- If you are not able to see this link then go through below link –


Click on Complete View -> Expand All -> Click on personalize icon next to Page Layout


Now at site level give the path of extended controller as we are extending the controller atSITE LEVEL
prajkumar.oracle.apps.fnd.coextensiondemo.webui.ExtendedCO


Click Apply -> Return to Application

5. Congratulation you have successfully finished. Run Your SearchPG page and Test Your Work


Click Go
Note – Record with Column1 value val5 and Column2 value val6 is not coming in result


VO Extesnion


We are going to extend SearchVO of SearchPG page. Our business requirement is to addCreation Date attribute in the results table region


1. Analyze the Page
Click on “About this Page” link to check that which ViewObject is associated with the table region [ResultsRN]




Here we can see that results table has SearchVO attached to it. Now click on Business Component Reference details and check the path of SearchVO


Now click on SearchVO which is an EO based [SearchEO] to check whether it has Creation Date attribute or not which we want to add


Here we can see that our VO does not have CreationDate attribute.
So for adding this attribute we need to perform VO Extension.
FTP this project from application server and open in JDeveloper

2. Create a New View Object (VO)
Right click on SearchDemo > New > ADF Business Components > View Object
Package -- prajkumar.oracle.apps.fnd.searchdemo.server
Name – ExtSearchVO
Extends -- prajkumar.oracle.apps.fnd.searchdemo.server.SearchVO


The next screen allows the addition or deletion of Entity Objects. No change is required here for this extension so simply select Next


The next pane allows additional attributes to be added or attributes to be removed. In this case add CreationDate attributes to the selected list

Note -- Please note the new attribute you would be adding will be coming as Transient

Click on Next -> Next


Modify above SQL statement with below SQL to add new attribute CREATION_DATE

SELECT  SearchEO.COLUMN1,
                SearchEO.COLUMN2,
                SearchEO.ROWID,
                SearchEO.CREATION_DATE
FROM     XX_SEARCH_DEMO     SearchEO

Click on Next -> Next
Generate ExtSearchVORowImpl 


Click Finish


Note -- Now as our attribute created as Transient hence to fix this issue we have two options:
1. We need to correct our XML file generated as it is a known error with Jdeveloper
2. Double click on that attribute i.e CreationDate and in the View Object Attribute window, enter attribute name in 'Expression' column i.e. CreationDate

Lets try first method --
Open your ExtSearchVO.xml file in some notepad editor.
Scroll to bottom of that file
Update

with


3. Substitute your New VO with parent VO
Right click on SearchDemo > Project Properties > Business Components > Substitutions
In Available list select SearchVO and in Substitute list select New VO ExtSearchVO and click on Add and then Ok


4. After substitution import *.jpx
In our case it will modify SearchDemo.jpx at project location i.e. --D:\xxxx\jdevhome\jdev\myclasses
Open Command Prompt and go to following location of your project
D:\xxxx\jdevbin\oaext\bin


5. Personalize the page to create new item
On SearchPG click on Personalize Page link
Select Complete View Radio Button


Click on Create Item on Table: (ResultTable)


Set item style as messageStyledText
Set Following Properties
Id – CreationDateId
Data Type -- Date
Prompt – Creation Date
View Instance – ExtSearchVO1
View Attribute – CreationDate


Click Apply > Return to Application

6. Congratulation you have successfully finished. Run Your SearchPG page and Test Your Work
Note -- You can notice page has new Column with name Creation Date



Tuesday, July 24, 2012

OAF OVERVIEW

Introduction to OAF
  • Pre-requisites for learning OAF
  • OAF Architecture
  • JDeveloper tool & Versions
  • Steps to Develop/Customize of OAF pages
Registration OAF pages in Oracle  Applications11i

  • Oracle Applications Framework  is the Oracle Applications development and deployment platform for HTML-based business applications
  • OA Framework consists of a set of middle-tier runtime services and a design-time extension to Oracle9i JDeveloper called Oracle Applications Extension (OA Extension).
  • End User Productivity
  • Enterprise-Grade Performance and Scalability
  • Developer Productivity
  • Application Customizability
  • Open Standards
Pre-requisites for learning OAF

  • You need to have an Oracle Apps 11i or higher environment to play around with.
  • Basic knowledge of java is needed. Rather I would say basic knowledge of OOP [Object Oriented Programming] is needed. I mean just the concepts.
  • Understand MVC concept.
OAF Architecture

  • Model View Controller ( MVC), its over view
  • Overview of Model
  • The Model is where the application implements its business logic
  • The model component is implemented using the BC4J.BC4J Consists of three components
  •          Entity Object and Associations.
  •          View Object and View Link objects.
  •          Application Module.
  • Entity Object and Associations : Entity Objects represents a database row in middle-tire. Database rows are represented as individual entities, in which attributes typically corresponds to columns in the corresponding table to automatically implement queries,inserts,updates and deletes.
  •      Entity objects can also be based on views, synonyms or snapshots.
  •     most  entity objects that you create subclass that:
  •     oracle.apps.fnd.framework.server.OAEntityImpl;
  •    Associations are used to establish the relationship between the entity objects.
  •    When you create an entity object, framework will provide you a java class with the setter and getter methods corresponding to each column of the table to which you are entity object is based on.
View Objects

  •          view object access the result set of a sql statement. It can be either based on the entity object or on plain sql query. All view objects that you create subclass the
  •           Oracle.apps.fnd.framework.server.OAViewObjectImpl.
Application Module

  •     A logical container that manages and provides access to related BC4J model objects. All application modules that you create subclass the       Oracle.apps.fnd.framework.server.OAApplicationModuleImpl
  • The View :
  •     The OA Framework View is implemented using UI XML (UIX). UIX uses XML to describe the components and hierarchy that make up an application page. UIX also provides runtime capabilities to translate that metadata into HTML output so that it can be shown on a Browser or a mobile device.
  •    The metadata used to describe the UI is loaded into a database repository, called Meta Data Services (MDS), at deployment time and optionally at design time as well.
  • The Controller:
  •   The Controller responds to user action and direct aplication flow. It provides the writing between the UIX web bean and the middle-tier.All the controllers that we create subclass the oracle.apps.fnd.framework.webui.OAControllerImpl.
  •     The controller will request from HTTP Get and Http Post.
  • Controller Methods  
  •      Process Request
  •      Process Form Data
  •      Process Form Request
  • Process Request:
  •     This phase is invoked upon a browser ‘Get’ or redirect/forward. This is where custom code can call the application module to intialize and query the data. this phase may optionally construct or modify the web beans to create or alter the page structure and web bean properties.
  • Process Form Data:
  •     This phase is invoked upon a browser ‘post’. During this phase the framework will automatically applies form changes back to the underlying view objects. Rarely custom code required in this phase. if exceptions are thrown during  this phase, the process form request phase is skipped and the page is redisplayed.
  • Process Form Request:
  •      This phase is invoked upon a browser ‘post ‘, assuming no exceptions were thrown during the process form data phase. This is were custom code can handle the submit events call the application module to process the event.
Framework passes two parameters OA PageContext and OAWebBean
Usage of OA PageContext:

  • To get and set values of the fields, using oapagecontext.getparameter and oapagecontext.putparameter.
  • For redirecting to the current page or anotherpage, for example to redirecting to current page itself use oapagecontext.forwardimmediatelyToCurrentpage. Or you may use oapagecontext.sendRedirect.
Usage of OAWebBean:
    Remember that webbean represents the hierarchy/structure of components in the page.Hence using this parameter object, you can get a handle to any bean/component in that page hierarchy.once you have a handle to that bean(say field bean or button bean), you can then invoke methods like set Rendered etc to change the behaviour of page at runtime.some examples are
       1. OA WebBean  LastName=oawebbean.findindexedChildRecursive(“personlastname”);
      2. OAStackLayoutBean oastack=oawebbean.findindexedChildRecursive(“stackRegionName”);




Onion Structure of OAF


BC4J File Structures:

  • AM AND VO -> BC4J
XXAAM.oracle.apps.po.xxname.server

  • Entity Object(EO) -> BC4J
XXAAM.oracle.apps.po.xxname.schema.server

  • LOV ->BC4J
XXAAM.oracle.apps.po.xxname.LOV.server

  • Poplist ->BC4J
XXAAM.oracle.apps.po.xxname.poplist.server

  • Controller & Page
XXAAM.oracle.apps.po.xxname.webui
JDeveloper tool & Versions:

  • Jdeveloper9i is tool to develop OAF pages as well as customizations.
  • p4045639_11i_GENERIC – download this patch from oracle metalink.
  • We have three folders jdevbin,jdevdoc,jdevhome in that patch.
  • Setting up jdeveloper into your workstation.
Development of OAF Pages.
    • Creating Simple Page.
    • Creating Hellow World Page.
    • Some sample example Pages.
    • Search Page     
    • Automatic Search.
    • Manual Search.
    • Creating LOV.
    • Creating Dropdown list.
Create Page

  • How to Use java Based EO.
  • How to Use PL/SQL Based EO.
  • Update Page
  • How to use SPEL.
  • Delete Page
  • How to create Dialog box in OAF.
  • How to call oracle Sql and PL/SQL in OAF
  • Prepare Statement.
  • Callable Statement.
  • Calling Oracle APIS.
Deploying OAF Pages into Application

  • Transferring the related source code/files to the Oracle APPS environment.
  • Importing the new directory structure/path of the page/form in the MDS repository.
  • Registration of the page in the Oracle Apps environment