Hi,
@stukalov and myself created a cuba-application component that you can use. It is in preview mode currently. Before releasing it “officially” i would like to get your feedback on it. It is open source (Apache 2 license) and you can find it on Github:
If you have any thoughts on that, like bug, feature requests etc. I would love to hear from you.
I’ll just copy over the README.md so you get an impression on what it does:
CUBA Platform Component - Data import
This application component let’s you easily import data into your application from various sources.
Installation
-
Add the following maven repository
https://dl.bintray.com/mariodavid/cuba-components
to the build.gradle of your CUBA application:buildscript { repositories { maven { url "https://dl.bintray.com/mariodavid/cuba-components" } } }
-
Select a version of the add-on which is compatible with the platform version used in your project:
Platform Version | Add-on Version |
---|---|
6.8.x | 0.1.x |
Add custom application component to your project:
- Artifact group:
de.diedavids.cuba.dataimport
- Artifact name:
data-import-global
- Version: add-on version
Using the application component
The data-import
application component helps you import data into your system from different files.
Currently the following file-types are supported:
- Excel
.xlsx
- comma separated values
.csv
In order to configure various import options, there is a UI based configuration possibility to define
- which entity will be imported
- which columns maps to which entity attribute
- format configuration for dates, boolean values etc.
- unique configurations and how to deal with these situations
- custom groovy scripts for attributes to value mapping
There are two modes of using the data-import
application component. The first one is an interactive UI wizard, which
will guide the user directly through the process of importing the data.
The second mode is, that the import configuration can be pre-defined by a developer / administrator of the system.
The end-user of the system can reuse this configurations and just uploads the file that should get imported.
Import wizard
The import wizard allows the user to interactively go through the import process and configure the above mentioned settings
for the import execution. It can be found in the main menu: Administration > Data Import > Import Wizard
Step 1: Upload file
Step 2: Configure entity mapping
The second step in the wizard allows the user to configure which columns of the import file will be mapped to which entity
attributes. The system makes suggestions based on the similarities of the entity attribute names and the column headers
in the import file, but this can be adjusted by the user if needed.
Step 3: Import Configuration
In the import configuration it is possible to define certain Format options as well as the unique configurations for this import.
Step 4: Import Preview
The last step will preview the data that was received from the import file. With “Start Import” the import process
will be triggered. Afterwards the user will see a summary of how many entities were imported correctly.