DAY 3 & 4
1. Create a BC4J package - oracle.apps.ak.schema.server
2. Create an EO Object EmployeesNewEO based on the Table employees_new
3. Create a BC4J package - oracle.apps.ak.employeecreate.server
4. Create a VO EmployeesNewVO based on the EO EmployeesNewEO in the
package
oracle.apps.ak.employeecreate.server
5. Create an AM EmployeeCreateAM in oracle.apps.ak.employeecreate.server
6. Associate EmployeesNewVO with EmployeeCreateAM
7. Create a page EmployeeCreatePG in the package
oracle.apps.ak.employeecreate.webui
8. Set the AM property of EmployeeCreatePGPageLaout region to
EmployeeCreateAM
9. Set the Window Title and Title property of PageLaout region to Create Page
10. use the Wizard to create a Form with Region Style as ‘header’
11. Add the following items as ‘SubmitButton’
a. New
b. Save
c. Cancel
12. Add a controller to the EmployeeCreatePGPageLaout region
a. Name :EmployeeCreateCO
13. Add the following code to demonstrate the Submit button handling
public void processFormRequest(OAPageContext pageContext, OAWebBean
webBean)
{
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("New")!=null){
System.out.println("New Button Pressed");
}
}
14. Add the following method to the AM EmployeeCreateAM
public void createButtonMethod(){
EmployeesNewVOImpl employeeVO =
(EmployeesNewVOImpl)getEmployeesNewVO1();
employeeVO.executeQuery();
EmployeesNewVORowImpl row =
(EmployeesNewVORowImpl)employeeVO.createRow();
employeeVO.insertRow(row);
employeeVO.setCurrentRow(row);
getOADBTransaction().postChanges();
}
15. Use the Sequence employee_new_seq to populate the employee id
public void create(AttributeList attributeList)
{
super.create(attributeList);
Number employeeId =
getOADBTransaction().getSequenceValue("employee_new_seq");
setEmployeeId(employeeId);
}
16. public void processFormRequest(OAPageContext pageContext, OAWebBean
webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModuleImpl am =
(OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("New")!=null){
System.out.println("New Button Pressed");
am.invokeMethod("createButtonMethod");
}
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
17. Controller
if(pageContext.getParameter("New")!=null){
System.out.println("New Button Pressed");
am.invokeMethod("createButtonMethod");
}
if(pageContext.getParameter("Save")!=null){
System.out.println("Save Button Pressed");
am.invokeMethod("saveMethod");
}
18.Create oracle.apps.ak.lov.server BC4J package
19.Create a VO ManagerLovVO in oracle.apps.ak.lov.server package with Query
select last_name , employee_id , email from employees_new
20.Create a LOV region in the package oracle.apps.ak.lov.webui
Make the scope of LOV region as Public
21.Right click on the LOV region to create a table using the Wizard – Select the
EmployeesNewVO and add the Columns – LastName , Email and EmployeeId
22.Make the LOV fields as Search allowed as TRUE
23.make manager id Field on the Page as MessageLovInput and Associate the LOV
region we created as an External LOV region
24.Create the following LOV mapping
:Base Item : ManagerId
Lov region Item : EmployeeId
Criteria Item : ManagerId
-----------------------------------------------------------------
25.Create a Result Based Search Page – EmployeesSearchPG on the VO
EmployeesNewVO1
oracle.apps.ak.employeecreate.webui
Set the AM of the page and ‘Title and Window title’
Add a Query region to the Page . and Set the following attributes as shown
26. Create a Column in EmployeSearchPG with type as Image name
updateicon_enabled.gif
Destination URI :
OA.jsp?page=/oracle/apps/ak/employeecreate/webui/
UpdateEmployeePG&retainAM=Y&EMP_ID={$EmployeeId}
27.Create a Update page – UpdateEmployeePG and use a wizard to create an update
Form .
Associtate with AM and set ‘Window Title and Title’
Create a CO for UpdateEmployeePG as UpdateEmployeeCO in the package
oracle.apps.ak.employeecreate.webui
add a submitButton – with name as ‘Update’ .
28. Add the following method to EmployeeNewAMImpl.java
public void updateMethod(){
getOADBTransaction().commit();
}
public void findByEmpId(String empId){
EmployeesNewVOImpl employeeVO =
(EmployeesNewVOImpl)getEmployeesNewVO1();
employeeVO.setWhereClause(null);
employeeVO.setWhereClause("EMPLOYEE_ID='"+empId+"'");
employeeVO.executeQuery();
}
29.Add the below code to UpdateEmployeeCO
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
System.out.println("Employe Id :"+pageContext.getParameter("EMP_ID"));
String empid = pageContext.getParameter("EMP_ID");
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("findByEmpId", new String[]{empid});
}
import oracle.apps.fnd.framework.OAApplicationModule;
30.Add the following piece of code to processFormRequest method of the
UpdateEmployeeCO
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
public void processFormRequest(OAPageContext pageContext, OAWebBean
webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("Update")!=null){
am.invokeMethod("updateMethod");
pageContext.setForwardURL("OA.jsp?page=/oracle/apps/ak/employeecreate/
webui/EmployeeSearchPG",null,OAWebBeanConstants.KEEP_MENU_CONTEXT
,null,null,true,OAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBea
nConstants.IGNORE_MESSAGES);
}
}
Day 5
pageContext.setForwardURL(
"OA.jsp?page=/oracle/apps/ak/employeecreate/webui/EmployeeSearchPG"
,null // functionName
,OAWebBeanConstants.KEEP_MENU_CONTEXT // menuContextAction
,null // menuName
,null // parameters
,true // retainAM
,OAWebBeanConstants.ADD_BREAD_CRUMB_YES // addBreadCrumb
,OAWebBeanConstants.IGNORE_MESSAGES // messagingLevel
);
31. Add a Item in EmployeeSearchPG with item style as image and
Image URI : deleteicon_enabled.gif
Add Fire action to Delete Button
Add the following parameters to the Delete button
Name :DELETE_EMP_ID
Value : ${oa.EmployeesNewVO1.EmployeeId}
32.Add deleteEmployee method to the EmployeeNewAMImpl
public void deleteEmployee(String empId){
EmployeesNewVOImpl employeeVO =
(EmployeesNewVOImpl)getEmployeesNewVO1();
employeeVO.setWhereClause(null);
employeeVO.setWhereClause("EMPLOYEE_ID='"+empId+"'");
employeeVO.executeQuery();
EmployeesNewVORowImpl row =
(EmployeesNewVORowImpl)employeeVO.first();
if(row!=null){
row.remove();
}
getOADBTransaction().commit();
employeeVO.setWhereClause(null);
employeeVO.executeQuery();
}
32. Create a Controller for the EmployeeSearchPG in the package
oracle.apps.ak.employeecreate.webui
Name :EmployeesSearchCO
33.Make the Foll changes to EmploeesSearchCO.java
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("DELETE_EMP_ID")!=null)
{
System.out.println("Employe Id :"+pageContext.getParameter("DELETE_EMP_ID"));
String empid = pageContext.getParameter("DELETE_EMP_ID");
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("deleteEmployee", new String[]{empid});
}
}