Skip navigation links

Oracle BI Publisher Java API Reference
Release 10.1.3.4


oracle.apps.xdo.template
Class FormProcessor

java.lang.Object
  extended by oracle.apps.xdo.template.FormProcessor


public class FormProcessor
extends java.lang.Object

The class FormProcessor is the entry class to merge data with an original template. Also, you can use this class from the command line. The following is a basic usage of FormProcessor.

  FormProcessor formProcessor = new FormProcessor();
  formProcessor.setTemplate(original_pdf_file_path); // or formProcessor.setTemplate(inputStream);
  formProcessor.setData(xfdf_file_path); // or formProcessor.setData(inputStream);
  formProcessor.setOutput(new_pdf_file_path); // or formProcessor.setOutput(outputStream);
  formProcessor.process();
 

The command line usage is following.

 java oracle.apps.xdo.template.FormProcessor <Template PDF file> <Data file> <Output file>
 

Please see XML Publisher Developer's Guide for more information.

Version:
4.0
Author:
Incheol Kang.
See Also:

Field Summary
static int FIELDTYPE_BUTTON
           
static int FIELDTYPE_CHECKBOX
           
static int FIELDTYPE_COMBOBOX
           
static int FIELDTYPE_LISTBOX
           
static int FIELDTYPE_RADIOBUTTON
           
static int FIELDTYPE_SIGNATURE
           
static int FIELDTYPE_TEXT
           
static int FIELDTYPE_UNKNOWN
           
static java.lang.String RCS_ID
           
static boolean RCS_ID_RECORDED
           

 

Constructor Summary
FormProcessor()
          Initializes a newly created FormProcessor object.
FormProcessor(java.io.InputStream systemConfigInputStream)
          Takes a system configuration InputStream.

 

Method Summary
 java.util.Hashtable getFieldInfo()
          Returns Hashtable which stores fields information.
 java.util.Enumeration getFieldNames()
          Returns field names.
 java.util.Enumeration getFieldNames(boolean includeReservedNames)
          Returns field names.
 int getFieldType(java.lang.String fieldName)
          Returns field type.
 java.lang.String getFieldValue(java.lang.String fieldName)
          Returns a field value for each field name.
 java.lang.Object getFieldValues(java.lang.String fieldName)
           
 int getPageNumber()
          Returns a number of pages of input PDF document.
static void main(java.lang.String[] args)
          Users can use this class from the command line like following.
 void makeOutputFlat(boolean flag)
          Deprecated. since 5.6
 boolean process()
          Generates a new document with data.
 void setAliases(java.util.Hashtable aliasTable)
          Sets fieldName aliases.
 void setConfig(java.io.InputStream docLevelInputStream)
          Sets a configuration for each document or template.
 void setConfig(java.util.Properties properties)
          Sets a configuration for each document or template.
 void setConfig(java.lang.String docLevelConfigPath)
          Sets a configuration for each document or template.
 void setData(java.util.Hashtable nameValuePair)
          Allows you to pass the data as Hashtable type.
 void setData(java.io.InputStream inputStream)
          Allows you to pass the data InputStream itself.
 void setData(java.io.Reader xmlDataReader)
          Allows you to pass a Reader instance.
 void setData(java.lang.String path)
          Allows you to pass the data file path itself.
 void setDataString(java.lang.String contents)
          Allows you to pass data as a String type.
 void setLocale(java.util.Locale locale)
          Sets the locale.
 void setLocale(java.lang.String locale)
          Sets a locale for each document or template.
 void setLOV(java.lang.String fieldName, java.util.Hashtable values)
          Sets the lov values for a combo box or list box field.
 void setLOV(java.lang.String fieldName, java.util.Vector internalValues, java.util.Vector labels)
          Sets the lov values for a combo box or list box.
 void setLOV(java.lang.String fieldName, java.util.Vector internalValues, java.util.Vector labels, java.lang.Object selectedValue)
          Sets the lov values for a combo box or list box.
 void setMetaInfo(java.io.InputStream xtmInputStream)
          Allows you to pass meta information as an InputStream.
 void setMetaInfo(java.lang.String path)
          Allows you to pass the file path to meta information(XTM).
 void setOutput(java.io.OutputStream os)
          Allows you to pass the new document OutputStream instead of the path.
 void setOutput(java.lang.String path)
          Allows you to pass the new document file name.
 void setTemplate(java.io.InputStream inputStream)
          Allows you to pass a template as an InputStream.
 void setTemplate(java.lang.String path)
          Allows you to pass the template as a path.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID
