Projects:Export Store Data Task
As part of the store server project, there is a need to export the data relative to individual stores (organizations).
In this project an ant task will be created to export the store data. This task will be called export.store.data and will be similar to ImportSampleData, in the sense that it exports data based on a dataset definition into XML files.
Tracking issue to make ExportSampleData extensible: https://issues.openbravo.com/view.php?id=32040
Code repository: https://code.openbravo.com/erp/devel/dbsm-extend-import-sample-data
The new task should:
- Work with big volumes. ExportSampleData because for each exported table it needs to load in memory all the exported rows, in order to sort them before writing them in the XML file. The new task does have the registers sorted in the XML file.
- Take into account the whole natural tree of the given organization.
- Export the changes according to the definition of a dataset. The task will export the contents of the tables defined in a specific dataset. It will also respect the excluded columns defined for each dataset table (ExportSampleData already does this) and the SQL where clause defined in the dataset tables (ExportSampleData overwrites it with a simple client filter).
- It will allow to define several times the same table in the dataset. This is needed because depending on the row being exported, different columns can be excluded. The data belonging to the same table should end up in the same XML file, and the XML format must be proper (only one document start and document end per file).
As part of this project some work may be done in the import process to make it faster, as the data being imported will potentially be much bigger than our usual sample data.
Extending the ExportSampleData task
The ExportStoreTask has many things in common with the ExportSampleData task, it was decided that the best course of action would be to extend it.
The ExportSampleData was not designed having extensibility in mind, so a few changes need to be done to allow extending it to the extent the new task requires:
- The subclasses must be able to set the dataset that will be used to export the data
- The subclasses must be able to define their own way of exporting a daset table to XML
- The subclasses must be able to export several dataset tables into the same XML file