package oracle.apps.ak.EmployeeRequisitonProject.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageCheckBoxBean;
import
oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageChoiceBean;
import
oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransaction;
import java.sql.*;
import java.io.Serializable;
import com.sun.java.util.collections.HashMap;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.jbo.domain.Number;
/**
* Controller for ...
*/
public class InitiateEmpReqRNMainTopController 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);
// String
existingEmpId=displayTextField.getText(pageContext);
OAApplicationModule
am=pageContext.getApplicationModule(webBean);
Serializable params[]={"1"};
am.invokeMethod("fetchExistingEmployee",params);
am.invokeMethod("getNewEmployeeData");
OAMessageTextInputBean
oatib =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpRequisitionNo");
OADBTransaction trans=am.getOADBTransaction();
Number sqnum=
trans.getSequenceValue("EMPREQUISITIONSEQUENCE");
String esn=sqnum.toString();
oatib.setText(pageContext,esn);
oatib.setDisabled(true);
Serializable params2[]={"4"};
am.invokeMethod("fetchReplacementEmployee",params2);
// get the handle of submitButton and attach the javascirpt functin to it using
setOnclick method of OASubmitButtonBean as shown below;
OASubmitButtonBean
sbButton =
(OASubmitButtonBean)webBean.findIndexedChildRecursive("SubEmpReq");
//OAMessageCheckBoxBean
hrcb =
(OAMessageCheckBoxBean)webBean.findIndexedChildRecursive("hrCheckBox");
sbButton.setOnClick("javascript:var
psname=document.getElementById('EmpPositionName').value;"+
"var
emplevel=document.getElementById('EmpLevel').value;"+
"var empgrade=document.getElementById('EmpGrade').value;"+
"var
empresreq=document.getElementById('EmpResourcesRequired').value;"+
"var
empdiv=document.getElementById('EmpDivision').value;"+
"var
empsdp=document.getElementById('EmpSubDepartment').value;"+
"var empdp=document.getElementById('EmpDepartment').value;"+
"var
empfun=document.getElementById('EmpFunction').value;"+
"var
empcity=document.getElementById('EmpCity').value;"+
"var
empreports=document.getElementById('EmpPositionReportsTo').value;"+
"if(psname==''||emplevel==''||empgrade==''||empresreq==''||empdiv==''||empsdp==''||empdp==''||empfun==''||empcity==''||empreports==''){ alert('Fill all Fields of the Postion, Level, Grade, Resources
Required, Division SubDiv,Function,city and ReportsTo before submitting the Form');"
+"document.getElementById('EmpPositionName').focus();return
(false);}return (true);");
}
/**
* 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);
OAApplicationModule
am=pageContext.getApplicationModule(webBean);
am.invokeMethod("handleUOMChangeEvent");
if(pageContext.getParameter("SubEmpReq")!=null){
System.out.println("Going to commit after if passed");
am.invokeMethod("saveEmployeeRequisition");
HashMap parameters = new HashMap();
OAMessageTextInputBean
tibempno =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeeno");
String employeeno=(String)tibempno.getValue(pageContext);
System.out.println(employeeno);
parameters.put("EmployeeNo",employeeno);
OAMessageTextInputBean
tibempname =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeename");
String
employeename=(String)tibempname.getValue(pageContext);
System.out.println(employeename);
parameters.put("EmployeeName",employeename);
OAMessageTextInputBean
tibempdesign =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeedesignation");
String
employeedesign=(String)tibempdesign.getValue(pageContext);
System.out.println(employeedesign);
parameters.put("EmployeeDesignation",employeedesign);
OAMessageTextInputBean
tibempdivision =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeedivision");
String
employeedivision=(String)tibempdivision.getValue(pageContext);
System.out.println(employeedivision);
parameters.put("EmployeeDivision",employeedivision);
OAMessageTextInputBean
tibempdepartment =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeedepartment");
String
employeedepartment=(String)tibempdepartment.getValue(pageContext);
System.out.println(employeedepartment);
parameters.put("EmployeeDepartment",employeedepartment);
OAMessageTextInputBean
tibempcity =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeecity");
String employeecity=(String)tibempcity.getValue(pageContext);
System.out.println(employeecity);
parameters.put("EmployeeCity",employeecity);
//-------------
OAMessageTextInputBean
tibno =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpRequisitionNo");
String empno=(String)tibno.getValue(pageContext);
System.out.println(empno);
parameters.put("EmpNo",empno);
OAMessageTextInputBean
tibposition =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpPositionName");
String empposition=(String)tibposition.getValue(pageContext);
System.out.println(empposition);
parameters.put("EmpPositionName",empposition);
OAMessageTextInputBean
tiblevel =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpLevel");
String emplevel=(String)tiblevel.getValue(pageContext);
System.out.println(emplevel);
parameters.put("EmpLevel",emplevel);
OAMessageTextInputBean
tibgrade =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpGrade");
String empgrade=(String)tibgrade.getValue(pageContext);
System.out.println(empgrade);
parameters.put("EmpGrade",empgrade);
OAMessageTextInputBean
tibrr =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpResourcesRequired");
String emprr=(String)tibrr.getValue(pageContext);
System.out.println(emprr);
parameters.put("EmpResources",emprr);
OAMessageTextInputBean
tibdivision =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpDivision");
String
empdivision=(String)tibdivision.getValue(pageContext);
System.out.println(empdivision);
parameters.put("EmpDivision",empdivision);
OAMessageTextInputBean
tibdepartment =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpDepartment");
String
empdepartment=(String)tibdepartment.getValue(pageContext);
System.out.println(empdepartment);
parameters.put("EmpDepartment",empdepartment);
OAMessageTextInputBean
tibsubdepartment =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpSubDepartment");
String
empsubdepartment=(String)tibsubdepartment.getValue(pageContext);
System.out.println(empsubdepartment);
parameters.put("EmpSubDepartment",empsubdepartment);
OAMessageTextInputBean
tibfunction =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpFunction");
String empfunction=(String)tibfunction.getValue(pageContext);
System.out.println(empfunction);
parameters.put("EmpFunction",empfunction);
OAMessageTextInputBean
tibcity =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpFunction");
String empcity=(String)tibcity.getValue(pageContext);
System.out.println(empcity);
parameters.put("EmpCity",empcity);
OAMessageTextInputBean
tibprt =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpPositionReportsTo");
String empprt=(String)tibprt.getValue(pageContext);
System.out.println(empprt);
parameters.put("EmpReportTo",empprt);
OAMessageChoiceBean
mcstatus =
(OAMessageChoiceBean)webBean.findIndexedChildRecursive("StatusMCL");
String empstatus=(String)mcstatus.getValue(pageContext);
System.out.println(empstatus);
parameters.put("EmpStatus",empstatus);
OAMessageChoiceBean
mccasetype =
(OAMessageChoiceBean)webBean.findIndexedChildRecursive("CaseTypeMCL");
String empcasetype=(String)mccasetype.getValue(pageContext);
System.out.println(empcasetype);
parameters.put("EmpCaseType",empcasetype);
//-----------------
OAMessageTextInputBean
tibrempno =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeeno1");
String emprno=(String)tibrempno.getValue(pageContext);
System.out.println(emprno);
parameters.put("EmpRno",emprno);
OAMessageTextInputBean
tibrname =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeereplacedname");
String emprname=(String)tibrname.getValue(pageContext);
System.out.println(emprname);
parameters.put("EmpRname",emprname);
OAMessageTextInputBean
tibrdesignation =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeedesignation1");
String
emprdesignation=(String)tibrdesignation.getValue(pageContext);
System.out.println(emprdesignation);
parameters.put("EmpRdesignation",emprdesignation);
OAMessageTextInputBean
tibrdepartment =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeedepartment1");
String
emprdepartment=(String)tibrdepartment.getValue(pageContext);
System.out.println(emprdepartment);
parameters.put("EmpRdepartment",emprdepartment);
OAMessageTextInputBean
tibrgrade =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeegrade");
String emprgrade=(String)tibrgrade.getValue(pageContext);
System.out.println(emprgrade);
parameters.put("EmpRgrade",emprgrade);
OAMessageTextInputBean
tibrcity =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeecity1");
String emprcity=(String)tibrcity.getValue(pageContext);
System.out.println(emprcity);
parameters.put("EmpRcity",emprcity);
OAMessageTextInputBean
tibrdol =
(OAMessageTextInputBean)webBean.findIndexedChildRecursive("Employeedateofleaving");
String emprdol=(String)tibrdol.getValue(pageContext);
System.out.println(emprdol);
parameters.put("EmpRdol",emprdol);
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/ak/EmployeeRequisitonProject/HumanResourcePage",null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,parameters,true,OAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBeanConstants.IGNORE_MESSAGES);
//OAApplicationModule am=pageContext.getApplicationModule(webBean);
//OAMessageCheckBoxBean hrcb =
(OAMessageCheckBoxBean)webBean.findIndexedChildRecursive("hrCheckBox");
// Object
hrstate=hrcb.getValue(pageContext);
// String
cbv=hrstate.toString();
//Serializable
params[]={cbv};
//
am.invokeMethod("handleCheckBoxChangeEvent",params);
}
}
}
No comments:
Post a Comment