com.adobe.icc.ddg
Class LetterRenderServiceImpl

java.lang.Object
  extended by com.adobe.icc.ddg.LetterRenderServiceImpl
All Implemented Interfaces:
LetterRenderService

public class LetterRenderServiceImpl
extends java.lang.Object
implements LetterRenderService


Field Summary
static java.lang.String FIELD_NODE
           
static java.lang.String FIELDS_NODE
           
static java.lang.String VARIABLE_NODE
           
static java.lang.String VARIABLES_NODE
           
 
Fields inherited from interface com.adobe.icc.ddg.api.LetterRenderService
LAYOUT_TEMPLATE_KEY, XML_DATA_KEY
 
Constructor Summary
LetterRenderServiceImpl()
           
 
Method Summary
static java.lang.String flatten(java.util.List fromList, java.lang.String toFlatList)
           
 java.lang.String getExtendedLayoutPath(java.lang.String letterId, java.lang.String initialDataXML, boolean useTestData)
          Extends the layout with the following, and returns the repository path to the prepared layout (XDP):

1.
 java.util.Map processLetter(Letter letter, java.lang.String initialDataXML, boolean useTestData)
          Process the given Letter object, preparing the augmented layout template and final XML data that can be merged together in the desired render format.
 java.util.Map processLetter(Letter letter, java.lang.String initialDataXML, LetterRenderOptionsSpec letterRenderOptionsSpec)
          Process the Letter identified by the given Letter ID, preparing the augmented layout template and final XML data that can be merged together in the desired render format.
 java.util.Map processLetter(java.lang.String letterId, java.lang.String initialDataXML, boolean useTestData)
          Process the Letter identified by the given Letter ID, preparing the augmented layout template and final XML data that can be merged together in the desired render format.
 java.util.Map processLetter(java.lang.String letterId, java.lang.String initialDataXML, LetterRenderOptionsSpec letterRenderOptionsSpec)
          Process the Letter identified by the given Letter ID, preparing the augmented layout template and final XML data that can be merged together in the desired render format.
 byte[] renderLetter(Letter letter, java.lang.String dataXML, boolean renderInteractive)
          Render the given Letter object against the given data XML.
 PDFResponseType renderLetter(Letter letter, java.lang.String initialDataXML, boolean mergeDataOnServer, boolean useTestData, boolean renderInteractive)
          Render the CTD against the given data XML.
 PDFResponseType renderLetter(Letter letter, java.lang.String initialDataXML, boolean mergeDataOnServer, boolean useTestData, boolean renderInteractive, boolean saveToFile)
          Render the CTD against the given data XML.
 PDFResponseType renderLetter(Letter letter, java.lang.String initialDataXML, LetterRenderOptionsSpec letterRenderOptionsSpec)
          Render the CTD against the given data XML.
 byte[] renderLetter(java.lang.String letterId, java.lang.String dataXML, boolean renderInteractive)
          Render the given Letter, identified by the letter ID, against the given data XML.
 PDFResponseType renderLetter(java.lang.String letterId, java.lang.String initialDataXML, boolean mergeDataOnServer, boolean useTestData, boolean renderInteractive)
          Render the CTD against the given data XML.
 PDFResponseType renderLetter(java.lang.String letterId, java.lang.String initialDataXML, boolean mergeDataOnServer, boolean useTestData, boolean renderInteractive, boolean saveToFile)
          Render the CTD against the given data XML.
 PDFResponseType renderLetter(java.lang.String letterId, java.lang.String initialDataXML, LetterRenderOptionsSpec letterRenderOptionsSpec)
          Render the CTD against the given data XML.
 java.lang.String serializeDataElementsToXML(java.lang.String ddiAsXml, java.util.Map phValues, java.util.Map fieldValues)
          Serialize data elements into XML by appending Fields/Variables elements to the input xml.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VARIABLE_NODE

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

VARIABLES_NODE

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

FIELD_NODE

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

FIELDS_NODE

public static final java.lang.String FIELDS_NODE
See Also:
Constant Field Values
Constructor Detail

LetterRenderServiceImpl

public LetterRenderServiceImpl()
Method Detail

