OAF_開發系列26_實現OAF中Java類型併發程式開發oracle.apps.fnd.cp.request(案例)

20150730 Created By BaoXinjianhtml

1、摘要java


併發程序調用Java類型的Concurrent Program
服務器

主要實現類併發

1. runProgram(CpContext cpContext):併發程序導入接口oracle

2. cpcontext.getParameterList():獲取參數Parameters Hashtableapp

3. cpContext.getReqCompletion(): 獲取並程序運行狀態設定post

4. cpContext.getLogFile():輸出日誌測試

5. cpContext.getOutFile():輸出報表this

 

2、實現分析spa


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 註冊併發程序,並定義參數

 

3、運行測試


1. 調用併發程序,並輸入參數

 

2. 查看並程序的Output和Log

 

3. 查看並程序的View Log

 

3. 查看並程序的View Output

 

Thanks and Regards

參考: 豆丁文庫 - http://www.docin.com/p-373932599.html

相關文章
相關標籤/搜索