OAF_OAF增删改-新增的实现(案例)
2014-09-14 Created By BaoXinjian
一、匯總
????1.建立SearchInvoicePG對應的Create按鈕以跳轉到Create頁面
????2.?SearchInvoiceCO.java中添加如下方法
????3.?建立CreateInvoicePG,設定Button Region和Main Region
????4.?CreateInvoiceCO.java中添加如下方法
????5. 在InvoiceAM中添加如下方法
????6.?CreateInvoiceCO.java中添加如下方法
????7. 在InvoiceAM中添加如下方法
????8.?SearchInvoiceCO.java中添加如下方法
?
二、分步解析
1.建立SearchInvoicePG對應的Create按鈕以跳轉到Create頁面
????
?
2.?SearchInvoiceCO.java中添加如下方法
public void processFormRequest(OAPageContext pageContext,OAWebBean webBean) { super.processFormRequest(pageContext, webBean);/**按下創建發票Button,頁面跳轉至創建發票頁面**/if (pageContext.getParameter("Create") != null) {pageContext.setForwardURL("OA.jsp?page=/oracle/apps/bxj/ap/invoice/webui/CreateInvoicePG",null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null, null, true,OAWebBeanConstants.ADD_BREAD_CRUMB_YES,OAWebBeanConstants.IGNORE_MESSAGES);}}?
?
3.?建立CreateInvoicePG,設定Button Region和Main Region
????
?
4.?CreateInvoiceCO.java中添加如下方法
public void processRequest(OAPageContext pageContext, OAWebBean webBean) {super.processRequest(pageContext, webBean);/**初始化頁面,調用創建Row的方式**/if (!pageContext.isBackNavigationFired(false)) {TransactionUnitHelper.startTransactionUnit(pageContext, "CreateInvoiceTxn");if (!pageContext.isFormSubmission()) {OAApplicationModule am = pageContext.getApplicationModule(webBean);am.invokeMethod("AmCreateInvoice");}} else {if (!TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"CreateInvoiceTxn",true)) {OADialogPage dialogPage = new OADialogPage(NAVIGATION_ERROR);pageContext.redirectToDialogPage(dialogPage);}}OAApplicationModule am = pageContext.getApplicationModule(webBean);am.invokeMethod("AmCreateInvoice", null);}?
?
5. 在InvoiceAM中添加如下方法
/**創建Invoice,初始化頁面創建Row以存放資料**/public void AmCreateInvoice() {OAViewObject vo = (OAViewObject)getInvoiceCreateVO1();vo.setMaxFetchSize(0);vo.executeQuery();Row row = vo.createRow();vo.insertRow(row);row.setNewRowState(Row.STATUS_INITIALIZED);}?
?
6.?CreateInvoiceCO.java中添加如下方法
public void processFormRequest(OAPageContext pageContext,OAWebBean webBean) {super.processFormRequest(pageContext, webBean);/**按下確定Button后,調用創建Invoice的AM 方法**/OAApplicationModule am = pageContext.getApplicationModule(webBean);if (pageContext.getParameter("Apply") != null) {OAViewObject vo = (OAViewObject)am.findViewObject("CreateInvoiceVO1");am.invokeMethod("AmCreateApply", null);TransactionUnitHelper.endTransactionUnit(pageContext,"CreateInvoiceTxn");pageContext.forwardImmediately("OA.jsp?page=/oracle/apps/bxj/ap/invoice/webui/SearchInvoicePG",null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null, null, true,OAWebBeanConstants.ADD_BREAD_CRUMB_NO);} else if (pageContext.getParameter("Cancel") != null) {am.invokeMethod("AmCreateRollback", null);TransactionUnitHelper.endTransactionUnit(pageContext, "CreateInvoiceTxn");pageContext.forwardImmediately("OA.jsp?page=/oracle/apps/bxj/ap/invoice/webui/SearchInvoicePG",null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true,OAWebBeanConstants.ADD_BREAD_CRUMB_NO);} }?
?
7. 在InvoiceAM中添加如下方法
/**創建Invoice,將資料做Commit**/public void AmCreateApply() {getTransaction().commit();}?
?
8. SearchInvoiceCO.java中添加如下方法
public void processRequest(OAPageContext pageContext, OAWebBean webBean) {super.processRequest(pageContext, webBean);/**從創建Invoice頁面跳轉至查詢Invoice頁面時,檢查Create Invoice資料是否被Commit**/OAApplicationModule am = pageContext.getApplicationModule(webBean);if (TransactionUnitHelper.isTransactionUnitInProgress(pageContext,"CreateInvoice",false)) {am.invokeMethod("AmCreateRollback");TransactionUnitHelper.endTransactionUnit(pageContext, "CreateInvoiceTxn");}}?
Thanks and Regards
?
總結
以上是生活随笔為你收集整理的OAF_OAF增删改-新增的实现(案例)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: windows 2008创建群集“xxx
- 下一篇: 常见问题kernel调优