See Also:
Constant Field Values

RCS_ID_RECORDED

public static final boolean RCS_ID_RECORDED

FIELDTYPE_TEXT

public static final int FIELDTYPE_TEXT

FIELDTYPE_CHECKBOX

public static final int FIELDTYPE_CHECKBOX

FIELDTYPE_RADIOBUTTON

public static final int FIELDTYPE_RADIOBUTTON

FIELDTYPE_SIGNATURE

public static final int FIELDTYPE_SIGNATURE

FIELDTYPE_COMBOBOX

public static final int FIELDTYPE_COMBOBOX

FIELDTYPE_LISTBOX

public static final int FIELDTYPE_LISTBOX

FIELDTYPE_BUTTON

public static final int FIELDTYPE_BUTTON

FIELDTYPE_UNKNOWN

public static final int FIELDTYPE_UNKNOWN

Constructor Detail

FormProcessor

public FormProcessor()
Initializes a newly created FormProcessor object.
Parameters:
-
Since:
1.0
See Also:

FormProcessor

public FormProcessor(java.io.InputStream systemConfigInputStream)
Takes a system configuration InputStream.
If the InputStream is stale, then it won't work.
The XTM configuration can be included into the system configuration even though it's almost meaningless.
Parameters:
InputStream - the system configuration InputStream

Method Detail

getFieldInfo

public java.util.Hashtable getFieldInfo()
                                 throws FatalException
Returns Hashtable which stores fields information. The Hashtable's keys are field names themselves. The Hashtable's value is the Hashtable which includes value and object key pairs.
Returns:
the Hashtable which includes fields information.
Throws:
FatalException
Since:
1.0
See Also:

getFieldNames

public java.util.Enumeration getFieldNames()
Returns field names. This method internally calls getFieldInfo() as follows. If template is not set or invalid template is set, then returns null.\
  return getFieldInfo().keys();
 
Returns:
Enumeration the Enumeration which includes field names information.
Since:
1.0
See Also:

getFieldNames

public java.util.Enumeration getFieldNames(boolean includeReservedNames)
Returns field names.
If template is not set or invalid template is set, then returns null.
Some templates can include special fields.
The special fields can include following things.
If above information needs to be excluded, then use this method with parameter "false".
Parameters:
includeReservedNames - returns all of field names if it's true, otherwise, special field names won't be returned.
Returns:
Enumeration the Enumeration which includes field names.
Since:
4.5
See Also:

getFieldType

public int getFieldType(java.lang.String fieldName)
                 throws FatalException
Returns field type. This is not implemented yet, though.
Please refer to FormProcessor static variables.
Throws:
FatalException
Since:
6.0

getFieldValue

public java.lang.String getFieldValue(java.lang.String fieldName)
                               throws FatalException
Returns a field value for each field name.
Parameters:
fieldName - one field name.
Returns:
String field value information for specific field.
Throws:
FatalException
Since:
1.0
See Also:

getFieldValues

public java.lang.Object getFieldValues(java.lang.String fieldName)
                                throws FatalException
Parameters:
fieldName -
Returns:
Object Either String in most cases or Vector if it is ListBox Value.
Throws:
FatalException
Since:
6.0

getPageNumber

public int getPageNumber()
                  throws java.lang.Exception
Returns a number of pages of input PDF document.
If this is called before calling setTemplate(), then NullPointerException is thrown.
This method can be used before and after process(), however, this is used after process() in most cases.
Returns:
int a number of pages of input PDF document.
Throws:
java.lang.Exception
Since:
3.1
See Also:

setAliases

