ADF Custom Search Page through Operator Bindings
This article will guide you in developing an ADF page to search records based on the user-provided input.
Below are the sequential steps to create an ADF application
1. Create an Application by following the wizard
package tgr.oracle.apps.fnd.CustomSearchPG.model.services;
import oracle.jbo.ViewCriteria;
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.server.ViewObjectImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Wed Apr 22 19:22:29 EDT 2020
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class AppModuleImpl extends ApplicationModuleImpl {
/**
* This is the default constructor (do not remove).
*/
public AppModuleImpl() {
}
/**
* Container's getter for XxEmployeeInfoView1.
* @return XxEmployeeInfoView1
*/
public ViewObjectImpl getXxEmployeeInfoView1() {
return (ViewObjectImpl)findViewObject("XxEmployeeInfoView1");
}
public void SearchCriteria(int BuId)
{
ViewObjectImpl vo= this.getXxEmployeeInfoView1();
ViewCriteria vc =vo.getViewCriteria("XxEmployeeInfoViewCriteria"); // criteria name
vo.setNamedWhereClauseParam("BuId", BuId); // pass the variable name defined in the criteria
vo.applyViewCriteria(vc);
vo.executeQuery();
}
}
Creating the operator binding for the methods which has been created in Application module to implement view criteria
Once Binding created, access the values in manage bean and perform the search operations
Below is the manage bean code.
package tgr.oracle.apps.fnd.CustomSearchPG;
import java.util.Map;
import javax.faces.event.ActionEvent;
import oracle.adf.model.BindingContext;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
public class ManageBean {
public ManageBean() {
}
private int BusinessUnitId;
// Bindings declaration
BindingContext bctx =BindingContext.getCurrent();
BindingContainer bc=bctx.getCurrentBindingsEntry();
public void SearchBtnEvt(ActionEvent actionEvent) {
// Add event code here...
OperationBinding ob =bc.getOperationBinding("SearchCriteria");
Map m = ob.getParamsMap();
m.put("BuId",BusinessUnitId);
ob.execute();
}
public void setBusinessUnitId(int BusinessUnitId) {
this.BusinessUnitId = BusinessUnitId;
}
public int getBusinessUnitId() {
return BusinessUnitId;
}
}
Provide business unit id and click on the search button to find the relevant records in the result table
Below are the sequential steps to create an ADF application
1. Create an Application by following the wizard
Once the application is created, the next step is to create the Entity object, View Object, and Application Module
2. Create a Bind Variable and View criteria in View Object, follow the below screenshot.
Bind Variable -- "BuId" created in below screenshot
After the bind variable created, the next step is to create view criteria which will ensure records are filtering based on the bind parameter
3. Call the newly created view criteria as a method in Application module java code, For instance look into the highlighted below code
package tgr.oracle.apps.fnd.CustomSearchPG.model.services;
import oracle.jbo.ViewCriteria;
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.server.ViewObjectImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Wed Apr 22 19:22:29 EDT 2020
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class AppModuleImpl extends ApplicationModuleImpl {
/**
* This is the default constructor (do not remove).
*/
public AppModuleImpl() {
}
/**
* Container's getter for XxEmployeeInfoView1.
* @return XxEmployeeInfoView1
*/
public ViewObjectImpl getXxEmployeeInfoView1() {
return (ViewObjectImpl)findViewObject("XxEmployeeInfoView1");
}
public void SearchCriteria(int BuId)
{
ViewObjectImpl vo= this.getXxEmployeeInfoView1();
ViewCriteria vc =vo.getViewCriteria("XxEmployeeInfoViewCriteria"); // criteria name
vo.setNamedWhereClauseParam("BuId", BuId); // pass the variable name defined in the criteria
vo.applyViewCriteria(vc);
vo.executeQuery();
}
}
Now shuttle this Method to the right to create an interface class
The newly added method should appear in Data Control as shown in below screenshot
4. Create a page by adding Input text, button and Result set table as shown in below snippet
All components will be added on the page, next step is to create map this fields to manage bean
Creating the operator binding for the methods which has been created in Application module to implement view criteria
Click on Ok to create Operator Binding.
Create value binding for Business unit
Once Binding created, access the values in manage bean and perform the search operations
Below is the manage bean code.
package tgr.oracle.apps.fnd.CustomSearchPG;
import java.util.Map;
import javax.faces.event.ActionEvent;
import oracle.adf.model.BindingContext;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
public class ManageBean {
public ManageBean() {
}
private int BusinessUnitId;
// Bindings declaration
BindingContext bctx =BindingContext.getCurrent();
BindingContainer bc=bctx.getCurrentBindingsEntry();
public void SearchBtnEvt(ActionEvent actionEvent) {
// Add event code here...
OperationBinding ob =bc.getOperationBinding("SearchCriteria");
Map m = ob.getParamsMap();
m.put("BuId",BusinessUnitId);
ob.execute();
}
public void setBusinessUnitId(int BusinessUnitId) {
this.BusinessUnitId = BusinessUnitId;
}
public int getBusinessUnitId() {
return BusinessUnitId;
}
}
Provide business unit id and click on the search button to find the relevant records in the result table
Comments
Post a Comment