File extension
Summary
This extension generates files in one of the following formats: Excel, CSV, JSON, XML, JSONL, XMLL
Plugin ID
The plugin ID for File delivery is fr.cantor.c4i.FileDelivery.
Properties
Environment independent parameters (set in extension configuration or properties file)
| Property key | Description | Mandatory | Default value |
|---|---|---|---|
| configAssetId | The ID of the asset containing the YAML mappings | Yes | |
| connection | The name of the connection in the c4i.properties file | Yes | |
| prefixFileNamesWithContextId | true or false to indicate whether or not to prefix the file names with the context IDs | Yes | |
| outputFormat | CSV, EXCEL, JSON, JSONL, XML or XMLL | Yes | |
| suffixDestinationNamesWithStepXMLTimestamp | true or false to indicate if output file name should be suffixed with the timestamp from STEP exported file name or with the timestamp contained in the "ExportTime" attribute inside the STEPXML | No | false |
| includeEmptyTabs | true or false to indicate whether or not to include empty tabs when using Excel templates | No | false |
| csvSeparator | The CSV separator used to separate values, can be ,, \t,|,;, or (Space) | Only if outputFormat = CSV | |
| templateExtensions | A semicolon (;) separated list of extensions to resolve template files | No | .xlsx |
| cacheConfig | The ID of the asset containing the JCS configuration | No | |
| displayPerfStat | true to display performance statistics (see Performance statistics dedicated page) | No | false |
Environment dependent parameters (set in centralized c4i.properties file)
| Property key | Description | Mandatory | Default value |
|---|---|---|---|
| outputDirectory | The path of the directory where the output files will be written | Yes | |
| templateFolderPath | The path of the directory where the Excel template are in standalone mode only | No |
Configuration example
extensions.[0].pluginId=fr.cantor.c4i.FileDelivery
extensions.[0].configAssetId=C4I-Configuration
extensions.[0].connection=csv
extensions.[0].csvSeparator=;
extensions.[0].prefixFileNamesWithContextId=true
extensions.[0].outputFormat=CSV
extensions.[0].suffixDestinationNamesWithStepXMLTimestamp=false
extensions.[0].includeEmptyTabs=false
pluginId=fr.cantor.c4i.FileDelivery
configAssetId=/Path/to/C4I/Configuration.yml
connection=csv
csvSeparator=;
prefixFileNamesWithContextId=true
outputFormat=CSV
licenseAssetId=/Path/to/C4I/License.cat
suffixDestinationNamesWithStepXMLTimestamp=false
includeEmptyTabs=false
cacheConfig=/Path/to/JCS/Config.ccf
extensions.[0].pluginId=fr.cantor.c4i.FileDelivery
extensions.[0].configAssetId=C4I-Configuration
extensions.[0].connection=excel
extensions.[0].prefixFileNamesWithContextId=true
extensions.[0].suffixDestinationNamesWithStepXMLTimestamp=false
extensions.[0].outputFormat=EXCEL
extensions.[0].includeEmptyTabs=true
pluginId=fr.cantor.c4i.FileDelivery
configAssetId=/Path/to/C4I/Configuration.yml
connection=csv
prefixFileNamesWithContextId=true
outputFormat=EXCEL
licenseAssetId=/Path/to/C4I/License.cat
suffixDestinationNamesWithStepXMLTimestamp=false
includeEmptyTabs=true
cacheConfig=/Path/to/JCS/Config.ccf
excel.outputDirectory=/shared/upload/c4i-excel/
excel.templateFolderPath=/Path/to/Excel/Template/Folder
csv.outputDirectory=/shared/upload/c4i-csv/
JSON specificities
When producing JSON files, there are two formats for target node mapping :
- Simple (Array) :
${fileName}[{key}] - Complex (Object):
${fileName}://{target node path}[{key}]
Simple (Array) Mapping
Using this format will produce a JSON file containing an array whose elements will be the mapped nodes.
For example, given the following configuration:
- Product:
product[id]:
- ./@ID: id
The resulting file will contain a single JSON array. For each <Product> in the source file, a new object will be inserted.
[
{ "id": "Product1" },
{ "id": "Product2" }
]
Complex (Object) Mapping
Using this format will produce a JSON file containing a JSON Object whose values (or sub-values) will be JSON arrays containing the mapped nodes.
For example, given the following configuration:
- Product:
product://data.products[id]:
- ./@ID: id
The resulting file will contain a single JSON Object. For each <Product> in the source file, a new object will be inserted in the "data.products" array.
{
"data": {
"products": [
{ "id": "Product1" },
{ "id": "Product2" }
]
}
}
Arrays indices are not supported in the supplied path.
XML specificities
Target node mapping
When producing XML files, the format for target node mapping is the following : {fileName}://{target node xPath}[{key}]
For example, given the following configuration :
- Product:
product://MyCustomProducts/Product[./@ID]:
- ...
For each <Product> in the source file, a new <Product> element will be created underneath the root node <MyCustomProducts> in the output XML file [{contextId}]_product.xml.
The root node (in this case MyCustomProducts) must be the same across all the mapping rules for a given output file. Otherwise, a DOMException will be thrown when generating the file.
Converting JSON values to XML
JSON values such as returned by c4i custom functions are converted to XML, as shown by the following example :
<STEP-ProductInformation>
<Products>
<Product ID="PRD1">
<Name>Test Product</Name>
<Values>
<Value AttributeID="ATT_1">Example value</Value>
</Values>
</Product>
</Products>
</STEP-ProductInformation>
- Product:
products://Products/Product[./@ID]:
- ./@ID: ./@ID
- Name/text(): Name
- c4i:serializeValuesToJSON(Values): Values
<Products>
<Product ID="PRD1">
<Name>Test Product</Name>
<Values>
<ATT_1>Example Value</ATT_1>
</Values>
</Product>
</Products>