/*===========================================================================+
| 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的更多相关文章

  1. Spark案例分析

    一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...

  2. 故障重现(内存篇2),JAVA内存不足导致频繁回收和swap引起的性能问题

    背景起因: 记起以前的另一次也是关于内存的调优分享下   有个系统平时运行非常稳定运行(没经历过大并发考验),然而在一次活动后,人数并发一上来后,系统开始卡. 我按经验开始调优,在每个关键步骤的加入如 ...

  3. Elasticsearch之java的基本操作一

    摘要   接触ElasticSearch已经有一段了.在这期间,遇到很多问题,但在最后自己的不断探索下解决了这些问题.看到网上或多或少的都有一些介绍ElasticSearch相关知识的文档,但个人觉得 ...

  4. 论:开发者信仰之“天下IT是一家“(Java .NET篇)

    比尔盖茨公认的IT界领军人物,打造了辉煌一时的PC时代. 2008年,史蒂夫鲍尔默接替了盖茨的工作,成为微软公司的总裁. 2013年他与微软做了最后的道别. 2013年以后,我才真正看到了微软的变化. ...

  5. 故障重现, JAVA进程内存不够时突然挂掉模拟

    背景,服务器上的一个JAVA服务进程突然挂掉,查看产生了崩溃日志,如下: # Set larger code cache with -XX:ReservedCodeCacheSize= # This ...

  6. 死磕内存篇 --- JAVA进程和linux内存间的大小关系

    运行个JAVA 用sleep去hold住 package org.hjb.test; public class TestOnly { public static void main(String[] ...

  7. 【小程序分享篇 一 】开发了个JAVA小程序, 用于清除内存卡或者U盘里的垃圾文件非常有用

    有一种场景, 手机内存卡空间被用光了,但又不知道哪个文件占用了太大,一个个文件夹去找又太麻烦,所以我开发了个小程序把手机所有文件(包括路径下所有层次子文件夹下的文件)进行一个排序,这样你就可以找出哪个 ...

  8. Java多线程基础学习(二)

    9. 线程安全/共享变量——同步 当多个线程用到同一个变量时,在修改值时存在同时修改的可能性,而此时该变量只能被赋值一次.这就会导致出现“线程安全”问题,这个被多个线程共用的变量称之为“共享变量”. ...

  9. Java多线程基础学习(一)

    1. 创建线程    1.1 通过构造函数:public Thread(Runnable target, String name){}  或:public Thread(Runnable target ...

随机推荐

  1. 02: 安装epel 解决centos7无法使用yum安装nginx

    参考网址: http://www.mamicode.com/info-detail-1671603.html 1.yum命令安装 yum install epel-release -y 2.更新数据 ...

  2. awk之match函数

    功能:match函数是用于个性化定制搜索模式. 例子: 文件内容: this is wang ,not wan that is chen, not che this is chen ,and wang ...

  3. 《网络对抗》——逆向及Bof基础实践

    <网络对抗>--逆向及Bof基础实践 原理 利用foo函数的Bof漏洞,构造一个攻击输入字符串,覆盖返回地址,触发getShell函数. 手工修改可执行文件,改变程序执行流程,直接跳转到g ...

  4. vim常用的配置

    .vimrc配置 syntax enable syntax on set relativenumber set autoindent set tabstop=4 set expandtab " ...

  5. JavaScript 时间格式

    方法1: Date.prototype.Format = function (fmt) { var o = { , //月份 "d+": this.getDate(), //日 = ...

  6. 【第十四章】 springboot + profile(不同环境读取不同配置)

    具体做法: 不同环境的配置设置一个配置文件,例如:dev环境下的配置配置在application-dev.properties中:prod环境下的配置配置在application-prod.prope ...

  7. [BZOJ1060][ZJOI2007]时态同步 树形dp

    Description 小Q在电子工艺实习课上学习焊接电路板.一块电路板由若干个元件组成,我们不妨称之为节点,并将其用数 字1,2,3….进行标号.电路板的各个节点由若干不相交的导线相连接,且对于电路 ...

  8. 哈希表-java

    import java.util.HashMap; import java.util.Iterator; public class JavaHashMap { public static void m ...

  9. SQLServer 中的SYSPROCESSES表

    性能测试的时候对SQLserver DB中的CPU,io,内存进行监控 可以通过系统进程表查看资源使用情况 注意要有master权限 select top 10 * from SYSPROCESSES ...

  10. Kali Linux 2016.2初体验

    前言 Kali Linux官 方于8月30日发布Kali Linux 2016的第二个版本Kali Linux 2016.2.该版本距离Kali Linux 2016.1版本发布,已经有7个月.在这期 ...