Import/Export CSV
It is possible to add functionality to import and/or export CSV files for each DataElement.
Define the options csv.import and csv.export on the target DataElement, or on a Component or Application
to provide the functionality to multiple DataElements.
These options add methods to import/export to the Agent:
ExportResult export(ExportQuery exportQuery) {}
ImportResult importFile(ImportFile importFile) {}
ApplicationApplicationInstanceComponentDataElementAdds functionality to import CSV files.
(Optionally) Add a value to provide a custom importer implementation. The referenced class should implement the net.democritus.upload.IImporter class.
<options>
<csv.import/>
</options>
<options>
<csv.import>net.demo.CustomStarshipCsvImporter</csv.import>
</options>
ApplicationApplicationInstanceComponentDataElementAdds functionality to export CSV files.
(Optionally) Add a value to provide a custom exporter implementation. The referenced class should implement the net.democritus.download.IExporter class.
<options>
<csv.export/>
</options>
<options>
<csv.export>net.demo.CustomStarshipCsvExporter</csv.export>
</options>
Menu
The options also add a /data page, where you can upload or download CSV files.
You can add this page to the menu with ref="{componentName}-{dataElementName}-io-page":
<menuitem ref='space-starship-io-page'/>
Export Button
Merging Behaviour
By default, the CSV import will create a new instance or, if an instance with the same name already exists, overwrite each field.
It is possible to change this behaviour to merge the imported fields with the already present values:
Disable CSV functionality
The base-components define several csv.import options to enable data provisioning.
In case you wish to disable this functionality, use the csv.disable option.