Update Page in OA Framework:
Update Page Steps:
1)
Create the page as the normal way like create
jws, jpr, bc4js, AM, page etc…. .
2)
EO should be mandatory to develop the update
page.
3)
Create the EO which
table you want to update the records through page.
4)
Create the BC4J for
EO and develop the EO.
Ex: xxaam.oracle.apps.po.autosearch.schema.server
and xxxEO.
5)
Then create VO based on EO. Create a new VO
under particular(VO) BC4J, there you can
Shuffle the EO (which you created in 2nd step) into selected
side
6)
Add above VO into AM.
7)
Select the search page, there select table
region and create one item and style as image.
8)
In the image properties a) image uri as updateicon_enabled.gif
b)Action Type as fire action. In the parameter window -> id = pdeptid value -> ${oa.SearchVO1.DeptId}.
9)
Create the update page with appropriate
records. And Buttons.
10)
Create Controller under pageLayouot region to
handle the go button events and call the logic from AM. Follow logic below.
Process request:
if(pageContext.getParameter("pdeptid")!=null)
{
String
deptid=pageContext.getParameter("pdeptid").toString();
String
whereclause="DEPT_ID='"+deptid+"'";
am.getCreateVO1().setWhereClauseParams(null);
am.getCreateVO1().setWhereClause(whereclause);
am.getCreateVO1().executeQuery();
}
Process Form request:
If
(pageContext.getParameter("Save")!=null)
{
am.getOADBTransaction().commit();
}
Create the table and synonym example:
Create table
modpos.DEPARTMENT(DEPT_ID number PRIMARY KEY,
DEPTNO VARCHAR2(50),
DEPTNAME VARCHAR2(100),
LOCATION
VARCHAR2(100),
CREATED_BY NUMBER,
CREATION_DATE Date,
LAST_UPDATED_BY NUMBER,
LAST_UPDATE_DATE Date,
LAST_UPDATE_LOGIN NUMBER)
CREATE SYNONYM DEPARTMENT FOR
modpos.DEPARTMENT
Create the Sequene with example:
create sequence DEPT_DEPT_ID_SEQ
Start with 1 increment by 1
Grant all on DEPT_DEPT_ID_SEQ to
apps
create sequence DEPT_DEPT_ID_SEQ
Start with 4 increment by 1 cus
Grant all on DEPT_DEPT_ID_SEQ to
apps cus
Create synonym DEPT_DEPT_ID_SEQ for
cus.DEPT_DEPT_ID_SEQ apps
Call one OAF page from another
OAF page Syntax:
if
(pageContext.getParameter("Create")!=null)
{
pageContext.setForwardURL("OA.jsp?page=rajesh/oracle/apps/po/dept/webui/DepartmentCreationPage",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
false, // Retain
AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrums
OAWebBeanConstants.IGNORE_MESSAGES);
}
Follow Bc4j for each object:
Ø
AM AND VO -> BC4J
XXAAM.oracle.apps.po.xxname.server
Ø
Entity Object(EO) -> BC4J
XXAAM.oracle.apps.po.xxname.schema.server
Ø
LOV ->BC4J
XXAAM.oracle.apps.po.xxname.LOV.server
Ø
Poplist ->BC4J
XXAAM.oracle.apps.po.xxname.poplist.server
Ø
Controller,Page & Region
XXAAM.oracle.apps.po.xxname.webui
Delete
page steps
1)
For delete
no need to create any pages.
2)
Select
search page , in table region you create one item and style as image. Below set
of properties needs to set for this image.
Image Uri - deleteicon_enabled.gif
Action Type – fireAction
Event - Any Name
(delete)
Parameter window:SPEL
Name – DeptId
Value - ${oa.SearchVO1.DeptId}
3)
write the
delete login AM, start with creating
method ->
public void deletedepartment(String departmentid)
{
// First, we need to find
the selected Program in our VO.
// When we find it, we
call remove( ) on the row which in turn
// calls remove on the
associated ModposVendorProgsImpl object.
int
deptidtodelete=Integer.parseInt(departmentid);
SearchVOImpl
vo=getSearchVO1();
SearchVORowImpl
row=null;
// This tells us the
number of rows that have been fetched in the
// row set, and will not
pull additional rows in like some of the
// other "get
count" methods.
int fetchedrowcount
=vo.getFetchedRowCount();
System.out.println("Fetched Row Count is"+fetchedrowcount);
// We use a separate
iterator -- even though we could step through the
// rows without it --
because we don't want to affect row currency.
RowSetIterator
deleteiter=vo.createRowSetIterator("deleteiter");
if (fetchedrowcount
>0)
{
deleteiter.setRangeStart(0);
deleteiter.setRangeSize(fetchedrowcount);
for (int
i=0;i<fetchedrowcount;i++)
{
row=(SearchVORowImpl)deleteiter.getRowAtRangeIndex(i);
// For
performance reasons, we generate ViewRowImpls for all
// View Objects. When
we need to obtain an attribute value,
// we use the named
accessors instead of a generic String lookup.
Number
deptid=row.getDeptId();
if(deptid.compareTo(deptidtodelete)==0)
{
// This performs
the actual delete.
row.remove();
getOADBTransaction().commit();
break;
}
}
}
deleteiter.closeRowSetIterator();
}
4)
Call that
delete even tin Controller like below. Below logic having how to create
OADialog box in OA Framework.
if
("delete".equals(pageContext.getParameter(EVENT_PARAM)))
{
// The user has clicked
a "Delete" icon so we want to display a "Warning"
// dialog asking if she
really wants to delete the employee. Note that we
// configure the dialog
so that pressing the "Yes" button submits to
// this page so we can
handle the action in this processFormRequest( ) method.
String DeptId = pageContext.getParameter("DeptId");
OAException mainMessage
= new OAException("POS","xxx");
// Note that even
though we're going to make our Yes/No buttons submit a
// form, we still need
some non-null value in the constructor's Yes/No
// URL parameters for the buttons to
render, so we just pass empty
// Strings for this.
OADialogPage
dialogPage = new OADialogPage(OAException.WARNING,
mainMessage, null,
"", "");
// Always use Message
Dictionary for any Strings you want to display.
String yes =
pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
String no =
pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
// We set this value
so the code that handles this button press is
// descriptive.
dialogPage.setOkButtonItemName("DeleteYesButton");
// The following
configures the Yes/No buttons to be submit buttons,
// and makes sure that
we handle the form submit in the originating
// page (the
"Employee" summary) so we can handle the "Yes"
// button selection in
this controller.
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
// Now set our Yes/No
labels instead of the default OK/Cancel.
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
// The OADialogPage
gives us a convenient means
// of doing this. Note
that the use of the Hashtable is
// most appropriate for
passing multiple parameters. See the OADialogPage
// javadoc for an
alternative when dealing with a single parameter.
Hashtable formParams =
new Hashtable();
formParams.put("DeptId", DeptId);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
}
else if
(pageContext.getParameter("DeleteYesButton") != null)
{
// User has confirmed
that she wants to delete this employee.
// Invoke a method on
the AM to set the current row in the VO and
// call remove() on
this row.
String DeptId =
pageContext.getParameter("DeptId");
Serializable[]
parameters = { DeptId };
// OAApplicationModule am =
pageContext.getApplicationModule(webBean);
am.invokeMethod("deletedepartment", parameters);
// Now, redisplay the
page with a confirmation message at the top. Note
// that the
deleteComponent() method in the AM commits, and our code
// won't get this far
if any exceptions are thrown.
OAException message =
new OAException("POS","xxxxxxxx",
null,OAException.CONFIRMATION,null);
pageContext.putDialogMessage(message);
}
}
Emp advance table row
public void createemp()
{
EmployeeCreationVOImpl vo=
getEmployeeCreationVO1();
DepartmentCreationVOImpl
vo1= getDepartmentCreationVO1();
OADBTransaction
tr=getOADBTransaction();
vo.setMaxFetchSize(0);
Row row1=vo.createRow();
vo.insertRow(row1);
row1.setNewRowState(Row.STATUS_INITIALIZED);
Number empid=tr.getSequenceValue("EMPLOEE_EMP_ID_SEQ");
vo.getCurrentRow().setAttribute("EmployeeId",empid);
String
departmentid=vo1.getCurrentRow().getAttribute("DeptId").toString();
vo.getCurrentRow().setAttribute("DeptId",departmentid);
}
if
(ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
{
am.invokeMethod("createemp");
}
Thanks for the detailed explanation.It is really very helpful
ReplyDeleteVery Nice and detailed explanation , keep doing the good work
ReplyDeleteRespect and that i have a keen present: Where To Start Renovating House whole house renovation
ReplyDelete