OAF_开发系列13_实现OAF通过Vector动态查询设置(案例)

简介: 20150715 Created By BaoXinjian 一、摘要 Oracle OAF Guide上介绍的标准客制化查询的方式,在多条件下进行查询 具体实现步骤如下 Step1.在controler中的processRequest 的方法中调用 (1).

20150715 Created By BaoXinjian

一、摘要


Oracle OAF Guide上介绍的标准客制化查询的方式,在多条件下进行查询

具体实现步骤如下

Step1.在controler中的processRequest 的方法中调用

(1). am.invokeMethod("vectorQuery", parameters);

(2). 当然要调用invokeMethod方法先要 OAApplicationModule am = pageContext.getApplicationModule(webBean) 来实例化am;、;

(3). initDetails是写在AM的java 文件的中的一个方法,parameters可以用pageContext.getParameters 方法得到你想要的任何参数;

Step2. 在AM的java文件中写一个vectorQuery方法函数,来调用VO中的方法。

Step3. 在VO中添加下面的代码,这个代码是从OAF的UG里面拿出来的,我觉得这段代码比较的经典,以后在开发中会不断的用到;

 

二、实现方式


1.  创建查询页面如下,新增按钮SearchEmployee,并触发时间Search

 

2. 在CO中新增方法,获取Search时间,并调换用AM中的实现方法

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    
    if ("Search".equals(pageContext.getParameter(EVENT_PARAM))) {
        String p_employee_num = pageContext.getParameter("EmployeeNumQ");
        String p_employee_name = pageContext.getParameter("EmployeeNameQ");
        String p_employee_country = pageContext.getParameter("EmployeeCountryQ");
        Serializable[] params = {p_employee_num, p_employee_name, p_employee_country};
        OAApplicationModule am = pageContext.getApplicationModule(webBean);
        am.invokeMethod("vectorQuery",params);
    }  
}

 

3.  在AM中创建实现方法,最为关键的一步

public void vectorQuery(String p_employee_num, String p_employee_name, String p_employee_country) {
   
   //VO初始化
   EmployeesVOImpl employeevo = this.getEmployeesSearchVO();
   
   //参数初始化
   StringBuffer whereClause = new StringBuffer(100);
   Vector parameters = new Vector(3);
   int clauseCount = 0;
   int bindCount = 0;
   
   //加入第1个条件Employee Num
   if ((p_employee_num != null) && (!("".equals(p_employee_num.trim()))))
   {
     whereClause.append(" EMPLOYEE_NUM like :");
     whereClause.append(++bindCount);
     parameters.addElement("%" + p_employee_num + "%");
     clauseCount++;
   }
   
   //加入第2个条件Employee Name
   if ((p_employee_name != null) && (!("".equals(p_employee_name.trim()))))
   {
     if (clauseCount > 0) {
       whereClause.append(" AND ");
     }
     whereClause.append(" EMPLOYEE_NAME like :");
     whereClause.append(++bindCount);
     parameters.addElement( "%" + p_employee_name + "%");
     clauseCount++;
   }
   
   //加入第3个条件Employee Country
   if ((p_employee_country != null) && (!("".equals(p_employee_country.trim()))))
   {
     if (clauseCount > 0) {
       whereClause.append(" AND ");
     }
     whereClause.append(" EMPLOYEE_COUNTRY like :");
     whereClause.append(++bindCount);
     parameters.addElement("%" + p_employee_country + "%");
     clauseCount++;
   }
   
   //VO查询WhereCause和Parameters赋值
   employeevo.setWhereClause(whereClause.toString());
   if (bindCount > 0) {
     Object[] params = new Object[bindCount];
     parameters.copyInto(params);
     employeevo.setWhereClauseParams(params);
   }
 
   //进行查询
   employeevo.executeQuery();

}

 

三、测试运行


Test1. 打开测试页面

 

Test2. 进行查询,资料顺利查出

 

Thanks and Regards

参考:http://shaofeng.blog.51cto.com/3392077/655682

