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.message.OAMessageChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.jbo.ViewObject;
import oracle.jbo.Row;
//import oracle.jbo.AttributeDef;
/**
* Controller for ...
*/
public class EmpRequisitionController 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);
}
/**
* 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("ShowExistingEmp")!=null){
System.out.println("Show Existing Employee Button Put Logic");
OAMessageTextInputBean oatib = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpNo");
String empno=oatib.getText(pageContext);
//getting the handle of displaytextFields(i.e OAMessageStyledTextBean) from OAPage
OAMessageStyledTextBean oamstName = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpName");
OAMessageStyledTextBean oamstDesignation = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpDesignation");
OAMessageStyledTextBean oamstDepartment = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpDepartment");
OAMessageStyledTextBean oamstDivision = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpDivision");
OAMessageStyledTextBean oamstCity = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpCity");
//getting the handle of ApplicationModule AM
OAApplicationModule am= pageContext.getApplicationModule(webBean);
// sql select query for the View Object to be executed
String sqlStr = "SELECT * FROM emprequisition ";
//create ViewObject Dynamically give it the name "A"
ViewObject vo = am.createViewObjectFromQueryStmt("a",sqlStr);
// set where clause(EMPID the name of Column in DB and empno.value comming from OAPage) of sql for View Object by Passing Dynamically the value of EmpNo textfield on OAPage
vo.setWhereClause("EMPID="+empno+" ");
System.out.println(empno);
//Create the Row object by calling the vo.next() function give us the Row Object
Row row = vo.next();
// Extracting the Column form the VO using row object by specifing respectively ColumnNames in row.getAttribute function give the vlaue of the field.
String name=(String )row.getAttribute("EMPNAME");
// passing the name retrived from db and it set for display on OA page using setText method of OAMessageSyteldTextBean on OA Page along with pagecontext passed.
oamstName.setText(pageContext,name);
String designation=(String )row.getAttribute("EMPDESIGNATION");
oamstDesignation.setText(pageContext,designation);
String department=(String )row.getAttribute("EMPDEPARTMENT");
oamstDepartment.setText(pageContext,department);
String division=(String )row.getAttribute("EMPDIVISION");
oamstDivision.setText(pageContext,division);
String location=(String )row.getAttribute("EMPLOCATION");
oamstCity.setText(pageContext,location);
}
if(pageContext.getParameter("AmendRequisition")!=null){
System.out.println("Amend Record Button Put Logic");
}
}
}
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.message.OAMessageChoiceBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.jbo.ViewObject;
import oracle.jbo.Row;
//import oracle.jbo.AttributeDef;
/**
* Controller for ...
*/
public class EmpRequisitionController 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);
}
/**
* 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("ShowExistingEmp")!=null){
System.out.println("Show Existing Employee Button Put Logic");
OAMessageTextInputBean oatib = (OAMessageTextInputBean)webBean.findIndexedChildRecursive("EmpNo");
String empno=oatib.getText(pageContext);
//getting the handle of displaytextFields(i.e OAMessageStyledTextBean) from OAPage
OAMessageStyledTextBean oamstName = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpName");
OAMessageStyledTextBean oamstDesignation = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpDesignation");
OAMessageStyledTextBean oamstDepartment = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpDepartment");
OAMessageStyledTextBean oamstDivision = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpDivision");
OAMessageStyledTextBean oamstCity = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("EmpCity");
//getting the handle of ApplicationModule AM
OAApplicationModule am= pageContext.getApplicationModule(webBean);
// sql select query for the View Object to be executed
String sqlStr = "SELECT * FROM emprequisition ";
//create ViewObject Dynamically give it the name "A"
ViewObject vo = am.createViewObjectFromQueryStmt("a",sqlStr);
// set where clause(EMPID the name of Column in DB and empno.value comming from OAPage) of sql for View Object by Passing Dynamically the value of EmpNo textfield on OAPage
vo.setWhereClause("EMPID="+empno+" ");
System.out.println(empno);
//Create the Row object by calling the vo.next() function give us the Row Object
Row row = vo.next();
// Extracting the Column form the VO using row object by specifing respectively ColumnNames in row.getAttribute function give the vlaue of the field.
String name=(String )row.getAttribute("EMPNAME");
// passing the name retrived from db and it set for display on OA page using setText method of OAMessageSyteldTextBean on OA Page along with pagecontext passed.
oamstName.setText(pageContext,name);
String designation=(String )row.getAttribute("EMPDESIGNATION");
oamstDesignation.setText(pageContext,designation);
String department=(String )row.getAttribute("EMPDEPARTMENT");
oamstDepartment.setText(pageContext,department);
String division=(String )row.getAttribute("EMPDIVISION");
oamstDivision.setText(pageContext,division);
String location=(String )row.getAttribute("EMPLOCATION");
oamstCity.setText(pageContext,location);
}
if(pageContext.getParameter("AmendRequisition")!=null){
System.out.println("Amend Record Button Put Logic");
}
}
}
No comments:
Post a Comment