Hi, I am creating an object that exports critical data from the system into multiple JSON ZIP files. These can later be imported to help with environment migration. The problem I’m having is that the files are written out with an unexpected/cryptic file name. The file is written with the ID of the file descriptor, instead of the name of the file descriptor. Through debugging, I see the issue is in FileStorage.
the file storage mechanisms of CUBA store the actual file with the UUID of the FileDescriptor as the filename. This is by purpose and also necessary.
The directory where the raw files are stored should not be actual part of something you interact with (except storing).
So if you want to use these files, you should always go through the FileStorageAPI and or FileStorageService. When interacting with the FileDescriptor instances, you can easily get the original filename from them, as they are stored in the DB.
Thanks Mario. Could I ask for your advice? I’m actually leveraging your code for loading seed data. And I’m using the application to create the seed data. But exporting via entity inspector is tedious and risky because I may forget a relationship. So I was creating a bean to export a list of multiple files to be later imported, perhaps in another environment. How do I create the files with the custom names? Could you point me in the right direction?