Monday, 18 September 2017

Controller Extension in OAF



Set the values of following profiles to enable Personalization Page link in OAF Pages


Profile Name
Value


FND: Personalization Region Link Enabled
Yes


Personalize Self-Service Defn
Yes


Disable Self-Service Personal
No



Oracle does not recommend that customers extend controller objects associated with regions or web beans 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 overridden in a controller class, although the risks outlined above still apply.


Let us try to Extend Controller in OAF Page –



In this exercise we are going to extend CO of SearchPG.


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.

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 – MahiCOExtensionDemo

Automatically a new OA Project will also be created Project Name -- COExtensionDemo

Default Package -- Mahi.oracle.apps.fnd.coextensiondemo.webui




2. Create a New Java Class

Right Click on COExtensionDemo > New > General > Java Class

Name -- ExtendedSearchCO

Package -- Mahi.oracle.apps.fnd.coextensiondemo.webui


Extends -- Mahi.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 ExtendedSearchCO Java Class

package Mahi.oracle.apps.fnd.coextensiondemo.webui;

import Mahi.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 Mahi.oracle.apps.fnd.searchdemo.server.SearchVOImpl;

public class ExtendedSearchCO extends SearchCO

{
public ExtendedSearchCO ()
{
}

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.


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 at SITE LEVEL

Mahi.oracle.apps.fnd.coextensiondemo.webui.ExtendedSearchCO

By defaylt it will come as Inherit

Click Apply -> Return to Application.



Click Go

Note – Record with Column 1 value val5 and Column 2 value val6 is not coming in result.










No comments:

Post a Comment