Skip navigation links

Oracle BI Publisher Java API Reference
Release 10.1.3.4


oracle.apps.xdo.template
Class RTFProcessor

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


public final class RTFProcessor
extends java.lang.Object

The class RTFProcessor class is the front-end class to use RTF Processing engine. To use RTFProcessor class, users have to instanciate this class and set parameters such as input, output and control parameters.

After setting the parameters, you can start processing by calling process() method.

Typical usage is following:

RTFProcessor processor = new RTFProcessor("/home/system.rtf");
 
processor.setOutput("/home/sample.xsl");
processor.process();

Stream data are also allowed to be set.

RTFProcessor processor = new RTFProcessor(rtfInputStream);
processor.setOutput(xslOutputStream);
processor.process();


Since:
4.0
Author:
ejiang

Field Summary
static int EXTRACT_AUTO
          This value is to let the processor to automatically choose whether it needs to extract attribute sets or not.
static int EXTRACT_DISABLE
          This value is to let the processor not to extract attribute sets, this is suitable for sub template.
static int EXTRACT_ENABLE
          This value is to force the processor to extract attribute sets, this is suitable for stand-alone template
static java.lang.String RCS_ID
           
static boolean RCS_ID_RECORDED
           

 

Constructor Summary
RTFProcessor(java.io.InputStream is)
          Constructor
RTFProcessor(java.lang.String path)
          Constructor

 

Method Summary
 java.lang.String[] getFieldNames()
          Return an String array of placeholder's element names found in the RTF file, only the names in <xsl:value-of> elements are return.
 java.util.Hashtable getTransUnits()
          Return a java.util.Hashtable of xliff's translate units key is the translate unit's ID, value is oracle.apps.xdo.common.xliff.TransUnit
 java.util.Hashtable getUserParameters()
          Return a java.util.hashtable of user defined parameters in the RTF template.
static void main(java.lang.String[] args)
          Command line utility.
 org.w3c.dom.Document process()
          Run the RTF compiler to convert RTF to XSL.
 void setConfig(java.io.InputStream docLevelInputStream)
          Sets the configuration for the document to be processed.
 void setConfig(java.util.Properties prop)
          Sets the configuration for the document to be processed.
 void setConfig(java.lang.String docLevelConfigPath)
          Sets the configuration for the document to be processed.
 void setExtractAttributeSet(int flag)
          Deprecated.  
 void setExtractXLIFF(boolean toExtract)
          Sets the flag to extract xliff file or not
 void setLocale(java.util.Locale locale)
          Sets the locale.
 void setLocale(java.lang.String locale)
          Sets the locale setting.
 void setMasterTemplate(java.io.InputStream is)
           
 void setMasterTemplate(java.lang.String path)
          set Master Template File's path
 void setOutput(java.io.OutputStream os)
          Set the output stream for XSL file
 void setOutput(java.lang.String path)
          Set the output XSL file's path
 void setSequenceID(java.lang.String seqID)
          Sets the sequence ID of current RTF template for sub-template generation
 void setXLIFFOutput(java.io.OutputStream os)
          Set the output stream for XLIFF file Calling this method will automatically turn on the xliff extraction flag.
 void setXLIFFOutput(java.lang.String path)
          Set the output XLIFF file's 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

EXTRACT_ENABLE

public static final int EXTRACT_ENABLE
This value is to force the processor to extract attribute sets, this is suitable for stand-alone template
Since:
5.5

EXTRACT_AUTO

public static final int EXTRACT_AUTO
This value is to let the processor to automatically choose whether it needs to extract attribute sets or not. The logic behind this is if the template has imported sub RTF template, then attribute set won't be extracted. Otherwise, sub template will be extracted. This is the default value.
Since:
5.5

EXTRACT_DISABLE

public static final int EXTRACT_DISABLE
This value is to let the processor not to extract attribute sets, this is suitable for sub template.
Since:
5.5

Constructor Detail

RTFProcessor

public RTFProcessor(java.lang.String path)
             throws java.io.IOException
Constructor
Parameters:
path - RTF source file's path
Throws:
java.io.IOException - if file cannot be created
java.io.IOException
Since:
4.0

RTFProcessor

public RTFProcessor(java.io.InputStream is)
Constructor
Parameters:
in - RTF input stream
Since:
4.0

Method Detail

setOutput

public void setOutput(java.lang.String path)
               throws java.io.IOException
Set the output XSL file's path
Parameters:
path - the output XSL file's path
Throws:
java.io.IOException - if file cannot be created
java.io.IOException
Since:
4.0

setMasterTemplate

public void setMasterTemplate(java.lang.String path)
                       throws java.io.IOException
set Master Template File's path
Throws:
java.io.IOException

setMasterTemplate

public void setMasterTemplate(java.io.InputStream is)

setXLIFFOutput

public void setXLIFFOutput(java.lang.String path)
                    throws java.io.IOException
Set the output XLIFF file's path. Calling this method will automatically turn on the xliff extraction flag. To turn it off, call setExtractXLIFF(boolean toExtract)
Parameters:
path - the output XLIFF file's path
Throws:
java.io.IOException - if file cannot be created
java.io.IOException
Since:
5.0