ERP技术讨论群: 288307890
技术交流,技术讨论,欢迎加入
Technology Blog Created By Oracle ERP - 鲍新建
相关文章
|
测试技术
OAF_开发系列04_实现OAF查询4种不同的实现方式的比较和实现(案例)
2014-06-02 Created By BaoXinjian 一、摘要 OAF实现查询功能或需求,一般都会采用以下四种方式 (1). ResultBasedSearch 最简单的实现方式,将结果中某些栏位需要查询的栏位的属性search设定为true即可 (2).
1801 0
|
关系型数据库 Oracle
OAF_开发系列14_实现OAF代码动态新增控件
dERP技术讨论群: 288307890 技术交流,技术讨论,欢迎加入 Technology Blog Created By Oracle ERP - 鲍新建
1151 0
|
SQL Oracle 关系型数据库
OAF_开发系列10_实现OAF动态LOV设定
20150712 Created By BaoXinjian 一、摘要 要在OAF中动态创建LOV的功能是很复杂的一件事,本文所讲述的动态LOV创建场合用于事先不能知道页面上会有多少个LOV,而且LOV所使用的SQL查询,也是由用户交互而获得的。
940 0
OAF_OAF控件系列9 - Description Flexfiled描述性弹性域的实现(案例)
2014-06-17 Created By BaoXinjian 一、摘要 OAF的弹性域的实现基本和Form的弹性域实现的大体思路是一致的,在注册Table和弹性域完全一样,之后通过控件去实现具体的弹性域显示 Form的弹性域初始化基本都在trigger when-new-form-ins...
1151 0
OAF_开发系列06_实现OAF属性集的介绍和开发Attribute Set(案例)
20150705 Created By BaoXinjian 一、摘要 EBS OAF开发中属性集(Attribute Set)的介绍和手工实现。 在OAF开发中就和Form开发中一样,有时也要给一些对象设置统一的特定属性。
1436 0
|
SQL 数据库
OAF_开发系列03_实现OAF如何在保存前判断数据是否存在变更(案例)
2014-06-26 Created By BaoXinjian 一、摘要 在OAF的开发中,可能有这样的需求,在选择保存按钮时,如果存在改动的数据,则提交事务,保存到数据库中; 如果不存在改动的数据,就提示用户当前没有数据可更改; 解决时需要判断页面中所使用的视图对象是否发生过改动,存在多种方法   1. 调用OADBTransaction.isDirty()方法 此方法用于判断当前事务中,视图对象是否发生过变更。
1213 0
|
Oracle 关系型数据库
OAF_开发系列20_实现OAF打印功能
ddddd   添加一个页面级的button区域:pagebuttonBar,在之下添加button item ,这里主要设置的参数有:采用默认的oaf的打印按钮的id名称: IcxPrintablePageButton,设置属性集为:/oracle/apps/fnd/attributesets...
1204 0
|
XML JSON 前端开发
【Django学习笔记 - 18】:drf请求响应简介、基类(APIView、GenericAPIView)、mixin扩展类与三级视图、视图集与路由
【Django学习笔记 - 18】:drf请求响应简介、基类(APIView、GenericAPIView)、mixin扩展类与三级视图、视图集与路由
232 0
【Django学习笔记 - 18】:drf请求响应简介、基类(APIView、GenericAPIView)、mixin扩展类与三级视图、视图集与路由
|
缓存 前端开发 数据库
【Django学习笔记 - 18】:drf请求响应简介、基类(APIView、GenericAPIView)、mixin扩展类与三级视图、视图集与路由2
【Django学习笔记 - 18】:drf请求响应简介、基类(APIView、GenericAPIView)、mixin扩展类与三级视图、视图集与路由
182 0
【Django学习笔记 - 18】:drf请求响应简介、基类(APIView、GenericAPIView)、mixin扩展类与三级视图、视图集与路由2
|
Oracle Java 关系型数据库
OAF_OAF增删改-新增的实现(案例)
2014-09-14 Created By BaoXinjian 一、汇总     1.建立SearchInvoicePG对应的Create按钮以跳转到Create页面     2. SearchInvoiceCO.
1225 0

热门文章

最新文章