原文地址:XML Publisher Using API’s

Applications Layer APIs
The applications layer of XML Publisher allows you to store and manager data sources
and templates through the Template Manager user interface via the XML Publisher
Administrator responsibility. You can also access and manipulate these objects via an
application program interfaces.

Data sources and templates are stored in the database. This includes the metadata
describing the object and the physical object itself (for example, an RTF file). Use these
APIs to register, update, and retrieve information about datasources and templates. You
can also call use the APIs to call XML Publisher to apply a template to a data source to
generate output documents directly (without going through the concurrent manager).

Datasource APIs
The following APIs are provided to access and manipulate the data definitions
programmatically:
• DataSource Class
The data source acts as a placeholder object against which you register templates. The
DataSource class represents a single data source definition entry.
• DataSourceHelper Class
This is a utility class that can be used to manage data source definition entries in the
Template Manager repository.

Getting AppsContext
All methods require the AppsContext instance to communicate with the Applications
database like If you are using this class in a Java concurrent program, pass CpContext as an
AppsContext.

Creating Data Source Definition Entries
Add a new data source definition entry to the Template Manager repository as follows:
1. Create an instance of the DataSource class by calling the
DataSource.createInstance() method.
2. Set the attributes of the instance.
3. Pass it to the DataSourceHelper.createDataSource()method.

Adding, Updating, and Deleting Schema Files and Sample Files
You can add, update and delete the data source schema definition file and the sample
XML file by calling methods defined in the DataSourceHelper class. Please note that
unlike the deleteDataSource() method described above, these methods actually
delete the schema file and sample records from the repository.
Example
// Add a schema definition file
DataSourceHelper.addSchemaFile(ctx, “XDO”, “TestDataSource”,
“schema.xsd”, new FileInputStream(“/path/to/schema.xsd”));
// Add a sample xml data file
DataSourceHelper.addSampleFile(ctx, “XDO”, “TestDataSource”,
“sample.xml”, new FileInputStream(“/path/to/sample.xml”));
// Update a schema definition file
DataSourceHelper.addSchemaFile(ctx, “XDO”, “TestDataSource”,
new FileInputStream(“/path/to/new_schema.xsd”));
// Update a sample xml data file
DataSourceHelper.addSampleFile(ctx, “XDO”, “TestDataSource”,
new FileInputStream(“/path/to/new_sample.xml”));
// Delete a schema definition file
DataSourceHelper.deleteSchemaFile(ctx, “XDO”, “TestDataSource”);
// Delete a sample xml data file
DataSourceHelper.deleteSampleFile(ctx, “XDO”, “TestDataSource”);

Getting Schema Files and Sample Files from the Repository
You can download schema files or sample files from the repository by calling the
getSchemaFile() or the getSampleFile() method. These methods return an
InputStream connected to the file contents as a return value.
The sample code is as follows:
Example
// Download the schema definition file from the repository
InputStream schemaFile = DataSourceHelper.getSchemaFile(ctx, “XDO”, “TestDataSource”, );
// Download the XML sample data file from the repository
InputStream sampleFile = DataSourceHelper.getSampleFile(ctx, “XDO”, “TestDataSource”, );

Template APIs
Multiple template objects can be associated with a single data source. The Template
class represents a single template instance. The TemplateHelper class is a utility class
used to create and update template objects in the Template Manager.

The Template Class
The Template class represents a single template object in the template manager. It is
associated with a data source object. The class has several get and set methods to
manipulate the template object.
TemplateHelper Class
The TemplateHelper class is a utility class to manage the template entries in the
Template Manager repository. It consists of a set of static utility methods.

