欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

OAF_OAF增删改-新增的实现(案例)

发布时间:2024/4/13 编程问答 37 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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增删改-新增的实现(案例)的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。