Wednesday, 13 June 2012

call processRequest method 2nd times of the OA Page using setForwardURLCurrentPage() method


import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.framework.OAApplicationModule;
import java.sql.*;

/**
 * Controller for ...
 */
public class HumanResourceController extends OAControllerImpl
{
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);


System.out.println("I am Human Resource Page processRequest of HR page");
String eno=pageContext.getParameter("EmployeeNo");
String ena=pageContext.getParameter("EmployeeName");
String endgn=pageContext.getParameter("EmployeeDesignation");
String endv=pageContext.getParameter("EmployeeDivision");
String endp=pageContext.getParameter("EmployeeDepartment");
String encty=pageContext.getParameter("EmployeeCity");
//--------
String  empno =pageContext.getParameter("EmpNo");
String emppn=pageContext.getParameter("EmpPositionName");
String emplev=pageContext.getParameter("EmpLevel");
String  empgr =pageContext.getParameter("EmpGrade");
String empres=pageContext.getParameter("EmpResources");
String empdiv=pageContext.getParameter("EmpDivision");
String  empdeptt =pageContext.getParameter("EmpDepartment");
String empsubdeptt=pageContext.getParameter("EmpSubDepartment");
String empfun=pageContext.getParameter("EmpFunction");
String  empcty =pageContext.getParameter("EmpCity");
String emprpt=pageContext.getParameter("EmpReportTo");
String empst=pageContext.getParameter("EmpStatus");
String empct=pageContext.getParameter("EmpCaseType");
//---


String  emprno =pageContext.getParameter("EmpRno");
String emprname=pageContext.getParameter("EmpRname");
String emprdesignation=pageContext.getParameter("EmpRdesignation");
String  emprdepartment =pageContext.getParameter("EmpRdepartment");
String emprgrade=pageContext.getParameter("EmpRgrade");
String emprcity=pageContext.getParameter("EmpRcity");
String emprdol=pageContext.getParameter("EmpRdol");

//-




OAMessageTextInputBean  tibno = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("empno");
tibno.setValue(pageContext,eno);
tibno.setDisabled(true);

OAMessageTextInputBean  tibname= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("empname");
tibname.setValue(pageContext,ena);
tibname.setDisabled(true);

OAMessageTextInputBean  tibdesignation = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("empdesignation");
tibdesignation.setValue(pageContext,endgn);
tibdesignation.setDisabled(true);

OAMessageTextInputBean  tibdepartment = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("empdepartment");
tibdepartment.setValue(pageContext,endv);
tibdepartment.setDisabled(true);

OAMessageTextInputBean  tibdivision= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("empdivision");
tibdivision.setValue(pageContext,endp);
tibdivision.setDisabled(true);

OAMessageTextInputBean  tibcity = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("empcity");
tibcity.setValue(pageContext,encty);
tibcity.setDisabled(true);
//------------------------------------------------------------



OAMessageTextInputBean  tibnewno = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("newrno");
tibnewno.setValue(pageContext,empno);
tibnewno.setDisabled(true);

OAMessageTextInputBean  tibpname= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("pname");
tibpname.setValue(pageContext,emppn);
tibpname.setDisabled(true);

OAMessageTextInputBean  tibelevel = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("elevel");
tibelevel.setValue(pageContext,emplev);
tibelevel.setDisabled(true);

OAMessageTextInputBean  tibegrade = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("egrade");
tibegrade.setValue(pageContext,empgr);
tibegrade.setDisabled(true);

OAMessageTextInputBean  tiberequired= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("erequired");
tiberequired.setValue(pageContext,empres);
tiberequired.setDisabled(true);

OAMessageTextInputBean  tibedivision = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("edivision");
tibedivision.setValue(pageContext,empdiv);
tibedivision.setDisabled(true);

OAMessageTextInputBean  tibedepartment = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("edepartment");
tibedepartment.setValue(pageContext,empdeptt);
tibedepartment.setDisabled(true);

OAMessageTextInputBean  tibesubdepartment= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("esubdepartment");
tibesubdepartment.setValue(pageContext,empsubdeptt);
tibesubdepartment.setDisabled(true);

OAMessageTextInputBean  tibefunction = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("efunction");
tibefunction.setValue(pageContext,empfun);
tibefunction.setDisabled(true);