Creating Template EntriesTo add a new template entry to the Template Manager repository:
1. Create an instance of the Template class by calling the
Template.createInstance() method
2. Set the attributes of the instance.
3. Pass it to the TemplateHelper.createTemplate() method
Example
// Create an instance
Template t = Template.createInstance(appsContext, “XDO”,”TestTemplate”,
TypeDefinitions.TEMPLATE_TYPE_PDF, “XDO”, “TestTemplate”);
// Set properties
t.setDescription(“This is the test template entry.”);
t.setStartDate(new java.sql.Date(System.currentTimeMillis()));
t.setName(“Test template !”);
t.setStatus(TypeDefinitions.TEMPLATE_STATUS_ENABLED);
// Call createTemplate() to create an entry into the repository
TemplateHelper.createTemplate(am, t);

Where am = oracle apps module.

Adding, Updating, and Deleting Template Files
You can add, update and delete template files by calling methods defined in the
TemplateHelper class.

Example
// Add English template file to the template entry
TemplateHelper.addTemplateFile(
appsContext, // AppsContext
“XDO”, // Application short name of the template
“TestTemplate”, // Template code of the template
“en”, // ISO language code of the template
“US”, // ISO territory code of the template
Template.TEMPLATE_TYPE_PDF, // Type of the template file
“us.pdf”, // Filename of the template file
new FileInputStream(“/path/to/us.pdf”)); // Template file

// Add Japanese template file to the template entry
TemplateHelper.addTemplateFile(
appsContext, // AppsContext
“XDO”, // Application short name of the template
“TestTemplate”, // Template code of the template
“ja”, // ISO language code of the template
“JP”, // ISO territory code of the template
Template.TEMPLATE_TYPE_PDF, // Type of the template file
“ja.pdf”, // Filename of the template file
new FileInputStream(“/path/to/ja.pdf”)); // Template file

// Update English template file to the template entry
TemplateHelper.updateTemplateFile(
appsContext, // AppsContext
“XDO”, // Application short name of the template
“TestTemplate”, // Template code of the template
“en”, // ISO language code of the template
“US”, // ISO territory code of the template
Template.TEMPLATE_TYPE_PDF, // Type of the template file
“us.pdf”, // Filename of the template file
new FileInputStream(“/path/to/new/us.pdf”)); // Template file

// Delete Japanese template file to the template entry
TemplateHelper.deleteTemplateFile(
appsContext, // AppsContext
“XDO”, // Application short name of the template
“TestTemplate”, // Template code of the template
“ja”, // ISO language code of the template
“JP”); // ISO territory code of the template

Getting Template FilesDownload template file contents from the repository by calling the getTemplateFile() methods. These methods return an InputStream connected to
the template file as a return value.
Example
// Download the English template file from the repository
InputStream in = TemplateHelper.getTemplateFile(
appsContext, // AppsContext
“XDO”, // Application short name of the template
“TestTemplate”, // Template code of the template
“en”, // ISO language code of the template
“US”); // ISO territory code of the template

Processing TemplatesYou can apply a template, stored in the Template Manager, to an XML data source by
calling one of the processTemplate() methods. You need to pass the OutputStream
object for the destination of the processed document.
Example
// Process template
TemplateHelper.processTemplateFile(
appsContext, // AppsContext
“XDO”, // Application short name of the template
“TestTemplate”, // Template code of the template
“en”, // ISO language code of the template
“US”, // ISO territory code of the template
dataInputStream, // XML data for the template
TemplateHelper.OUTPUT_TYPE_PDF, // Output type of the procesed
document
properties, // Properties for the template processing
docOutputStream) // OutputStream where the processed document goes.

