Generate PDF in Sourcing through concurrent request,在EBS java并发中调用指定am的方法
package oracle.apps.pon.printing.cp; import java.io.InputStream;
import java.io.FileOutputStream;
import oracle.jbo.domain.BlobDomain;
import oracle.apps.fnd.cp.request.CpContext;
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.ParameterList;
import oracle.apps.fnd.util.NameValueType;
import oracle.apps.fnd.framework.OAApplicationModuleFactory;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.pon.printing.server.SourcingPrintingAMImpl; /**
* This class is a JavaConcurrentProgram to generate a Sourcing Negotiation
* PDF event from the ConcurrentRequest utility rather than from the webpage.
*
* This tool allows sourcing events to be printed before they are published to
* the suppliers so they may be reviewed by the team without the need to create
* multiple revisions to the event before publishing.
*/
public class GenerateNegotiationPdfCp
implements oracle.apps.fnd.cp.request.JavaConcurrentProgram
{
//class level variables
public static String sourcingPrintingAmName =
"oracle.apps.pon.printing.server.SourcingPrintingAM";
private LogFile m_appsLogFile; /**
* Default Constructor, does nothing
*/
public GenerateNegotiationPdfCp()
{
}//End of constructor GenerateNegotiationPdfCp() /**
* Main entry point for the application. This will accept the conext
* and run the tools needed to generate a PDF of a sourcing negotiation
*/
public void runProgram(CpContext cpContext)
{
//Local variables
OutFile out = cpContext.getOutFile();
m_appsLogFile = cpContext.getLogFile();
ReqCompletion lRC = cpContext.getReqCompletion();
BlobDomain pdf = null;
Integer rfxId = null; //Grad the P_SOURCING_EVENT_ID catagory from the Concurrent context
ParameterList list = cpContext.getParameterList();
m_appsLogFile.writeln("Retrieving P_SOURCING_EVENT_ID parameter", LogFile.STATEMENT);
try
{
while(list.hasMoreElements())
{
NameValueType namevaluetype = list.nextParameter();
if(namevaluetype.getName().equalsIgnoreCase("P_SOUCING_EVENT_ID"))
{
String val = namevaluetype.getValue();
if(val != null)
{
rfxId = new Integer(Integer.parseInt(val));
}
}
}
}
catch(Exception ex)
{
m_appsLogFile.writeln("The following error occured while retrieving "
+ "the P_SOURCING_EVENT_ID parameter " + ex.getMessage(), LogFile.ERROR);
lRC.setCompletion(ReqCompletion.ERROR,
"Failed to get P_SOURCING_EVENT_ID parameter");
return;
} //Call getNegotiationPdf(string, string, string, string, Boolean)
m_appsLogFile.writeln("Retrieving PDF file", LogFile.STATEMENT);
try
{
/**
* Get the BlobDomain so we can write it to the output file
*/
SourcingPrintingAMImpl pdflib = (SourcingPrintingAMImpl)getSourcingAppModule(cpContext);
OADBTransaction trans = pdflib.getOADBTransaction();
String clientTimeZone = trans.getProfile("CLIENT_TIMEZONE_ID");
String serverTimeZone = trans.getProfile("SERVER_TIMEZONE_ID");
String dateFormat = trans.getProfile("ICX_DATE_FORMAT_MASK");
pdf = pdflib.getNegotiationPdf(rfxId.toString(), clientTimeZone, serverTimeZone, dateFormat, new Boolean(true));
}
catch(Exception ex)
{
m_appsLogFile.writeln("The following error occured while retrieving the "
+ "PDF from BI Publisher: " + ex.getMessage(), LogFile.ERROR);
lRC.setCompletion(ReqCompletion.ERROR,
"Failed to get PDF from BI Publisher parameter");
return;
} //Write the PDF to the output file 2k at a time
m_appsLogFile.writeln("Writting the PDF to the output file", LogFile.STATEMENT);
try
{
InputStream iStream = pdf.getBinaryStream();
FileOutputStream oStream = new FileOutputStream(out.getFileName(), false);
byte[] buff = new byte[2048];
int count;
while((count = iStream.read(buff)) >= 0)
{
oStream.write(buff, 0, count);
}
iStream.close();
oStream.flush();
oStream.close();
lRC.setCompletion(ReqCompletion.NORMAL, "SUCCESS!");
}
catch(Exception ex)
{
m_appsLogFile.writeln("Failed to write PDF to output file ["
+ out.getFileName()
+ "] with the following error: " + ex.getMessage(), LogFile.ERROR);
lRC.setCompletion(ReqCompletion.ERROR,
"Failed writing to the output file");
return;
} }//End of method runProgram(CpConext) /**
* This method uses the OAApplicationModuleFactory to create an instance of
* an Oracle Application Implimentation Module factory. The current context
* of the ConcurrentRequest program is sent along so the Application Module
* can initialize properly.
*/
protected OAApplicationModuleImpl getSourcingAppModule(CpContext cpcontext)
{
OAApplicationModuleImpl oaapplicationmoduleimpl =
(OAApplicationModuleImpl)
OAApplicationModuleFactory.createRootOAApplicationModule(
cpcontext, sourcingPrintingAmName);
return oaapplicationmoduleimpl;
}//End of getSourcingAppModule(CpContext) }//End of class GenerateNegotiationPdfCp
其中最重要的方法便是在请求中调用AM。
SourcingPrintingAMImpl pdflib = (SourcingPrintingAMImpl)getSourcingAppModule(cpContext);
protected OAApplicationModuleImpl getSourcingAppModule(CpContext cpcontext)
{
OAApplicationModuleImpl oaapplicationmoduleimpl =
(OAApplicationModuleImpl)
OAApplicationModuleFactory.createRootOAApplicationModule(
cpcontext, sourcingPrintingAmName);
return oaapplicationmoduleimpl;
}//End of getSourcingAppModule(CpContext)
参考资料:
Generate PDF in Sourcing through concurrent request
Generate PDF in Sourcing through concurrent request,在EBS java并发中调用指定am的方法的更多相关文章
- How To Get Log, Trace Files In OA Framework Pages And Concurrent Request Programs
Goal Solution References APPLIES TO: Oracle Supplier Lifecycle Management - Version 12.1.2 and l ...
- (转)How To Kill runaway processes After Terminating Concurrent Request
终止EBS并发请求后,解锁相关的进程. 还有种方法可以在PLSQL->tools->session 中找到并且kill Every concurrent Request uses some ...
- Oracle EBS Concurrent Request:Gather Schema Statistics[Z]
Oracle EBS 的Concurrent Request"Gather Schema Statistics"是一个和性能相关的Concurrent Program,它会对表,列 ...
- Oracle E-Business Suite并发请求的优先级(Concurrent Request Priority)
不少用户抱怨自己的Oracle E-Business Suite并发请求(Concurrent Request)提交了好久,但还是一直在排队,等了好久还没有执行.用户希望对于一些重要性程度高.响应要求 ...
- Concurrent Request:Inactive phase,No Manager status
Symptom 随便submit一个request,发现几乎所有的Concurrent Manager都为No Manager状态,Phase为Inactive. Solution 一个Concurr ...
- django执行mysql恢复的时候出现“The request's session was deleted before the request completed. The user may have logged out in a concurrent request, for example.”
版本: django:2.1.7 python:3.7 mysql:5.7.25 今天在用django做mysql备份和恢复的时候,备份没问题,恢复时出现如下错误提示: The request's s ...
- at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333)
at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333) 原因: null request
- 《Java并发编程实战》/童云兰译【PDF】下载
<Java并发编程实战>/童云兰译[PDF]下载链接: https://u253469.pipipan.com/fs/253469-230062521 内容简介 本书深入浅出地介绍了Jav ...
- 学习笔记:java并发编程学习之初识Concurrent
一.初识Concurrent 第一次看见concurrent的使用是在同事写的一个抽取系统代码里,当时这部分代码没有完成,有许多的问题,另一个同事接手了这部分代码的功能开发,由于他没有多线程开发的经验 ...
随机推荐
- RabbitMQ详解(一)------简介与安装(Docker)
RABBITMQ详解(一)------简介与安装(DOCKER) 刚刚进入实习,在学习过程中没有接触过MQ,RabbitMQ 这个消息中间件,正好公司最近的项目中有用到,学习了解一下. 首先什么是MQ ...
- JavaScript:正则表达式 前瞻 找位置
js中全部都是顺序环视 顺序环视匹配过程 对于顺序肯定环视(?=Expression)来说,当子表达式Expression匹配成功时,(?=Expression)匹配成功,并报告(?=Expressi ...
- HDU 1285 确定比赛名次(拓扑排序)题解
Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委 ...
- Specify Computed Columns in a Table
https://docs.microsoft.com/en-us/sql/relational-databases/tables/specify-computed-columns-in-a-table ...
- 【第一章】 第一个spring boot程序
环境: jdk:1.8.0_73 maven:3.3.9 spring-boot:1.2.5.RELEASE(在pom.xml中指定了) 注意:关于spring-boot的支持, 最少使用jdk7(j ...
- [BZOJ1370][Baltic2003]Gang团伙 并查集+拆点
Description 在某城市里住着n个人,任何两个认识的人不是朋友就是敌人,而且满足: 1. 我朋友的朋友是我的朋友: 2. 我敌人的敌人是我的朋友: 所有是朋友的人组成一个团伙.告诉你关于这n个 ...
- 论文笔记之:Dynamic Label Propagation for Semi-supervised Multi-class Multi-label Classification ICCV 2013
Dynamic Label Propagation for Semi-supervised Multi-class Multi-label Classification ICCV 2013 在基于Gr ...
- jQuery object and DOM Element
They're both objects but DOMElements are special objects. jQuery just wraps DOMElements in a Javascr ...
- 解决 Ubuntu 14.04 图形界面无法正常显示 问题
参考: ubuntu清除系统缓存的方法 apt-get(四) 每天一个linux命令(33):df 命令 Ubuntu server 12.10 /dev/sda1 disk full 解决 Ubun ...
- js中一些关于比较左右两边的值的题目
alert(typeof(NaN)); alert(typeof(Infinity)); alert(typeof(null)); alert(typeof(undefined)); alert(Na ...