This function is provided when using Adelia Print Engine.
It is used to execute the FreeMarker template (or model) engine.
This engine takes the following as input:
- A template: a text file (.ftlx extension) defining the data display and presentation rules,
- A data source: a tree of objects encapsulating the data to display,
to produce a text document as output.
When executing FreeMarker, the template will receive the data to display then execute its print code. This is made up of static code in the output document format (e.g. an XML-type tag language) as well as dynamic code in FTL (FreeMarker Template Language) enabling data to be processed.
NB: this function is the Adelia counterpart of the APE "mergedoc" Web service.
Remember: The VaToolBx dll must already be loaded (LOAD_DLL instruction) when this function is called and must remain loaded when the VaToolBxAPEClearDataModel, VaToolBxAPETransformDoc, VaToolBxAPEAddInDataModel or VaToolBxAPEMergeAndTransformDoc functions are called.
Application area
- Java client,
- Java server,
- Adelia Web client,
- Adelia Cloud client.
Parameters
ALPHA(n) |
NamespaceName |
Name of the namespace. |
ALPHA(n) |
TemplateName |
Name of template to be processed. |
ALPHA(n) |
Locale |
Name of locale (in IETF BCP 47 format) to be applied when searching for and processing the template. |
ALPHA(n) |
ModelName |
Name of the data model used as a data source when processing the template. |
ALPHA(n) or IMAGE |
Options |
Definition of options to apply during template processing. |
IMAGE |
MergeDoc |
Result document from FreeMarker processing of the TemplateName template with the ModelName data source. |
NUM_BIN_2 |
ReturnCode |
Operation return code: 0: Operation completed successfully. -1: The template name cannot be empty. -2: The data model name does not correspond to any previously created data models. -3: Error when closing the MergeDoc result document. -4: Error during syntax analysis in JSON format of Options processing options. -5: Error during value analysis of Options processing options. -6: Input/output error during analysis of Options processing options. -7: The Options parameter must be ALPHA or IMAGE type. The errors described below relate to the FreeMarker processing of the template:
|
|
|
|
Namespace
This is a template group space.
Namespaces can be compared with folders: they behave in an identical way to a folder, there can be elements of the same name in different namespaces.
A namespace can also contain other namespaces.
Locale
This is used to specify the template to be looked up according to the information making up the locale (the language code, country or region code and variant).
Template processing options
The "Options" parameter is used to define additional characteristics in the template processing.
The format of options must be JSON: all the options are described in an object with each member describing an option, namely:
- extOutputTransform : result document formatting option (JSON String type),
- jsonPathConv : option to convert data from the data model before it is processed by the template (JSON array of Object type),
- jsonGenerator: option to produce a fake data model used in place of the ModelName data model in the template development phase (JSON object type).
For example
ALPHA(20) | NamespaceName |
ALPHA(20) | TemplateName |
ALPHA(10) | Locale |
ALPHA(20) | ModelName |
ALPHA(20) | Options |
IMAGE | MergeDoc |
NUM_BIN_2 | returnCode |
NamespaceName = 'stock/article'
TemplateName = 'detailArticle.ftlx'
Locale = 'en-CA'
ModelName = 'articleDataModel'
Options = '{ "jsonPathConv": [{"path": "$.expirationDate",
"class": "com.hardis.adelia.mergedocengine.datamodel.conversion.convertors.EpochToDateConversion"
}]
}'
CALL_DLL 'VaToolbx.dll' ' VaToolBxAPEMergeDoc' NamespaceName TemplateName Locale ModelName Options MergeDoc returnCode