Anda di halaman 1dari 15

1.

Create a New Workspace and Project

Right click Workspaces and click create new OAworkspace and name it as
PRajkumarSearch. Automatically a new OA Project is also created. Name the project as
SearchDemo and package as prajkumar.oracle.apps.fnd.searchdemo

2. Create a New Application Module (AM)

Right Click on SearchDemo > New > ADF Business Components > Application Module

Name -- SearchAM

Package -- prajkumar.oracle.apps.fnd.searchdemo.server

3. Enable Passivation for the Root UI Application Module (AM)

Right Click on SearchAM > Edit SearchAM > Custom Properties >

Name RETENTION_LEVEL

Value MANAGE_STATE

Click add > Apply > OK

4. Create Test Table and insert data some data in it (For Testing Purpose)

CREATE TABLE xx_search_demo


( -- --------------------
-- Data Columns
-- --------------------
column1 VARCHAR2(100),
column2 VARCHAR2(100),
-- --------------------
-- Who Columns
-- --------------------
last_update_date DATE NOT NULL,
last_updated_by NUMBER NOT NULL,
creation_date DATE NOT NULL,
created_by NUMBER NOT NULL,
last_update_login NUMBER
);

INSERT INTO xx_search_demo VALUES (val1, val2, SYSDATE, 0, SYSDATE, 0, 0);


INSERT INTO xx_search_demo VALUES (val1, val2, SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO xx_search_demo VALUES (val3, val4, SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO xx_search_demo VALUES (val5, val6, SYSDATE, 0, SYSDATE, 0, 0);
Now we have 4 records in our custom table

5. Create a New Entity Object (EO)

Right click on SearchDemo > New > ADF Business Components > Entity Object

Name SearchEO

Package -- prajkumar.oracle.apps.fnd.searchdemo.schema.server

Database Objects -- XX_SEARCH_DEMO

Note By default ROWID will be the primary key if we will not make any column to be
primary key Check the Accessors, Create Method, Validation Method and Remove Method

6. Create a New View Object (VO)

Right click on SearchDemo > New > ADF Business Components > View Object

Name -- SearchVO

Package -- prajkumar.oracle.apps.fnd.searchdemo.server

In Step2 in Entity Page select SearchEO and shuttle them to selected list

In Step3 in Attributes Window select columns Column1, Column2 and shuttle them to
selected list

In Java page Select Generate Java file for View Object Class: SearchVOImpl and Generate
Java File for View Row Class: SearchVORowImpl

7. Add Your View Object to Root UI Application Module

Select Right click on SearchAM > Edit SearchAM > Data Model >

Select SearchVO and shuttle to Data Model list

8. Create a New Page

Right click on SearchDemo > New > Web Tier > OA Components > Page

Name -- SearchPG

Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
9. Select the SearchPG and go to the strcuture pane where a default region has
been created

10. Select region1 and set the following properties:

ID -- PageLayoutRN

Region Style -- PageLayout

AM Definition -- prajkumar.oracle.apps.fnd.searchdemo.server.SearchAM

Window Title -- Search Page Window

Title -- Search Page

Auto Footer -- True

11. Add a Query Bean to Your Page

Right click on PageLayoutRN > New > Region

Select new region region1 and set following properties

ID QueryRN

Region Style query

Construction Mode resultBasedSearch

Include Simple Panel True

Include Views Panel True

Include Advanced Panel True

12. Add a Result Data Table to your QueryRN

Select QueryRN right click > New > Region using Wizard

In BC4J Objects page, Select your SearchAM and then select your SearchVO1

Note DO NOT select Use this as Application Module Definition for this region
checkbox

In Region Properties page, set Region ID value to ResultsTable and Region Style to
table
In view Attributes page, select attributes from Available View Attributes list and
shuttle them to

Selected View Atributes list:

Column1

Column2

In Region Items Page, you can set ID, Style and Attributes Set. Currently we are going to
set only Style as messageStyledText

13. Set and verify Your Results Table Region Properties

ID ResultsTable

Region Style table

AM Please Donot put any AM

Rendered True

Records Displayed 10

Width 100%

User Personalization True

14. Set or Verify Column1 Item Properties

Search Allowed -- True

Sort Allowed ascending

Initial Sort Seqence first

Selective Search Criteria True

User Personalization True

15. Set or Verify Column2 Item Properties

Search Allowed True

Sort Allowed -- ascending

Selective Search Criteria True

User Personalization True


16. Congratulation you have successfully finished Search page. Run Your
SearchPG page and Test Your Work
Controller Extension in OAF
By PRajkumar on Jul 15, 2012
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

Create one search page as explained in below link

https://blogs.oracle.com/prajkumar/entry/create_oaf_search_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 -- prajkumar.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
the Column1 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
value val5 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 PrajkumarCOExtensionDemo

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 -- prajkumar.oracle.apps.fnd.coextensiondemo.server

Extends -- prajkumar.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

https://blogs.oracle.com/prajkumar/entry/how_to_enable_personalization_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
at SITE 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

Anda mungkin juga menyukai