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的使用是在同事写的一个抽取系统代码里,当时这部分代码没有完成,有许多的问题,另一个同事接手了这部分代码的功能开发,由于他没有多线程开发的经验 ...
随机推荐
- SNMP学习笔记之Linux下安装和配置SNMP
注意:本篇安装用户是root,非root用户启动的时候会报缺少文件错误. 一.安装SNMP 1.1.下载Net-SNMP的源代码 选择一个SNMP版本,比如5.7.1,下载地址如下:http://so ...
- csharp编写界面,opencv编写类库,解决 Pinvoke过程中的参数传递和平台调用问题
使用csharp 编写winform程序,不仅速度快,而且容易界面美化并找到其他类库的支持:而使用 opencv编写图形图像处理程序,是目前比较流行,而且高效的一种方法.如果需要将两者结合,需 ...
- 2017.11.11 B201 练习题思路及解题方法
2017.11.11 B201 练习题思路及解题方法 题目类型及涵盖知识点 本次总共有6道题目,都属于MISC分类的题目,涵盖的知识点有 信息隐藏 暴力破解 音轨,摩斯电码 gif修改,base64原 ...
- Oracleシノニムについて
SYNONYM(シノニム/別名) シノニムとは表やビューなどのオブジェクトにつけた別名のことです. この別名を付けることにより本来の名称とは異なるシノニム名でオブジェクトにアクセスすることができます. ...
- BZOJ 2434 阿狸的打字机(fail树)
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2434 题意:阿狸喜欢收藏各种稀奇古怪的东西,最近他淘到一台老式的打字机.打字机上只有28 ...
- 网络安全、Web安全、渗透测试之笔经面经总结(三)
本篇文章涉及的知识点有如下几方面: 1.什么是WebShell? 2.什么是网络钓鱼? 3.你获取网络安全知识途径有哪些? 4.什么是CC攻击? 5.Web服务器被入侵后,怎样进行排查? 6.dll文 ...
- 终于在nowcoder爆发了的懒惰
题目 这类题目我实在忍不了了 Emma,随便做个nowcode比赛题吧,我在oj上也没找到 题意 求\(\sum_{L=1}^{n}\sum_{R=i}^{n}a[k](L<=k<=R)\ ...
- 乘积尾零|2018年蓝桥杯B组题解析第三题-fishers
标题:乘积尾零 如下的10行数据,每行有10个整数,请你求出它们的乘积的末尾有多少个零? 5650 4542 3554 473 946 4114 3871 9073 90 4329 2758 7949 ...
- Android Studio Design界面不显示layout控件的解决方法
发现更改了 layout里面的xml文件后 切换到design后,没有显示控件 解决方法 解决办法: 在 res/values/styles.xml 文件中 将原有的 前面添加 Base. The ...
- vuejs全局api概念
什么是全局API? 全局API并不在构造器里,而是先声明全局变量或者直接在Vue上定义一些新功能,Vue内置了一些全局API,比如我们今天要学习的指令Vue.directive.说的简单些就是,在构造 ...