2014-06-02 BaoXinjian
一、摘要
实现OAF的删除功能delete
二、案例
需求:实现删除功能
1. 建立Delete按钮的连接
2. 修改VO,增加按钮
3. 在SearchInvoiceCO.java中添加如下方法
4. 在InvoiceAM中添加如下方法
三、案例实现
1. 建立Delete按钮的连接
2. 修改VO,增加按钮
3. 在SearchInvoiceCO.java中添加如下方法
1 public void processFormRequest(OAPageContext pageContext,OAWebBean webBean) { 2 3 super.processFormRequest(pageContext, webBean); 4 5 /**按下删除发票Button,触发AM中的AmDeleteInvoice方法**/ 6 7 if ("delete".equals(pageContext.getParameter(EVENT_PARAM))) { 8 9 OAApplicationModule am = pageContext.getApplicationModule(webBean); 10 11 String InvoiceId = pageContext.getParameter("InvoiceId"); 12 13 Serializable[] parameters = { InvoiceId }; 14 15 am.invokeMethod("AmDeleteInvoice", parameters); 16 17 } 18 19 }
4. 在InvoiceAM中添加如下方法
1 /**删除Invoice**/ 2 3 public void AmDeleteInvoice(String InvoiceId) { 4 5 int InvoiceIdToDelete = Integer.parseInt(InvoiceId); 6 7 OAViewObject vo = (OAViewObject)getInvoiceSummaryVO1(); 8 9 InvoiceSummaryVORowImpl row = null; 10 11 int fetchRowCount = vo.getFetchedRowCount(); 12 13 System.out.print("bxj_count" + fetchRowCount); 14 15 RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter"); 16 17 if (fetchRowCount > 0) { 18 19 deleteIter.setRangeStart(0); 20 21 deleteIter.setRangeSize(fetchRowCount); 22 23 for (int i = 0; i < fetchRowCount; i++) { 24 25 row = (InvoiceSummaryVORowImpl)deleteIter.getRowAtRangeIndex(i); 26 27 Number primaryKey; 28 29 primaryKey = row.getInvoiceId(); 30 31 if (primaryKey.compareTo(InvoiceIdToDelete) == 0) { 32 33 row.remove(); 34 35 getTransaction().commit(); 36 37 break; 38 39 } 40 41 } 42 43 } 44 45 deleteIter.closeRowSetIterator(); 46 47 }
Thanks and Regards
OAF_OAF增删改-删除的实现(案例),布布扣,bubuko.com
原文:http://www.cnblogs.com/eastsea/p/3764054.html