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 ...
随机推荐
- djando 项目用django自己服务器在局域网中被访问设置
这是一个相当操蛋的东西,害老子搞了那么久,其实嘞,也用不着那么恨,都是自己做的孽!! -----------------人工分割线----------------------------------- ...
- 07: linux中正则表达式与grep使用
1.1 linux中正则表达式 1.^linux 以linux开头的行 2.$php 以php结尾的行 3.. 匹配任意单字符 4..+ ...
- 解决mysql的Too many connections
解决: /etc/my.cnf vim编辑 添加 max_connections= wait_timeout= 然后执行code service mysqld reload service mysql ...
- 查看 nodejs 安装包的相关指令
npm -h 以上指令可以看到npm可用的指令 如果要卸载就用npm uninstall
- 使用qmlscene预览qml文件
功能:可以预览qml文件的界面 使用:qmlscene myapp.qml
- 在linux桌面上显示图标
把应用程序的图标添加到桌面上 左图显示了把应用程序的图标添加到桌面上的两种方法,哪种更好看? 想要把应用程序图标添加到桌面上,请先确保已设置了在桌面上显示图标,方法是: 1.安装gnome-tweak ...
- SPOJ LAS(BFS)题解
题目:VJ 思路: BFS+回溯,但是要剪枝,看了dalao的题解,超时+WA无数发,终于过了 #include<cstdio> #include<cstring> #incl ...
- winform中splitter的用法
1.将winform分为三列 整个窗体分成可以自动调节的三列的做法:1.往窗体上丢两个panel控件其中:panelLeft——设置Dock属性为“left”,并调节好其宽度panelRight——设 ...
- Python time strptime()与time strftime()
time strftime()接收时间元组,返回表示时间的字符串. time strptime()把时间字符串,解析成一个时间元组. import time t = time.strftime('%Y ...
- FAST:通过Floodlight控制器下发流表
参考: Floodlight+Mininet搭建OpenFlow(四):流表操作 通过Floodlight控制器下发流表 下发流表的方式有两种: 1.借助Floodlight的北向API,利用curl ...