public void setAliases(java.util.Hashtable aliasTable)
Sets fieldName aliases.
In most cases, the alias is same as element name in XML.
The aliasTable should include "((String)fieldName, (String)alias)" pairs.
Setting aliasTable overrides the alias definition in either a XTM file or PDF template.
Parameters:
aliasTable - the Hashtable instance which contains "fieldName, alias" pairs.
Since:
4.0

setConfig

public void setConfig(java.io.InputStream docLevelInputStream)
Sets a configuration for each document or template.
Some of system properties can be updated with this setting.
Parameters:
InputStream - the document configuration InputStream.
Since:
3.5

setConfig

public void setConfig(java.lang.String docLevelConfigPath)
               throws java.io.FileNotFoundException
Sets a configuration for each document or template.
Some of system properties can be updated with this setting.
Parameters:
String - the document configuration absolute path.
Throws:
java.io.FileNotFoundException

setConfig

public void setConfig(java.util.Properties properties)
Sets a configuration for each document or template.
Some of system properties can be updated with this setting.
Parameters:
Properties - the document configuration properties.

setData

public void setData(java.lang.String path)
Allows you to pass the data file path itself. XFDF is one of data types.
Parameters:
path - this path specifies data file's absolute path.
Since:
1.0
See Also:
setDataString(String)

setData

public void setData(java.io.InputStream inputStream)
Allows you to pass the data InputStream itself.
Parameters:
inputStream - the inputStream which includes data.
Since:
3.0
See Also:
setData(String), setDataString(String)

setData

public void setData(java.io.Reader xmlDataReader)
Allows you to pass a Reader instance.
This method is mainly used when customers get XML from clob through JDBC.
When fetching XML data of clob through JDBC, they can call getCharacterStream() which returns Reader instance.
Parameters:
Reader - the Reader which includes data.
Since:
3.5
See Also:
setData(String), setDataString(String)

setData

public void setData(java.util.Hashtable nameValuePair)
Allows you to pass the data as Hashtable type. Structure is as follows. (fieldName, fieldValue)
Parameters:
nameValuePair - this Hashtable instance includes name and value pair.
Since:
2.0
See Also:
setData(String), setDataString(String)

setDataString

public void setDataString(java.lang.String contents)
Allows you to pass data as a String type. You can use either setData(..) or this method to set data such as XFDF.
Parameters:
contents - this contents specifies data contents as a String type.
Since:
1.0
See Also:
setData(String)

setLocale

public void setLocale(java.lang.String locale)
Sets a locale for each document or template.
If this is not specified, then system default locale will be used.
The value can be as follows.
Parameters:
String - the locale information
Since:
3.5

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale.
Parameters:
locale - java locale

setMetaInfo

public void setMetaInfo(java.lang.String path)
Allows you to pass the file path to meta information(XTM). Please refer to the XML Publisher documentation for more information about XTM.
Parameters:
path - the path which indicates XTM file.
Since:
3.0
See Also:
setMetaInfo(InputStream)

setMetaInfo

public void setMetaInfo(java.io.InputStream xtmInputStream)
Allows you to pass meta information as an InputStream. Please refer to XML Publisher documentation for more information.
Parameters:
InputStream - the InputStream which includes XTM(XML Template MetaInfo) file contents.
Since:
3.0
See Also:
setMetaInfo(String)

setOutput

public void setOutput(java.lang.String path)
Allows you to pass the new document file name. This path should be an absolute path which is based on O/S file separator.
Parameters:
path - this specifies a new document file path which will be generated.
Since:
1.0
See Also:
setOutput(OutputStream os)

setOutput

public void setOutput(java.io.OutputStream os)
Allows you to pass the new document OutputStream instead of the path. You have to open and close the OutputStream instance by yourself. The basic usage is as follows if this is used in servlet. Following example will send template stream to client side such as browser. You will need to set proper information first such as mime type and so on.
  ServletOutputStream outputStream = response.getOutputStream();
  formProcessor.setOutput(outputStream);
 
Parameters:
os - this specifies a new document OutputStream.
Since:
1.0
See Also:
setOutput(String)

setTemplate

