Thursday, February 2, 2017

Create Simple Search form in Oracle ADF

Create Simple Search form in Oracle ADF

1. Create a New Application
New > Applications > Fusion Web Application (ADF)
Application Name – SearchForm
Directory -- (Jdev install dir)/jdeveloper/(project name) 
Application Package Prefix – Demo.adf.searchform
 

 

 

 

 

 
2. 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); 


  

3. Create EO
Right Click on Model > New > ADF Business Components > Entity Object
  

 
Package -- Demo.adf.searchform.model.entities
Name – SearchEO
Schema Object – XX_SEARCH_DEMO
Note – By default ROWID will be the primary key if we will not make any column to be primary key in Attribute Settings Page  
Check the Accessors, Create Method, and Remove Method
 

 

 

 

Check Generate Default View Object CheckBox
Package – Demo.adf.searchform.model.queries
Name – SearchVO
 
Check Application Module CheckBox
Package – Demo.adf.searchform.model.services
Name – SearchAM
 
 
 
4. Define Bind Variables
Double Click on SearchVO in Model Project go to query page
Expand the Bind variable accordion and click on Green button
 

 
Bind Variable name and type as following make sure required check box is un-checked
Name – Col1
Type -- String
 
 
5. Create Named View Criteria
Double Click on SearchVO in Model Project go to query page. Expand the View Crriteria accordion and click on Green button
 
 
View Criteria is actually conditions on VOs which you usually define declaratively
     1.      Expand the View Critieria Section in SearchVO page and click the Green plus sign
     2.      Give a proper name to your View Criteria
          Criteria Name -- SearchVOCriteria
     3.      Click on Add Item
           Click the ( ) group press Add item and select values as sown in slide make sure you have selected the bind variable Col1
          Attribute – Column1
          Operator – Equals
          Operand – Bind Variable
          Parameter – Col1
          Un-check Ignore Case and Check Ignore Null Values
 
 
6. Create Search Form
Right Click on ViewController > New > Web Tier > JSF > JSF Page
File Name – Search
Initial Page Layout and Content – Quick Start Layout
Click on Browse and select One Column Stretched and check Apply Theme
 
 
 
Expand Page Implementation and Select Automatically Expose UI Components in a New Managed Bean
Select SearchVO and Expand the Data Control panel and Drag and drop the Named View Critieria “SearchVOCriteria” to the page
Choose Query > ADF Query Panel with Table as shown in the slide
 
 
 
 
The Page would look like this --
 
 
7. Refine Layout
Change the Header from “SearchEO” to “Search Demo”. To change select panel Header and change Text property to “Simple Search Demo”
 
Note - You can change form properties like Column names and page width as per your requirements
 
8. Congratulation you have successfully finished. Test Your Work Your Simple Search Form is Ready
 
 

1 comment:

  1. http://download.oracle.com/otn_hosted_doc/jdeveloper/1012/developing_mvc_applications/adf_aoverviewadfandmvc.html

    ReplyDelete

Oracle Fusion - Cost Lines and Expenditure Item link in Projects

SELECT   ccd.transaction_id,ex.expenditure_item_id,cacat.serial_number FROM fusion.CST_INV_TRANSACTIONS cit,   fusion.cst_cost_distribution_...