XML Publisher Using API’s(转)的更多相关文章

  1. How to Delete XML Publisher Data Definition Template

    DECLARE  -- Change the following two parameters  VAR_TEMPLATECODE  VARCHAR2(100) := 'CUX_CHANGE_RPT1 ...

  2. OAF与XML Publisher集成(转)

    原文地址:OAF与XML Publisher集成 有两种方式,一种是用VO与XML Publisher集成,另一种是用PL/SQL与XML Publisher集成 用VO与XML Publisher集 ...

  3. BIP_开发案例07_将原有Report Builer报表全部转为XML Publisher形式(案例)

    2014-05-31 Created By BaoXinjian

  4. How to Determine the Version of Oracle XML Publisher for Oracle E-Business Suite 11i and Release 12 (Doc ID 362496.1)

    Modified: 29-Mar-2014 Type: HOWTO In this DocumentGoal   Solution   1. Based upon an output file gen ...

  5. xml publisher根据条件显示或隐藏列

     xml publisher根据条件显示或隐藏列 <?if@column:condition? > -- <?end if?> 样例: 依据PROJECT_FLAG标签显示 ...

  6. XML Publisher Report Issues, Recommendations and Errors

    In this Document   Purpose   Questions and Answers   References APPLIES TO: Oracle Process Manufactu ...

  7. 使用XML Publisher导出PDF报表

    生成XML数据源有两种方式. 一种是使用存储过程,返回一个clob作为xml数据源. 另一种是直接使用VO中的数据生成xml数据源. 方法一参考: Oracle XML Publisher技巧集锦 O ...

  8. OAF 中下载使用XML Publisher下载PDF附件

    OAF doesn't readily expose the Controller Servlet's HttpRequest and HttpResponse objects so you need ...

  9. EBS xml publisher中文乱码

    http://www.cnblogs.com/benio/archive/2011/11/22/2259313.html   由于本机环境问题,导致做的xml publisher报表跑不出来. 无法显 ...

随机推荐

  1. ELK学习笔记之Logstash和Filebeat解析对java异常堆栈下多行日志配置支持

    0x00 概述 logstash官方最新文档.假设有几十台服务器,每台服务器要监控系统日志syslog.tomcat日志.nginx日志.mysql日志等等,监控OOM.内存低下进程被kill.ngi ...

  2. Python入门之面向对象编程(一)面向对象概念及优点

    概念 谈到面向对象,很多程序员会抛出三个词:封装.继承和多态:或者说抽象.一切都是对象之类的话,然而这会让初学者更加疑惑.下面我想通过一个小例子来说明一下 面向对象一般是和面向过程做对比的,下面是一个 ...

  3. Java随机获取32位密码且必须包含大小写字母、数字和特殊字符,四种的任意三种

    Java随机获取32位密码且必须包含大小写字母.数字和特殊字符,四种的任意三种 Java随机获取32位密码且必须包含大小写字母.数字和特殊字符,四种的任意三种,代码如下: import java.ut ...

  4. Python3基础 file seek 将文件的指针恢复到初始位置

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  5. Linux内核分析--系统调用【转】

    本文转载自:http://www.cnblogs.com/paperfish/p/5308505.html 前言:以下笔记除了一些讲解视频中的概念记录,图示.图示中的补充文字.总结.分析.小结部分均是 ...

  6. ubuntu下如何修改时区和时间

    1.修改时区 sudo tzselect (按提示选择即可) sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 2. 修改时间 sudo ...

  7. PHP开发者的路书

    初学者 作为初学者,通常情况下,我们都会买一本PHP教材,或者在网上看免费教程,这当然是学习的好途径.因为,这些书籍和网上的免费教程,基本上都是由浅入深的渐进式教学方式,基础知识居多,高级知识占少量的 ...

  8. Notepad++7.5.4 设置主题,使用插件

    首先官网下载 Notepad++7.5.4 默认英文转换成中文 下面设置主题: 设置-->语言格式设置 选择主题Obsidian,字体选择等宽字体Consolas,大小为11,选择全局字体,使用 ...

  9. HDU 1796 How many integers can you find(容斥)题解

    思路:二进制解决容斥问题,就和昨天做的差不多.但是这里题目给的因子不是质因子,所以我们求多个因子相乘时要算最小公倍数.题目所给的因数为非负数,故可能有0,如果因子为0就要删除. 代码: #includ ...

  10. 【Python】【元编程】【二】【描述符】

    """ #描述符实例是托管类的类属性:此外,托管类还有自己实例的同名属性 #20.1.1 LineItem类第三版:一个简单的描述符#栗子20-1 dulkfood_v3 ...