原文地址: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. Eclipse中的工程引入jar包后没有整合到一个文件夹而是全部在根目录下显示

    Eclipse中的工程引入jar包后没有整合到一个文件夹而是全部在根目录下显示 解决方案: 1,在Eclipse中,点击window-->Preferences-->Java-->B ...

  2. 20145104张家明 《Java程序设计》第7周学习总结

    20145104张家明 <Java程序设计>第7周学习总结 教材学习内容总结 第13章 简单认识时间和日期 -时间的度量:GMT.UT.TAI.UTC.Unix.epoch. -UTC:保 ...

  3. 面向对象初调用:foolish 电梯

    本周我们完成的任务是傻瓜电梯的调度,对于那十分十分详细的指导书,我感觉想要说明白题目要求,是做不到的,所以就把指导书贴出来给大家看了,,由于在下还不会网页制作,只能通过百度网盘了,https://pa ...

  4. keil_4/MDK各种数据类型占用的字节数

    笔者正在学习uCOS-II,移植到ARM时考虑到数据类型的定义,但对于Keil MDK编译器的数据类型定义还是很模糊,主要就是区分不了short int.int.long 和long int占用多少字 ...

  5. C++使用TinyXML

    参照一:http://qaohao.iteye.com/blog/496237 参照二:http://hi.baidu.com/lnylvoeegzcgnrr/item/af68fd9cde40fc1 ...

  6. Java位运算实现加减乘除

    一.加法 a+b 举例实现:13+9=22 13+9不考虑进位结果为12 只考虑进位结果为10 和刚好是22. 13二进制为1101,9二进制为1001. 不考虑进位结果为0100.算式为a^b 只考 ...

  7. Python3基础 逻辑运算 and or not 示例

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

  8. pip 更换国内镜像与记录

    更换pip源到国内镜像 阿里云 http://mirrors.aliyun.com/pypi/simple/   中国科技大学 https://pypi.mirrors.ustc.edu.cn/sim ...

  9. POJ 2449 Remmarguts' Date(第K短路 + A* + 最短路)题解

    题意:找出第k短路,输出长度,没有输出-1 思路:这题可以用A*做.A*的原理是这样,我们用一个函数:f = g + h 来表示当前点的预期步数,f代表当前点的预期步数,g代表从起点走到当前的步数,h ...

  10. HDU 6148 Valley Numer (数位DP)题解

    思路: 只要把status那里写清楚就没什么难度T^T,当然还要考虑前导零! 代码: #include<cstdio> #include<cstring> #include&l ...