One app we are working on needs to upload categorized product images for different customers. To make images organized, we designed the storage structure to be something like this:
fileStorageRoot |--productImages |--companyA | |--productCategory1 | | |-- productImage1.1 | | |-- productImage1.2 | | |-- ... ... | | | |--productCategory2 | |-- productImage2.1 | |-- productImage2.2 | |-- ... ... | --companyB | | (similar to companyA structure, so skip here) |
In Product entity, we have a String type attribute “storagePath” which records the folder path where the product image should be stored.
The current implementation in cuba_FileStorage bean hard coded the storage folder structure to be yyyy/mm/dd, which is inflexible.
I noticed this topic that user can override the cuba_FileStorage bean. But it needs to override too many methods:
Could cuba_FileStorage provide a way that user can pass in a customized storagePath String, like “productImages/companyA/productCategory1” when upload a file?