Using the data import as a non-GUI service sort of a thing

Hi there. I think this is one for Mario.

I’d like to create a service to import a list of countries into the application into the app when it starts up (if the list of countries does not exist). I have the list in a CSV file, so I thought I could leverage the data import add-on to do the heavy lifting.

Is there a guide to using the data import in this way?

Hi,

jupp, it is possible. The main interaction point would be GenericDataImporterService (see: cuba-component-data-import/GenericDataImporterService.java at master · mariodavid/cuba-component-data-import · GitHub)

You have to create ImportData instances manually (see cuba-component-data-import/ImportDataImplSpec.groovy at master · mariodavid/cuba-component-data-import · GitHub for a example usage).

However, the use-case you describe seems to be like the admin-tools-addon also covers your case. See: GitHub - cuba-platform/admin-tools-addon: Interactive runtime diagnosis for CUBA applications for more details.

Bye
Mario

1 Like