setExtractAttributeSet

public void setExtractAttributeSet(int flag)
Deprecated. 
Set the flag the enable/disable parser to extract attribute set default value is enabled, default value is EXTRACT_AUTOMATIC After 5.6.3, new XSLT run-time optimization made this obsolete.
Parameters:
flag - Set the value of how the processor will handle the attribute sets
Since:
5.5
See Also:
EXTRACT_AUTOMATIC, EXTRACT_DISABLE, EXTRACT_ENABLE

setOutput

public void setOutput(java.io.OutputStream os)
Set the output stream for XSL file
Parameters:
out - the outputStream for the XSL
Since:
4.0

setXLIFFOutput

public void setXLIFFOutput(java.io.OutputStream os)
Set the output stream for XLIFF file Calling this method will automatically turn on the xliff extraction flag. To turn it off, call setExtractXLIFF(boolean toExtract)
Parameters:
out - the outputStream for the XLIFF
Since:
4.0

process

public org.w3c.dom.Document process()
                             throws XDOException
Run the RTF compiler to convert RTF to XSL. It returns an org.w3c.dom.Document object representing the XSL, returns null if processed unsuccessfully. If the OutputStream is set, then it also writes the xsl to the OutputStream
Returns:
the XSL as a DOM document object
Throws:
oracle.apps.xdo.XDOException
XDOException
Since:
4.0

setLocale

public void setLocale(java.lang.String locale)
Sets the locale setting.
If this is not specified, then the system default locale will be used.
The value can be as follows.
Parameters:
locale - local String
Since:
4.3

setLocale

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

setConfig

public void setConfig(java.util.Properties prop)
Sets the configuration for the document to be processed. This method allows you to set the difference from the system configuration.
Parameters:
prop - Properties for the document level configuration
Since:
4.3

setConfig

public void setConfig(java.io.InputStream docLevelInputStream)
Sets the configuration for the document to be processed. This method allows you to set the difference from the system configuration.
Parameters:
configStream - InputStream for the document level configuration
Since:
4.3

setExtractXLIFF

public void setExtractXLIFF(boolean toExtract)
Sets the flag to extract xliff file or not
Parameters:
toExtract - true if want to extract xliff from the generated rtf template
Since:
5.0

getTransUnits

public java.util.Hashtable getTransUnits()
Return a java.util.Hashtable of xliff's translate units key is the translate unit's ID, value is oracle.apps.xdo.common.xliff.TransUnit
Returns:
a java.util.Hashtable of xliff's translate units
Since:
5.1

setSequenceID

public void setSequenceID(java.lang.String seqID)
Sets the sequence ID of current RTF template for sub-template generation
Parameters:
seqID - the sequence id to be set
Since:
5.0

setConfig

public void setConfig(java.lang.String docLevelConfigPath)
Sets the configuration for the document to be processed. This method allows you to set the difference from the system configuration.
Parameters:
configFilePath - file path for the document level configuration
Since:
4.3

getFieldNames

public java.lang.String[] getFieldNames()
                                 throws XDOException
Return an String array of placeholder's element names found in the RTF file, only the names in <xsl:value-of> elements are return.
Returns:
the String array of placeholders' element names
Throws:
oracle.apps.xdo.XDOException
XDOException
Since:
4.0

getUserParameters

public java.util.Hashtable getUserParameters()
                                      throws XDOException
Return a java.util.hashtable of user defined parameters in the RTF template.

the hashtable uses the parameter's name as the key, and the default value as the hashed value. If default value is empty, it uses an empty string, i.e. "" without the double quotes.

Notice that, xsl:param can either accept default value from attribute "select" or from text node. RTF template checks if the attribute "select"'s value is empty or not, if not empty, use the attribute's value, if it's empty, uses the text node's value. This behavior is as same as the xslt engine's behavior.

If default value is set in attribute "select", it's usually an xpath statement. If default value is set as text node, it's usually a string. It's up to the user to choose which way they want to construct the xsl:param element, and hence how to parse the default values returned by the method. As a common convernion, we suggest user all to use attribute "select", not use text node.

RTF template also supports an extended attribute xdofo:label to specify a more readable label or description of the parameter, e.g.:

The first one uses XSLT's native notation
The second one uses XML Publisher's alias

When a parameter element has an xdofo:label attribute, the key is returned as following format
parameter_name(label), e.g., the key of the hash of above example is revenue(Mimimum Revenue to Be Shown) and the value is 0

This method only returns user-defined global parameters, and it doesn't return parameters in the sub-template or xml publisher's internal parameters.

Returns:
the hashtable of user defined parameters
Throws:
oracle.apps.xdo.XDOException
XDOException
Since:
5.6

main

public static final void main(java.lang.String[] args)
                       throws XDOException
Command line utility. The compile an RTF file to an XSL/FO file, you can use: java oracle.apps.xdo.template.RTFProccessor [-config <configfile.xml>] <input_file.rtf> <output_file.xsl>
Parameters:
args - parameters for this processor
Throws:
oracle.apps.xdo.XDOException - raise XDOException if exception happens
XDOException
Since:
4.0

Skip navigation links

Oracle BI Publisher Java API Reference
Release 10.1.3.4


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