1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.sun.java.util.collections.Hashtable;
import oracle.apps.xdo.dataengine.DataProcessor;
import oracle.jdbc.driver.OracleDriver;
import oracle.apps.xdo.template.RTFProcessor;
import oracle.apps.xdo.template.FOProcessor;
class XML_PUBLISHER_RTF{
public static void main(String args[]) {
try{
RTFProcessor rtfProcessor = new RTFProcessor("template.rtf");
rtfProcessor.setOutput("outTemplate.xls");
rtfProcessor.process();
}catch (Exception e){
e.printStackTrace();
System.exit(1);
}
try {
DataProcessor dataProcessor = new DataProcessor();
Connection jdbcConnection = getConnection();
//Set the db connection
dataProcessor.setConnection(jdbcConnection);
// Set the SQL to be executed
dataProcessor.setSql( "select INCIDENT_ID, INCIDENT_NUMBER"
+"from cs_incidents_all_b where INCIDENT_ID < :INCIDENT_ID");
Hashtable parameters = new Hashtable();
//Setup the SuppID value to be used
parameters.put("INCIDENT_ID ","15");
//Set the parameters
dataProcessor.setParameters(parameters);
//Specify the output file name and location
dataProcessor.setOutput("data.xml");
//Specify the root element tag name for the generated output
dataProcessor.setRowTag("INCIDENT");
//Specify the row elemen tag name for the generated outputt
dataProcessor.setRowsetTag("INCIDENTS");
//Execute the SQL
dataProcessor.processData();
}catch (Exception e){
e.printStackTrace();
}
try{
FOProcessor foprocessor = new FOProcessor ();
foprocessor.setData("data.xml");
foprocessor.setTemplate("outTemplate.xls");
foprocessor.setOutput("outFileOK.rtf");
foprocessor.setOutputFormat(FOProcessor.FORMAT_RTF);
foprocessor.generate();
}catch(Exception ex){
ex.printStackTrace();
}
}
public static Connection getConnection() throws SQLException {
String username = "user";
String password = "pass";
String thinConn = "jdbc:oracle:thin:@dbtest.database.com:1525:TEST";
DriverManager.registerDriver(new OracleDriver());
Connection conn =
DriverManager.getConnection(thinConn, username, password);
conn.setAutoCommit(false);
return conn;
}
} |
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.sun.java.util.collections.Hashtable;
import oracle.apps.xdo.dataengine.DataProcessor;
import oracle.jdbc.driver.OracleDriver;
import oracle.apps.xdo.template.RTFProcessor;
import oracle.apps.xdo.template.FOProcessor;
class XML_PUBLISHER_RTF{
public static void main(String args[]) {
try{
RTFProcessor rtfProcessor = new RTFProcessor("template.rtf");
rtfProcessor.setOutput("outTemplate.xls");
rtfProcessor.process();
}catch (Exception e){
e.printStackTrace();
System.exit(1);
}
try {
DataProcessor dataProcessor = new DataProcessor();
Connection jdbcConnection = getConnection();
//Set the db connection
dataProcessor.setConnection(jdbcConnection);
// Set the SQL to be executed
dataProcessor.setSql( "select INCIDENT_ID, INCIDENT_NUMBER"
+"from cs_incidents_all_b where INCIDENT_ID < :INCIDENT_ID");
Hashtable parameters = new Hashtable();
//Setup the SuppID value to be used
parameters.put("INCIDENT_ID ","15");
//Set the parameters
dataProcessor.setParameters(parameters);
//Specify the output file name and location
dataProcessor.setOutput("data.xml");
//Specify the root element tag name for the generated output
dataProcessor.setRowTag("INCIDENT");
//Specify the row elemen tag name for the generated outputt
dataProcessor.setRowsetTag("INCIDENTS");
//Execute the SQL
dataProcessor.processData();
}catch (Exception e){
e.printStackTrace();
}
try{
FOProcessor foprocessor = new FOProcessor ();
foprocessor.setData("data.xml");
foprocessor.setTemplate("outTemplate.xls");
foprocessor.setOutput("outFileOK.rtf");
foprocessor.setOutputFormat(FOProcessor.FORMAT_RTF);
foprocessor.generate();
}catch(Exception ex){
ex.printStackTrace();
}
}
public static Connection getConnection() throws SQLException {
String username = "user";
String password = "pass";
String thinConn = "jdbc:oracle:thin:@dbtest.database.com:1525:TEST";
DriverManager.registerDriver(new OracleDriver());
Connection conn =
DriverManager.getConnection(thinConn, username, password);
conn.setAutoCommit(false);
return conn;
}
}