getExtendedLayoutPath

public java.lang.String getExtendedLayoutPath(java.lang.String letterId,
                                              java.lang.String initialDataXML,
                                              boolean useTestData)
                                       throws ICCException
Extends the layout with the following, and returns the repository path to the prepared layout (XDP):

1. Add fragment layout xdp bytes to the layout xdp. 2. Add additions to the XDP's <dataDescription> such that Target Areas (subforms) for which data bindings are generated are appropriately represented, leveraging XFA 3.1's Data Description Injection. This will enable data within the "icc:" space — which is not within the form's optional (corporate) schema — to be imported/exported into/out of the PDF from Reader.

3. Inject XFA Module Object into all subforms identified as Target Areas, such that they can contain and show the Content that they may be related to in the Letter template.

Specified by:
getExtendedLayoutPath in interface LetterRenderService
Parameters:
letterId - ID of the Letter whose extended layout is to be fetched.
initialDataXML - Initial XML data that is used to initialize the associated Data Dictionary (if any), and also augmented and merged with the Letter's layout template.
useTestData - True if the Letter's test data is to be used, rather than an external XML data.
Returns:
Creates a temporary file for extended layout in repository and returns its path.
Throws:
ICCException

processLetter

public java.util.Map processLetter(java.lang.String letterId,
                                   java.lang.String initialDataXML,
                                   boolean useTestData)
                            throws ICCException
Process the Letter identified by the given Letter ID, preparing the augmented layout template and final XML data that can be merged together in the desired render format.

Specified by:
processLetter in interface LetterRenderService
Parameters:
letterId - ID of the Letter which is to be processed.
initialDataXML - Initial XML data that is used to initialize the associated Data Dictionary (if any), and also augmented and merged with the Letter's layout template.
useTestData - specify whether to use the Letter's test data as initial XML data or not.
Returns:
A result Map that contains the augmented layout template and the final XML data.

The Layout template can be fetched by the key 'layoutTemplate', with the value being a byte array (byte[]).
The XML data can be fetched by the key 'xmlData', with the value being a byte array (byte[]).
Throws:
ICCException

processLetter

public java.util.Map processLetter(java.lang.String letterId,
                                   java.lang.String initialDataXML,
                                   LetterRenderOptionsSpec letterRenderOptionsSpec)
                            throws ICCException
Process the Letter identified by the given Letter ID, preparing the augmented layout template and final XML data that can be merged together in the desired render format.

Specified by:
processLetter in interface LetterRenderService
Parameters:
letterId - ID of the Letter which is to be processed.
initialDataXML - Initial XML data that is used to initialize the associated Data Dictionary (if any), and also augmented and merged with the Letter's layout template.
letterRenderOptionsSpec - specifies options to process letter.
Returns:
A result Map that contains the augmented layout template and the final XML data.

The Layout template can be fetched by the key 'layoutTemplate', with the value being a byte array (byte[]).
The XML data can be fetched by the key 'xmlData', with the value being a byte array (byte[]).
Throws:
ICCException

processLetter

public java.util.Map processLetter(Letter letter,
                                   java.lang.String initialDataXML,
                                   boolean useTestData)
                            throws ICCException
Process the given Letter object, preparing the augmented layout template and final XML data that can be merged together in the desired render format.

Specified by:
processLetter in interface LetterRenderService
Parameters:
letter - The Letter object which is to be processed.
initialDataXML - Initial XML data that is used to initialize the associated Data Dictionary (if any), and also augmented and merged with the Letter's layout template.
useTestData - specify whether to use the Letter's test data as initial XML data or not.
Returns:
A result Map that contains the augmented layout template and the final XML data.

The Layout template can be fetched by the key 'layoutTemplate', with the value being a byte array (byte[]).
The XML data can be fetched by the key 'xmlData', with the value being a byte array (byte[]).
Throws:
ICCException

processLetter

public java.util.Map processLetter(Letter letter,
                                   java.lang.String initialDataXML,
                                   LetterRenderOptionsSpec letterRenderOptionsSpec)
                            throws ICCException
Process the Letter identified by the given Letter ID, preparing the augmented layout template and final XML data that can be merged together in the desired render format.

