Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Business Intelligence Publisher
11g Release 1 (11.1.1)

E17789-01


oracle.xdo.template
Class RTFProcessor

java.lang.Object
  extended by oracle.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

 

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

 

Method Summary
 java.util.Hashtable getFieldNameRelation(java.io.InputStream xsdStream)
          This new API is provided per bugfix 7545417 Return a hashtable contains parent and child mapping
 java.util.Hashtable getFieldNameRelation(java.lang.String xsdFile)
          This new API is provided per bugfix 7545417 Return a hashtable contains parent and child mapping
 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.xdo.common.xliff.TransUnit
 java.util.Hashtable getUserParameterLOV()
           
 java.lang.String[] getUserParameterLOVByName(java.lang.String parameterName)
           
 java.util.Hashtable getUserParameters()
          Return a java.util.hashtable of user defined parameters in the RTF template.
 java.util.Vector getUserParametersInOriginalOrder()
           
 java.util.Hashtable getUserParameterType()
          Return a java.util.hashtable of user defined parameter type(s) in the RTF template.
 java.lang.String[] getXMLFormedFieldNames()
          this new API is provided per bugfix 7609178 Return an String array of placeholder's element names found in the RTF file, only the names with xml formed in <xsl:value-of> elements are return..
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 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 setStyleTemplate(java.io.InputStream is)
           
 void setStyleTemplate(java.lang.String path)
          set Master Template File's path
 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

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

setStyleTemplate

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

setStyleTemplate

public void setStyleTemplate(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.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.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.xdo.XDOException
XDOException
Since:
4.0

getFieldNameRelation

public java.util.Hashtable getFieldNameRelation(java.lang.String xsdFile)
                                         throws XDOException
This new API is provided per bugfix 7545417 Return a hashtable contains parent and child mapping
Parameters:
xsdfile - name
Returns:
parent/child mapping relation key is parent elemnt name value : array of string which contains all the child elements names
Throws:
oracle.xdo.XDOException
XDOException
Since:
11g

getFieldNameRelation

public java.util.Hashtable getFieldNameRelation(java.io.InputStream xsdStream)
                                         throws XDOException
This new API is provided per bugfix 7545417 Return a hashtable contains parent and child mapping
Parameters:
xsdStream -
Returns:
parent/child mapping relation key is parent elemnt name value : array of string which contains all the child elements names
Throws:
oracle.xdo.XDOException
XDOException
Since:
11g

getXMLFormedFieldNames

public java.lang.String[] getXMLFormedFieldNames()
                                          throws XDOException
this new API is provided per bugfix 7609178 Return an String array of placeholder's element names found in the RTF file, only the names with xml formed in <xsl:value-of> elements are return..
Returns:
the String array of placeholders' element names
Throws:
oracle.xdo.XDOException
XDOException
Since:
11g

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.xdo.XDOException
XDOException
Since:
5.6

getUserParametersInOriginalOrder

public java.util.Vector getUserParametersInOriginalOrder()
                                                  throws XDOException
Throws:
XDOException

getUserParameterType

public java.util.Hashtable getUserParameterType()
                                         throws XDOException
Return a java.util.hashtable of user defined parameter type(s) in the RTF template.

the hashtable uses the parameter's name as the key, and the parameter's type as the hashed value. If the parameter type 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.

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

Returns:
the hashtable of user defined parameters' type
Throws:
oracle.xdo.XDOException
XDOException
Since:
11g

getUserParameterLOVByName

public java.lang.String[] getUserParameterLOVByName(java.lang.String parameterName)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

getUserParameterLOV

public java.util.Hashtable getUserParameterLOV()
                                        throws java.lang.Exception
Parameters:
none -
Returns:
hashtale, key is parameter Name, value is String[] which stores the list of value of parameter
Throws:
java.lang.Exception

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.xdo.template.RTFProccessor [-config <configfile.xml>] <input_file.rtf> <output_file.xsl>
Parameters:
args - parameters for this processor
Throws:
oracle.xdo.XDOException - raise XDOException if exception happens
XDOException
Since:
4.0

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Business Intelligence Publisher
11g Release 1 (11.1.1)

E17789-01


Copyright © 2010, Oracle. All rights reserved.