Hi all,
I need to upload many documents for a NEW customer.
The Document is a separate entity and the relation with Client is Composition.
The document has also a reference with the customer which is many-to-one
I ADDED a MultiUploadFile to select these files in the CustomerEdit window, since the proper MultiUpload on the DocumentEditor gave me “cascade-perist” or “duplicate-pk (on the client)” error while tryng to add these documents from there (no errors with a pre-existent customer).
So I finally found a “solution” for the errors metioned.
I added an AfterCommitListener() on the CONTEXT in the ClientEdit delegate.
In this listener I
- get the newClient form the context
For Every files - store the file with fileUploadingAPI.putFileIntoStorage()
- create the new document with metadata.create() and do newDoc.setClient(newClient)
All is working well, but I need to inform the user when the upload is in progress while uploading files, especially big ones.
I tryed the showNotification() but it is bad since I can’t close the window if the upload terminates before the window timeout, with the result that many notification are displayed overlapped on the screen.
To solve this problem I created a custom screen with a label which is
- opened before the upload
- updated every time a file is uploaded.
- not closed on pourpose after all files are downloaded
Even with this method I had no luck since this widow it is displayed only after all files are uploaded and the CustomerEdit is closed
So the final question: how can I display some kind of message while uploading files and a final message when the work is done?
In alternative, is there a better method to do the work?
Thenks
Riccardo