Specified by:
processLetter in interface LetterRenderService
Parameters:
letter - The Letter object which is to be processed.
initialDataXML - Initial XML data that is used to initialize the associated Data Dictionary (if any), and also augmented and merged with the Letter's layout template.
letterRenderOptionsSpec - specifies options to process letter.
Returns:
A result Map that contains the augmented layout template and the final XML data.

The Layout template can be fetched by the key 'layoutTemplate', with the value being a byte array (byte[]).
The XML data can be fetched by the key 'xmlData', with the value being a byte array (byte[]).
Throws:
ICCException

renderLetter

public byte[] renderLetter(java.lang.String letterId,
                           java.lang.String dataXML,
                           boolean renderInteractive)
                    throws ICCException
Render the given Letter, identified by the letter ID, against the given data XML. This would return a flat PDF file, with data populated per the data XML provided. Note 1: The data XML in such cases is a must. Note 2: This API is not intended to be called from an ActionScript client due to the byte[] return type. ActionScript clients should use the alternate APIs which can save the PDF to a temporary file so that the client can access it via a URL.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letterId - ID of the Letter/CT for which the PDF has to be generated
dataXML - XML data to be merged with the Layout template
renderInteractive - specify whether to render an interactive or flat PDF
Returns:
flattened PDF bytes
Throws:
ICCException

renderLetter

public byte[] renderLetter(Letter letter,
                           java.lang.String dataXML,
                           boolean renderInteractive)
                    throws ICCException
Render the given Letter object against the given data XML. This would return a flat PDF file, with data populated per the data XML provided. Note 1: The data XML in such cases is a must. Note 2: This API is not intended to be called from an ActionScript client due to the byte[] return type. ActionScript clients should use the alternate APIs which can save the PDF to a temporary file so that the client can access it via a URL.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letter - The Letter object for which the PDF has to be generated
dataXML - XML data to be merged with the Layout template
renderInteractive - specify whether to render an interactive or flat PDF
Returns:
flattened PDF bytes
Throws:
ICCException

renderLetter

public PDFResponseType renderLetter(java.lang.String letterId,
                                    java.lang.String initialDataXML,
                                    boolean mergeDataOnServer,
                                    boolean useTestData,
                                    boolean renderInteractive)
                             throws ICCException
Render the CTD against the given data XML. If there is a need to simply render the Letter without merging data with it, *mergeData* should be set to false.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letterId - ID of the Letter/CT to be rendered
initialDataXML - XML data to be merged with the Layout template
mergeDataOnServer - False if we only need to render the Letter, without merging data with it. If False, the letter is also augmented with the FormBridge library for use in an interactive filling environment. True if data needs to be merged (in which case the FormBridge library is not included). If true, the PDF bytes are returned; if false, the bytes are not returned and the PDF is saved to a temporary location that so that it can be loaded from the client using a URL to the file name in the PDFResponseType.
useTestData - specify whether to use test data for rendering or not
renderInteractive - specify whether to render an interactive or flat PDF
Returns:
PDFResponseType that contains the PDFFile object
Throws:
ICCException

renderLetter

public PDFResponseType renderLetter(Letter letter,
                                    java.lang.String initialDataXML,
                                    boolean mergeDataOnServer,
                                    boolean useTestData,
                                    boolean renderInteractive)
                             throws ICCException
Render the CTD against the given data XML. If there is a need to simply render the Letter without merging data with it, *mergeData* should be set to false.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letter - Correspondence Template to be rendered -- must be the *full* letter object containing all necessary data and assignments.
initialDataXML - XML data to be merged with the Layout template
mergeDataOnServer - False if we only need to render the Letter, without merging data with it. If False, the letter is also augmented with the FormBridge library for use in an interactive filling environment. True if data needs to be merged (in which case the FormBridge library is not included). If true, the PDF bytes are returned; if false, the bytes are not returned and the PDF is saved to a temporary location that so that it can be loaded from the client using a URL to the file name in the PDFResponseType.
useTestData - specify whether to use test data for rendering or not
renderInteractive - specify whether to render an interactive or flat PDF
Returns:
PDFResponseType that contains the PDFFile object
Throws:
ICCException

