Anil's Blog is Best Viewed on GOOGLE CHROME

Friday, September 24, 2010

Controller Extension in R12 - OAF

Controller/CO Extension - Jdev10G


Thanks Ajay for giving such a nice article 

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.


In this exercise I am going to extend CO of  ItemSearchPG of Lab solutions exercise shipped with Jdev Tutotrial.

The purpose of this exercise  is to modify the VO query of results table. I have changed the Item Number field Property "Selective Search" 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 Results name should not contain record for Item Number 3

If "About this Page" link is not available on page then set the Profile Option: FND :Diagnostics to "Yes" at User Level.
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.

So open Jdeveloper and create New OA Workspace and new Project under it as shown in below screen shots.

Click on File à New to open this window

Give the Workspace Name as OAExtenstions , check on Add a New Project and click Ok. 


This cause Project creation wizard to open. Name the project as OAExtensionsPrj and Default Package as xx.oracle.apps.fnd.framework.toolbox.labsolutions



Click on Next and move to Step 3 of 3 Give your DBC file name, User Name & Password for Apps , Responsibility Name and Application Short name. Then click next.



Now Right click on Your project and select New à General à Java Class click ok



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

Important : You need to copy the class file mentioned in Extends Property to MyClasses Folder if it is not there.

Name       :        XXItemSearchCO
Package   :        xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui
Extends    :        oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO



Write the logic in the extended controller file as needed
package xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui;

import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.toolbox.labsolutions.server.ItemSummaryVOImpl;
import oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean;


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 
         ItemSummaryVOImpl vo = (ItemSummaryVOImpl)am.findViewObject("ItemSummaryVO1");
         vo.setWhereClause(null);
         vo.setWhereClause("Item_id <>:1");
         vo.setWhereClauseParam(0,3);
         }
     }
}


Now we need to attach this new controller with the page through personlisation. So click on Personalize page link on top right hand side of your page. If you are not able to see this link set Profile Option "Personalize Self-Service Defn"  to Yes.



Click on Complete View à Expand All and click on personalize icon next to pageLayoutRN



Now at site level give the path of extended controller as we are extending the controller at SITE LEVEL


Click on Apply Button and Return to Application.

Now you can check by click on Go Button that you are not getting Item id 3 rest are there.




That all ... :)







3 comments:

  1. Hi,

    Very nice article !! Thumbs up !!!

    Can this method can be used to disable reject button on notifications? for example appraisal notifications?

    Regards,
    Hassan

    ReplyDelete
  2. Hi I am new to OAF,

    But this article gives good information about Extension.

    ReplyDelete

Note: Only a member of this blog may post a comment.