ORACLE EBS :Oracle.apps.fnd.cp.request 并发常用JAVA方法
来源:互联网 发布:航运货代 知乎 编辑:程序博客网 时间:2024/05/18 00:36
日志打印
package com.xxt.ebs.request;import java.io.File;import javax.xml.parsers.SAXParser;import javax.xml.parsers.SAXParserFactory;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.util.NameValueType;import oracle.apps.fnd.util.ParameterList;public class CUX_REQUEST_OUTPUT_EXCEL implements JavaConcurrentProgram{ public void runProgram(CpContext ctx) { ParameterList lPara = ctx.getParameterList(); ReqCompletion lrc = ctx.getReqCompletion(); LogFile LOG_FILE = ctx.getLogFile(); String paramName = ""; String paramValue = ""; int request_id = -1; String excelType = ""; String outFile = ""; String fileName = ""; try { //Loger.init(ctx.getLogFile()); while (lPara.hasMoreElements()) { NameValueType nvt = lPara.nextParameter(); paramName = nvt.getName(); paramValue = nvt.getValue(); if ("REQUEST_ID".equals(paramName.toUpperCase().trim())) { request_id = Integer.parseInt(paramValue); //Loger.log("参数:request_id = " + request_id); LOG_FILE.writeln("参数:request_id = " + request_id, 0); } else if ("EXCEL_TYPE".equals(paramName.toUpperCase().trim())) { excelType = paramValue; //Loger.log("参数:excel_type = " + excelType); LOG_FILE.writeln("参数:excel_type = " + excelType, 0); } else if ("OUT_FILE".equals(paramName.toUpperCase().trim())) { outFile = paramValue; //Loger.log("参数:out_file = " + outFile); LOG_FILE.writeln("参数:out_file = " + outFile, 0); } else if ("FILE_NAME".equals(paramName.toUpperCase().trim())) { fileName = paramValue; //Loger.log("参数:file_name = " + fileName); LOG_FILE.writeln("参数:file_name = " + fileName, 0); } } //Loger.log("开始生成Excel输出.."); LOG_FILE.writeln("开始生成Excel输出..", 0); if ("".equals(outFile)) { LOG_FILE.writeln("请求:" + request_id + ",无法找到输出文件..",0); //Loger.release(); lrc.setCompletion(1, "No output file!!!"); } else { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); Xml2ExcelHandler h = new Xml2ExcelHandler(fileName, excelType); parser.parse(outFile, h); String fileSize = String.valueOf(new File(fileName).length()); LOG_FILE.writeln("fileName=[" + fileName + "],fileSize=" + fileSize,0); LOG_FILE.writeln("生成Excel输出完成...",0); //Loger.release(); lrc.setCompletion(0, fileSize); } } catch (Exception e) { LOG_FILE.writeln(e.toString(),0); //Loger.release(); lrc.setCompletion(2, "Exception Occurs!!!"); } }}
参数获取,状态回写
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(); }}
参考资料:
http://blog.csdn.net/cunxiyuan108/article/details/7677773
http://blog.csdn.net/cunxiyuan108/article/details/7677758
http://www.cnblogs.com/echochen/archive/2011/11/17/2253148.html
http://www.lai18.com/content/5773188.html?from=cancel
阅读全文
0 0
- ORACLE EBS :Oracle.apps.fnd.cp.request 并发常用JAVA方法
- Oracle.apps.fnd.cp.request包常用java类分析
- Oracle EBS Java Applet报错:找不到类 oracle/apps/fnd/formsClient/FormsLauncher.class
- Oracle EBS R12.2 修改APPS密码方法
- Oracle EBS 开发如何获得并发请求REQUEST ID
- Soluton for Exception:FND_SOA_SERVICE_EXECUTION_ERR:oracle.apps.fnd.soa.util.SOAException
- OAF-Error001:Oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND_GENERIC_MESS
- Oracle 11i EBS DBA Apps DBA
- Oracle EBS的两个Schema:Apps & Applsys
- oracle,EBS常用数据表
- Oracle EBS常用数据表
- Oracle EBS常用数据表
- Oracle EBS常用数据表
- Oracle EBS常用数据表
- ORACLE EBS常用表
- Oracle EBS常用表
- ORACLE EBS常用数据表
- ORACLE EBS常用表
- 集合-----Map (3)
- 修改MySql最大Sql文件导入大小
- HDU6097(数学题。。。。)
- Android版本更新并安装工具类
- [Leetcode] 343. Integer Break 解题报告
- ORACLE EBS :Oracle.apps.fnd.cp.request 并发常用JAVA方法
- svn 服务器端和客户端配置方法
- Monthly Expense(二分法)
- python uiautomator API
- 0-1背包问题练习
- SpringCloud分布式开发五大神兽
- [LeetCode]237. Delete Node in a Linked List
- @SpringBootApplication注解
- echarts ajax请求方式