XMLItergration.java
/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package oareport.oracle.apps.ak.webui; import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean;
import oracle.apps.xdo.oa.schema.server.TemplateHelper;
import oracle.apps.fnd.framework.OAException;
import oracle.cabo.ui.data.DataObject;
import oracle.apps.xdo.XDOException; import oracle.jbo.XMLInterface; import oracle.xml.parser.v2.XMLNode;
import java.lang.System;
import oracle.apps.xdo.oa.schema.server.TemplateInputStream;
import oracle.apps.xdo.common.log.Logger; /**
* Controller for ...
*/
public class XMLIntegrationCO extends OAControllerImpl
{
public static final String RCS_ID="$Header$";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "%packagename%"); /**
* Layout and page setup logic for a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModule am= pageContext.getApplicationModule(webBean);
// am.invokeMethod("initEmpVO");
// am.invokeMethod("getEmpDataXML"); } /**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModule am= (OAApplicationModule)pageContext.getApplicationModule(webBean);
//String event = pageContext.getParameter("event");
DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters"); HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse"); if(pageContext.getParameter("PrintPdf") != null)
{ try { ServletOutputStream os = response.getOutputStream(); // Set the Output Report File Name and Content Type String contentDisposition = "attachment;filename=PrintPage.pdf"; response.setHeader("Content-Disposition",contentDisposition); response.setContentType("application/pdf"); // Get the Data XML File as the XMLNode XMLNode xmlNode = (XMLNode) am.invokeMethod("getEmpDataXML"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlNode.print(outputStream);
// System.out.println(outputStream.toString());
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); ByteArrayOutputStream pdfFile = new ByteArrayOutputStream(); //Generate the PDF Report. //Process Template TemplateHelper.processTemplate( ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(), "PER",//APPLICATION SHORT NAME "EmpDataDT", //TEMPLATE_SHORT_CODE ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(), ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(), inputStream, TemplateHelper.OUTPUT_TYPE_PDF, null, pdfFile); //TemplateHelper. // Write the PDF Report to the HttpServletResponse object and flush. byte[] b = pdfFile.toByteArray(); response.setContentLength(b.length); os.write(b, 0, b.length); os.flush(); os.close(); pdfFile.flush(); pdfFile.close(); } catch(Exception e) { response.setContentType("text/html");
//System.out.println(e.getMessage());
throw new OAException(e.getMessage(), OAException.ERROR); } pageContext.setDocumentRendered(true); } if(pageContext.getParameter("PrintExcel") != null)
{ try { ServletOutputStream os = response.getOutputStream(); // Set the Output Report File Name and Content Type String contentDisposition = "attachment;filename=ExcelReport.xls"; response.setHeader("Content-Disposition",contentDisposition); response.setContentType("application/MSEXCEL"); // Get the Data XML File as the XMLNode XMLNode xmlNode = (XMLNode) am.invokeMethod("getEmpDataXML"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlNode.print(outputStream);
// System.out.println(outputStream.toString());
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); ByteArrayOutputStream pdfFile = new ByteArrayOutputStream(); //Generate the PDF Report. //Process Template TemplateHelper.processTemplate( ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(), "PER",//APPLICATION SHORT NAME "EmpDataDT", //TEMPLATE_SHORT_CODE ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(), ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(), inputStream, TemplateHelper.OUTPUT_TYPE_EXCEL, null, pdfFile); //TemplateHelper. // Write the PDF Report to the HttpServletResponse object and flush. byte[] b = pdfFile.toByteArray(); response.setContentLength(b.length); os.write(b, 0, b.length); os.flush(); os.close(); pdfFile.flush(); pdfFile.close(); } catch(Exception e) { response.setContentType("text/html");
//System.out.println(e.getMessage());
throw new OAException(e.getMessage(), OAException.ERROR); } pageContext.setDocumentRendered(true); } if(pageContext.getParameter("PrintWord") != null)
{ try { ServletOutputStream os = response.getOutputStream(); // Set the Output Report File Name and Content Type String contentDisposition = "attachment;filename=PrintPage.doc"; response.setHeader("Content-Disposition",contentDisposition); response.setContentType("application/MSWORD"); // Get the Data XML File as the XMLNode XMLNode xmlNode = (XMLNode) am.invokeMethod("getEmpDataXML"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlNode.print(outputStream);
// System.out.println(outputStream.toString());
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); ByteArrayOutputStream pdfFile = new ByteArrayOutputStream(); //Generate the PDF Report. //Process Template TemplateHelper.processTemplate( ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(), "PER",//APPLICATION SHORT NAME "EmpDataDT", //TEMPLATE_SHORT_CODE ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(), ((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(), inputStream, TemplateHelper.OUTPUT_TYPE_RTF, null, pdfFile); //TemplateHelper. // Write the PDF Report to the HttpServletResponse object and flush. byte[] b = pdfFile.toByteArray(); response.setContentLength(b.length); os.write(b, 0, b.length); os.flush(); os.close(); pdfFile.flush(); pdfFile.close(); } catch(Exception e) { response.setContentType("text/html");
//System.out.println(e.getMessage());
throw new OAException(e.getMessage(), OAException.ERROR); } pageContext.setDocumentRendered(true); } } } public XMLNode getEmpDataXML()
{
OAViewObject vo = (OAViewObject)findViewObject("AbcVO");
XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);
return xmlNode;
}
XMLItergration.java的更多相关文章
- Spark案例分析
一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...
- 故障重现(内存篇2),JAVA内存不足导致频繁回收和swap引起的性能问题
背景起因: 记起以前的另一次也是关于内存的调优分享下 有个系统平时运行非常稳定运行(没经历过大并发考验),然而在一次活动后,人数并发一上来后,系统开始卡. 我按经验开始调优,在每个关键步骤的加入如 ...
- Elasticsearch之java的基本操作一
摘要 接触ElasticSearch已经有一段了.在这期间,遇到很多问题,但在最后自己的不断探索下解决了这些问题.看到网上或多或少的都有一些介绍ElasticSearch相关知识的文档,但个人觉得 ...
- 论:开发者信仰之“天下IT是一家“(Java .NET篇)
比尔盖茨公认的IT界领军人物,打造了辉煌一时的PC时代. 2008年,史蒂夫鲍尔默接替了盖茨的工作,成为微软公司的总裁. 2013年他与微软做了最后的道别. 2013年以后,我才真正看到了微软的变化. ...
- 故障重现, JAVA进程内存不够时突然挂掉模拟
背景,服务器上的一个JAVA服务进程突然挂掉,查看产生了崩溃日志,如下: # Set larger code cache with -XX:ReservedCodeCacheSize= # This ...
- 死磕内存篇 --- JAVA进程和linux内存间的大小关系
运行个JAVA 用sleep去hold住 package org.hjb.test; public class TestOnly { public static void main(String[] ...
- 【小程序分享篇 一 】开发了个JAVA小程序, 用于清除内存卡或者U盘里的垃圾文件非常有用
有一种场景, 手机内存卡空间被用光了,但又不知道哪个文件占用了太大,一个个文件夹去找又太麻烦,所以我开发了个小程序把手机所有文件(包括路径下所有层次子文件夹下的文件)进行一个排序,这样你就可以找出哪个 ...
- Java多线程基础学习(二)
9. 线程安全/共享变量——同步 当多个线程用到同一个变量时,在修改值时存在同时修改的可能性,而此时该变量只能被赋值一次.这就会导致出现“线程安全”问题,这个被多个线程共用的变量称之为“共享变量”. ...
- Java多线程基础学习(一)
1. 创建线程 1.1 通过构造函数:public Thread(Runnable target, String name){} 或:public Thread(Runnable target ...
随机推荐
- python的os模块和sys模块
os模块 os.getcwd() 获取当前的工作目录 os.chdir('绝对路径/相对于当前工作目录的路径') 改变工作目录,相当于shell的cd命令,例如Windows平台下os.chdir ...
- P3868 [TJOI2009]猜数字
[TJOI2009]猜数字 中国剩余定理 求解i=1 to n : x≡a[i] (mod b[i])的同余方程组 设 t= ∏i=1 to n b[i] 我们先求出 i=1 to n : x≡1 ( ...
- 20145331魏澍琛《网络对抗》Exp5 MSF基础应用
20145331魏澍琛<网络对抗>Exp5 MSF基础应用 基础问题回答 1.用自己的话解释什么是exploit,payload,encode? exploit:渗透攻击的模块合集,将真正 ...
- 20145335郝昊《网络对抗》Exp 8 Web基础
20145335郝昊<网络对抗>Exp 8 Web基础 实验内容 本实践的具体要求有: Web前端HTML:能正常安装.启停Apache.理解HTML,理解表单,理解GET与POST方法, ...
- VC中GetLastError()获取错误信息的使用,以及错误代码的含义
转载:http://www.seacha.com/article.php/knowledge/windows/mfc/2011/0423/335.html VC中GetLastError()获取错误信 ...
- Visual Leak Detector简明使用教程
Visual Leak Detector是一款内存泄漏检测软件,主要的作用就是检测可能或者是存在内存泄露的地方,具体的功能的话,可以百度下,今天主要简单介绍下怎么使用 首先下载Visual Leak ...
- Ubuntu上 配置Eclipse:安装CDT
在最新的 Ubuntu Kylin 16.04 中安装了eclipse,在纠结了很久的网络问题之后,开始了eclipse的配置以便在上面运行ns3. 在官方网站上安装完 eclipse LUNA 之后 ...
- [POJ1958][Strange Tower of Hanoi]
题目描述 求解 \(n\) 个盘子 \(4\) 座塔的 Hanoi 问题最少需要多少步 问题分析 考虑 \(3\) 座塔的 Hanoi 问题,记 \(f[i]\) 表示最少需要多少步, 则 \(f[i ...
- UVa 1660 电视网络(点连通度+最小割最大流+Dinic)
https://vjudge.net/problem/UVA-1660 题意:给出一个无向图,求出点连通度.即最少删除多少个点,使得图不连通. 思路: 如果求线连通度的话,直接求个最大流就可以了.但这 ...
- hdu 5493 Queue 树状数组第K大或者二分
Queue Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submi ...