随笔 - 571  文章 - 4  评论 - 253  阅读 - 72万

OAF_开发系列26_实现OAF中Java类型并发程式开发oracle.apps.fnd.cp.request(案例)

20150730 Created By BaoXinjian

一、摘要


并发程序调用Java类型的Concurrent Program

主要实现类

1. runProgram(CpContext cpContext):并发程序导入接口

2. cpcontext.getParameterList():获取参数Parameters Hashtable

3. cpContext.getReqCompletion(): 获取并程序运行状态设定

4. cpContext.getLogFile():输出日志

5. cpContext.getOutFile():输出报表

 

二、实现分析


1. 开发Java ConcProg的实例应用

复制代码
package bxj.oracle.apps.ap.java;

import java.util.Hashtable;

import oracle.apps.fnd.cp.request.CpContext;
import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
import oracle.apps.fnd.cp.request.LogFile;
import oracle.apps.fnd.cp.request.OutFile;
import oracle.apps.fnd.cp.request.ReqCompletion;
import oracle.apps.fnd.cp.request.ReqDetails;
import oracle.apps.fnd.util.NameValueType;
import oracle.apps.fnd.util.ParameterList;

public class runEmpConcProg implements JavaConcurrentProgram{

    private LogFile mLogFile;
    private OutFile mOutFile;
    
    // 主程序处理Employee信息
    public void processEmpInform(CpContext cpContext) {
       
        String strUserId;
        String strLoginId;
        String strRespId;
        String strRespApplId;
        String strOrgId;
        String strBeginDate;
        String p_employee_id;
        String p_country;
        ReqCompletion reqc;
        ReqDetails reqd;
       
        Hashtable hashtable = new Hashtable();
        collectParameters(cpContext, hashtable);
        
        ReqDetails mReqDetails = cpContext.getReqDetails();
        int lp_requestID = mReqDetails.getRequestId();
        try
        { 
          collectParameters(cpContext, hashtable);
          if ((hashtable.get("USERID") != null & ("".equals(hashtable.get("USERID")) ^ true)))
            strUserId = (String)hashtable.get("USERID");
          else {
            strUserId = String.valueOf(cpContext.getUserId());
          }

          if ((hashtable.get("LOGINID") != null & ("".equals(hashtable.get("LOGINID")) ^ true)))
          {
            strLoginId = (String)hashtable.get("LOGINID");
          }
          else strLoginId = String.valueOf(cpContext.getLoginId());
        
          if ((hashtable.get("RESPID") != null & ("".equals(hashtable.get("RESPID")) ^ true)))
            strRespId = (String)hashtable.get("RESPID");
          else {
            strRespId = String.valueOf(cpContext.getRespId());
          }
          if ((hashtable.get("RESPAPPLID") != null & ("".equals(hashtable.get("RESPAPPLID")) ^ true)))
            strRespApplId = (String)hashtable.get("RESPAPPLID");
          else {
            strRespApplId = String.valueOf(cpContext.getRespApplId());
          }
          strOrgId = (String)hashtable.get("ORGID");
          strBeginDate = (String)hashtable.get("BEGINDATE");
          
          if ((hashtable.get("EMPLOYEE_ID") != null & ("".equals(hashtable.get("EMPLOYEE_ID")) ^ true)))
            p_employee_id = (String)hashtable.get("EMPLOYEE_ID");
          else {
            p_employee_id = null;
          }
          
          if ((hashtable.get("COUNTRY") != null & ("".equals(hashtable.get("COUNTRY")) ^ true)))
            p_country = (String)hashtable.get("COUNTRY");
          else {
            p_country = null;
          }

          System.out.println("Parameters:" + strUserId + "/" + strLoginId + "/" 
+ strRespId + "/" + strRespApplId + "/" + strOrgId + "/" + strBeginDate); System.out.println("p_employee_id=" + p_employee_id ); System.out.println("p_country=" + p_country ); reqc = cpContext.getReqCompletion(); reqd = cpContext.getReqDetails(); cpContext.getReqCompletion().setCompletion(ReqCompletion.NORMAL, ""); } catch(Exception ex) { cpContext.getLogFile().writeln("Concurent Program Exception: " + ex.getMessage(), 1); cpContext.getReqCompletion().setCompletion(ReqCompletion.NORMAL, ""); ex.printStackTrace(); } } //获取并发程序参数 private void collectParameters(CpContext cpcontext, Hashtable hashtable) { ParameterList parameterlist = cpcontext.getParameterList(); while (parameterlist.hasMoreElements()) { NameValueType namevaluetype = parameterlist.nextParameter(); String s = namevaluetype.getName(); String s1 = namevaluetype.getValue(); this.mLogFile.writeln(s + ": " + s1, 3); if ((s1 != null) && (s1.length() > 0)) hashtable.put(s, s1); } } // 并发程式调用该Java包的接入程序RunProgram public void runProgram(CpContext cpContext) { mLogFile = cpContext.getLogFile(); mOutFile = cpContext.getOutFile(); mLogFile.writeln("Start runProgram", 0); processEmpInform(cpContext); mLogFile.writeln("END runProgram", 0); mOutFile.writeln("gavin test outfile"); } public runEmpConcProg() { } public static void main(String[] args) { System.out.println("main(String[] args"); runEmpConcProg runEmpConcProg = new runEmpConcProg(); } }
复制代码

 

2. 将编译后的class包上传到应用服务器

 

 

3.1 注册可执行程序

3.2 注册并发程序,并定义参数

 

三、运行测试


1. 调用并发程序,并输入参数

 

2. 查看并程序的Output和Log

 

3. 查看并程序的View Log

 

3. 查看并程序的View Output

 

Thanks and Regards

参考: 豆丁文库 - http://www.docin.com/p-373932599.html

posted on   东方瀚海  阅读(958)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
历史上的今天:
2014-07-22 DBA_Oracle Erp R12中文补丁安装升级(案例)

点击右上角即可分享
微信分享提示