renderLetter

public PDFResponseType renderLetter(java.lang.String letterId,
                                    java.lang.String initialDataXML,
                                    boolean mergeDataOnServer,
                                    boolean useTestData,
                                    boolean renderInteractive,
                                    boolean saveToFile)
                             throws ICCException
Render the CTD against the given data XML.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letterId - ID of the Letter/CT to be rendered
initialDataXML - XML data to be merged with the Layout template
mergeDataOnServer - False if we only need to render the Letter, without merging data with it. If False, the letter is also augmented with the FormBridge library for use in an interactive filling environment. True if data needs to be merged (in which case the FormBridge library is not included).
useTestData - specify whether to use test data for rendering or not
renderInteractive - specify whether to render an interactive or flat PDF
saveToFile - true to have the PDF saved to a temporary file for retrieval via URL from the client; false to have the PDF bytes returned in the PDFResponseType response.
Returns:
PDFResponseType that contains the PDFFile object
Throws:
ICCException

renderLetter

public PDFResponseType renderLetter(java.lang.String letterId,
                                    java.lang.String initialDataXML,
                                    LetterRenderOptionsSpec letterRenderOptionsSpec)
                             throws ICCException
Render the CTD against the given data XML. If there is a need to simply render the Letter without merging data with it, *mergeData* should be set to false.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letterId - ID of the Letter/CT to be rendered.
initialDataXML - XML data to be merged with the Layout template.
letterRenderOptionsSpec - specifies options to render letter.
Returns:
PDFResponseType that contains the PDFFile object
Throws:
ICCException

renderLetter

public PDFResponseType renderLetter(Letter letter,
                                    java.lang.String initialDataXML,
                                    boolean mergeDataOnServer,
                                    boolean useTestData,
                                    boolean renderInteractive,
                                    boolean saveToFile)
                             throws ICCException
Render the CTD against the given data XML.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letter - Correspondence Template to be rendered -- must be the *full* letter object containing all necessary data and assignments.
initialDataXML - XML data to be merged with the Layout template
mergeDataOnServer - False if we only need to render the Letter, without merging data with it. If False, the letter is also augmented with the FormBridge library for use in an interactive filling environment. True if data needs to be merged (in which case the FormBridge library is not included).
useTestData - specify whether to use test data for rendering or not
renderInteractive - specify whether to render an interactive or flat PDF
saveToFile - true to have the PDF saved to a temporary file for retrieval via URL from the client; false to have the PDF bytes returned in the PDFResponseType response.
Returns:
PDFResponseType that contains the PDFFile object
Throws:
ICCException

renderLetter

public PDFResponseType renderLetter(Letter letter,
                                    java.lang.String initialDataXML,
                                    LetterRenderOptionsSpec letterRenderOptionsSpec)
                             throws ICCException
Render the CTD against the given data XML. If there is a need to simply render the Letter without merging data with it, *mergeData* should be set to false.

Specified by:
renderLetter in interface LetterRenderService
Parameters:
letter - Correspondence Template to be rendered -- must be the *full* letter object containing all necessary data and assignments.
initialDataXML - XML data to be merged with the Layout template.
letterRenderOptionsSpec - specifies options to render letter.
Returns:
PDFResponseType that contains the PDFFile object
Throws:
ICCException

flatten

public static java.lang.String flatten(java.util.List fromList,
                                       java.lang.String toFlatList)

serializeDataElementsToXML

public java.lang.String serializeDataElementsToXML(java.lang.String ddiAsXml,
                                                   java.util.Map phValues,
                                                   java.util.Map fieldValues)
                                            throws ICCException
Serialize data elements into XML by appending Fields/Variables elements to the input xml.

Specified by:
serializeDataElementsToXML in interface LetterRenderService
Parameters:
ddiAsXml - Serialize XML input data for DDI to be used
phValues - is map having PH values with key as place holder variable name
fieldValues - is map having Field values with key as somExpr of the Field
Returns:
String representing XML having data element as provided into dataElementValues
Throws:
ICCException


[an error occurred while processing this directive] [an error occurred while processing this directive]