08-How to invoke Application Module Impl Java file's method from Controller Java File in Oracle OAF?

 Suppose we have the below method in our Application Module Impl file:

    public void filterOrder(String orderNumber,String orgName){
        //Get Handle of the view object
        ManualSearchVOImpl manualSearchVo=getManualSearchVO();
        
        //Set where clause to the view object
        manualSearchVo.setWhereClause("order_number = nvl(:1,order_number) and org_name = nvl(:2,org_name) ");
        
        //Set the where clause parameters 
        manualSearchVo.setWhereClauseParam(0,orderNumber);
        manualSearchVo.setWhereClauseParam(1,orgName);
        
        //Execute this where clause now
        manualSearchVo.executeQuery();
    } 

Note: Here ManualSearchVO is added to the application module

To run this method from Controller File use the below code.

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) {
        super.processFormRequest(pageContext, webBean);
        OAApplicationModule am = 
        (OAApplicationModule)pageContext.getApplicationModule(webBean);

        //Below code will be executed when GoBtn is clicked
        if (pageContext.getParameter("GoBtn") != null) {
            String orderNumber = pageContext.getParameter("OrderNumberTxt");
            String orgName = pageContext.getParameter("OrgNameTxt");

            //Serialize the parameters to send to Application Module Impl file
            Serializable params[] = { orderNumber, orgName };

            //Call the Application Module Impl file's function
            am.invokeMethod("filterOrder", params);
        }
}


Comments