OAMessageTextInputBean  tibecity = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("ecity");
tibecity.setValue(pageContext,empcty);
tibecity.setDisabled(true);

OAMessageTextInputBean  tibereportto= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("ereporto");
tibereportto.setValue(pageContext,emprpt);
tibereportto.setDisabled(true);

OAMessageTextInputBean  tibestatus = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("estatus");
tibestatus.setValue(pageContext,empst);
tibestatus.setDisabled(true);
OAMessageTextInputBean  tibecasetype = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("ecasetype");
tibecasetype.setValue(pageContext,empct);
tibecasetype.setDisabled(true);
//------------------------------------------------------------




OAMessageTextInputBean  tibrno = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rempno");
tibrno.setValue(pageContext,emprno);
tibrno.setDisabled(true);
OAMessageTextInputBean  tibrname= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rempname");
tibrname.setValue(pageContext,emprname);
tibrname.setDisabled(true);

OAMessageTextInputBean  tibrdesignation = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rempdesignation");
tibrdesignation.setValue(pageContext,emprdesignation);
tibrdesignation.setDisabled(true);

OAMessageTextInputBean  tibrdivision = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rempdivision");
tibrdivision.setValue(pageContext,emprdepartment);
tibrdivision.setDisabled(true);

OAMessageTextInputBean  tibrgrade= (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rempgrade");
tibrgrade.setValue(pageContext,emprgrade);
tibrgrade.setDisabled(true);

OAMessageTextInputBean  tibrcity = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rempcity");
tibrcity.setValue(pageContext,emprcity);
tibrcity.setDisabled(true);

OAMessageTextInputBean  tibrdol = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("rdol");
tibrdol.setValue(pageContext,emprdol);
tibrdol.setDisabled(true);
//---------------------

  if("2".equals(pageContext.getParameter("x"))){
  OAMessageTextInputBean  tibnewno1 = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("newrno");
  tibnewno1.setDisabled(true);
  OAMessageTextInputBean  tibhrcommet1 = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("hrcomments");
  tibhrcommet1.setDisabled(true);
  OAMessageCheckBoxBean  cbhrvacan1 = (OAMessageCheckBoxBean)webBean.findIndexedChildRecursive("vacancy");
  cbhrvacan1.setDisabled(true);
  OAMessageTextInputBean  tibhrjustify1 = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("justify");
   tibhrjustify1.setDisabled(true);
     }//end if 
}

  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);

    if(pageContext.getParameter("SubmitComments")!=null){
   OAMessageTextInputBean  tibnewno = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("newrno");
   String reqno=(String)tibnewno.getValue(pageContext);

   OAMessageTextInputBean  tibhrcommet = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("hrcomments");
   String hrcoment=(String)tibhrcommet.getValue(pageContext);


   OAMessageCheckBoxBean  cbhrvacan = (OAMessageCheckBoxBean)webBean.findIndexedChildRecursive("vacancy");
   String hrvacancy=(String)cbhrvacan.getValue(pageContext);
 

   OAMessageTextInputBean  tibhrjustify = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("justify");
   String hrjustify=(String)tibhrjustify.getValue(pageContext);
 
   System.out.println("Do the Updatation regarding EmpRequisitionNo.==="+reqno);
   OAApplicationModule am=pageContext.getApplicationModule(webBean);

try{
Connection conn =am.getOADBTransaction().getJdbcConnection();
Statement stmt = conn.createStatement();
int r=stmt.executeUpdate("update employeerequisitiondetail  set commentsByDepttNHR='"+hrcoment+"',Vacancy2bAnnounced='"+hrvacancy+"',justification='"+hrjustify+"' where employeerequistionno="+reqno+" ");
                                                           
System.out.println("I am in TOP ProcessFormRequest  Succesfully if result ====="+r);
am.getOADBTransaction().commit();
stmt.close();
}catch(Exception e){System.out.println(e.toString());}

HashMap params = new HashMap();
params.put("x","2");    
pageContext.setForwardURLToCurrentPage(params, true, OAWebBeanConstants.ADD_BREAD_CRUMB_NO,OAWebBeanConstants.IGNORE_MESSAGES);
    }


   }
 
   
  }
 

No comments:

Post a Comment