public void setTemplate(java.lang.String path)
Allows you to pass the template as a path.
Parameters:
path - the absolute template path.
Since:
1.0
See Also:
setTemplate(InputStream)

setTemplate

public void setTemplate(java.io.InputStream inputStream)
Allows you to pass a template as an InputStream. If setTemplate(String pdfPath) is used at the same time, then setTemplate(InputStream is) has higher proiority. It means the InputStream of template contents will be used instead of the file path.
  FileInputStream fis = new FileInputStream(filePath);
  formProcessor.setTemplate(fis);
 
Parameters:
InputStream - this InputStream specifies a template file.
Since:
1.0
See Also:

makeOutputFlat

public void makeOutputFlat(boolean flag)
Deprecated. since 5.6
FormProcessor takes care of two kind of processing.
  1. The first one is to merge data into fields only.
  2. The second thing is to process repeatable fields.
If the first one is processed, then an output keeps fields even though users can't modify it using browser.
The second output doesn't contain fields.
If output is required not to contain any fields, please call this method with true argument.
Parameters:
flag - true if output is required to be flat, false otherwise.
Since:
4.5
See Also:

setLOV

public void setLOV(java.lang.String fieldName,
                   java.util.Hashtable values)
            throws java.lang.Exception
Sets the lov values for a combo box or list box field.
Note: This method does not guaranteee the sorting order of the values in the combo box or list box. The hashtable passed in is a string mapping of internal value to label. No value will be selected in the combo box or list box in this case. An exception is thrown if fieldName does not exist in the template or fieldName is not of type COMBOBOX or LISTBOX.
Parameters:
fieldName - the name of the combo box or list box field
values - hashtable string mapping of internal value to label
Throws:
java.lang.Exception
Since:
5.5
See Also:

setLOV

public void setLOV(java.lang.String fieldName,
                   java.util.Vector internalValues,
                   java.util.Vector labels)
            throws java.lang.Exception
Sets the lov values for a combo box or list box.
The first vector passed in is an ordered vector of internal values. The second vector passed in sets the ordering of labels in the combo or list box. No value will be selected in the combo box or list box in this case. An exception is thrown if fieldName does not exist in the template or fieldName is not of type COMBOBOX or LISTBOX.
Parameters:
fieldName - the name of the combo box or list box field
internalValues - an ordered vector of Strings consisting of the internal values
labels - an ordered vector of Strings consisting of the labels
Throws:
java.lang.Exception
Since:
5.5
See Also:

setLOV

public void setLOV(java.lang.String fieldName,
                   java.util.Vector internalValues,
                   java.util.Vector labels,
                   java.lang.Object selectedValue)
            throws java.lang.Exception
Sets the lov values for a combo box or list box.
The first vector passed in is an ordered vector of internal values. The second vector passed in sets the ordering of labels in the combo or list box. The last parameter specifies which internal value will get selected in the lov combo or list box. It maybe a String instance or Vector instance (for specifying of multiple selected values in the listbox case). An exception is thrown if fieldName does not exist in the template or fieldName is not of type COMBOBOX or LISTBOX.
Parameters:
fieldName - the name of the combo box or list box field
internalValues - an ordered vector of Strings consisting of the internal values
labels - an ordered vector of Strings consisting of the labels
selectedValue - this can be either a Vector of internal values or a single String instance indicating the selected value
Throws:
java.lang.Exception
Since:
5.5
See Also:

process

public boolean process()
Generates a new document with data. To use this method, setOutput(...), setTemplate(...) and either setData(...) or setDataString() must be set before calling.
Returns:
boolean true if it generates a new document successfully, false otherwise.
Since:
1.0
See Also:

main

public static void main(java.lang.String[] args)
Users can use this class from the command line like following.
  java oracle.apps.xdo.template.FormProcessor <Template PDF file> <Data file> <Output file>
 
Parameters:
String - pdf template path.
String - XFDF file path which includes fields value.
String - new pdf path which will be generated by Form Processor.
String - the meta info file path.

Skip navigation links

Oracle BI Publisher Java API Reference
Release 10.1.3.4


© 2004, 2005, 2006, 2007, 2008, Oracle. All rights reserved.