Tuesday, June 19, 2012

Manual Search Page:


Manual Search Page:

Manual Search Page Steps:

1)      Create the page as the normal way like create jws, jpr, bc4js, AM, page etc…. .
2)      Create one EO BC4J under that BC4J create EO.->Right click of the BC4J select New Entity Object.
EX: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.
Note : for Manual search no need to create Entity Object. Just for explaining how to create EO based VO.
3)      Then create VO based on EO. Create new VO under particular(VO) BC4J, there you can shuffle the EO (which you created in 2nd step) into selected side.
4)      Click next twice and query automatically will generate , if you want to change you select expert mode checkbox and you can change the query. Amend the where clause like below example.
      Ex: SELECT DepartmentEO.DEPT_ID,
       DepartmentEO.DEPTNO,
       DepartmentEO.DEPTNAME,
       DepartmentEO.LOCATION,
       DepartmentEO.CREATED_BY,
       DepartmentEO.CREATION_DATE,
       DepartmentEO.LAST_UPDATED_BY,
       DepartmentEO.LAST_UPDATE_DATE,
       DepartmentEO.LAST_UPDATE_LOGIN
FROM Department DepartmentEO
WHERE DepartmentEO.DEPTNAME LIKE NVL(:1,DepartmentEO.DEPTNAME)
AND DepartmentEO.LOCATION LIKE NVL(:2,DepartmentEO.LOCATION)
 
5)      Then finish the creation VO.
6)      Add this VO into AM.

7)      Then design the page , create 3 regions 1 for getting page items, 2 for getting buttons and, 3 for table region for displaying results when you press the go button.

8)      Select AMimpl class file to write logic like below.

public int deptsearchparams(OAPageContext pageContext, OAWebBean webBean)
{
int flag=0;
String Dname = "";
String Location ="";

DeptSearchVOImpl vo= getDeptSearchVO1();

if(pageContext.getParameter("DeptName")!=null && !pageContext.getParameter("DeptName").equals(""))
{
  Dname=pageContext.getParameter("DeptName").toString();

  vo.setWhereClauseParam(0,Dname);
  flag=1;
}

else
{
  vo.setWhereClauseParam(0,null);
}
  if(pageContext.getParameter("Location")!=null && !pageContext.getParameter("Location").equals(""))
{
  Location=pageContext.getParameter("Location").toString();

  vo.setWhereClauseParam(1,Location);
  flag=2;
}
else
{
  vo.setWhereClauseParam(1,null);
}
System.out.println("the flag value is"+flag);
return flag;

}

9)      Create Controller under pageLayouot region to handle the go button events and call the logic from AM. Follow logic below.
  
    if(pageContext.getParameter("Go")!=null)
    {
   
    XXnewAMImpl am=(XXnewAMImpl)pageContext.getApplicationModule(webBean);
   
    int fg=am. deptsearchparams (pageContext, webBean);
    if(fg==0)
    {
      am.getDepartmentVO1().setWhereClauseParam(0,"-gfdgdjghdj");
      am.getDepartmentVO1().setWhereClauseParam(1,"hkdffhkdkhgkk");
      throw new OAException("please select atleast one search criteria",OAException.ERROR);
     
    }
    else
    {
    am.getDepartmentVO1().executeQuery();
    }
  }

10)  Then run the page to test the Manual search page.












No comments:

Post a Comment