/*===========================================================================+
| 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. js监听页面是否在浏览器当前页面

    在最近的一个socket项目中,需要监听客户端是否已读客服端发送的消息. 这里用到了html5中document新增了一个事件 visibilitychange,这个事件在页面前台或后台切换时被触发, ...

  2. UVA1714 Keyboarding(bfs)

    UVA1714 Keyboarding bfs 坑点很多的一题(由于一本通的辣鸡翻译会错题意*n). 1.多组数据 2.如果某方向上没有不同字符光标不会动 我们每次预处理出每个点向四个方向下次到达的点 ...

  3. xargs 原理&使用

    1. 简介 之所以能用到这个命令,是由于很多 linux 命令不支持用管道传递参数,例如 find /sbin -perm +700 | ls -l 这个命令是错误的 find /sbin -perm ...

  4. monit

    Monit 是一个用来监测系统状态的工具,不但可以用来监视进程.服务.文件.目录.文件系统,还可以在服务 down 掉的时候自动重启服务或者当某个进程占用过多的资源的时候自动停掉进程,并且支持 Ema ...

  5. 20145324王嘉澜《网络对抗技术》web安全基础实践

    实验内容 •使用webgoat进行XSS攻击.CSRF攻击.SQL注入 实验问答 •SQL注入攻击原理,如何防御 ①SQL注入攻击是攻击者在web应用程序中事先定义好的查询语句的结尾上添加额外的SQL ...

  6. VC++ 获取文件属性创建时间、修改时间和访问时间

    转载:http://blog.sina.com.cn/s/blog_66bf8d8301014ikd.html WIN32_FIND_DATA结构 关于文件的全部属性信息,总计有以下以下9 种:文件的 ...

  7. Win32 文件拖拽

    1.响应系统消息  WM_DROPFILES 2.在响应函数里面获取拖拽文件路径 LRESULT OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam ...

  8. RNN网络【转】

    本文转载自:https://zhuanlan.zhihu.com/p/29212896 简单的Char RNN生成文本 Sherlock I want to create some new thing ...

  9. HDU 6171 Admiral(双向BFS+队列)题解

    思路: 最大步骤有20,直接BFS会超时. 因为知道开始情况和结果所以可以用双向BFS,每个BFS规定最大步骤为10,这样相加肯定小于20.这里要保存每个状态搜索到的最小步骤,用Hash储存.当发现现 ...

  10. 【附9】elasticsearch-curator + Linux定时任务

    官网教程入口:https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html 一.下载安装 下载:sud ...