Hi,
I'm currently wondering how I can save some files from user input and bind them to one business object. In my project, I have a business model called XXXrequest, in which supposed to be some attachments. But the default file uploader will only attach them to the process instance, is there any way I can persist the attachments and retrieve them at later processes?
Hello,
To do that, create a list of 'Document' in your Bonita Process. In your form, link all your input file to the Document variable.
When you do that, on your form submission, bonita will save files in the BonitaDatabase.
If you need to save your file in a Business object, just transform your document list to your busniess model.
Document object have some method to get file name, binary content, ect.
Regards,
Thanks for your reply! But I'm using 7.10 edition and there's no Document-class that corresponds to a document object. Now I get a list of documents but have no idea how I retrieve them from BonitaDatabse for later use.
'Document' class exist in 7.10 => Datas ->Documents ( when you have click on your process ).
When you have your list of document, if you want to receive them in other process that is independant of the first one, you just need to stock the document id or the document content id in a businessDataObject.
Then, use an SQL query to get all your document/documentContent id.
If you need to recreate a java File from a document content, you can use this method:
apiAccessor.processAPI.getDocumentContent(myDocument.contentStorageId);
This method return a byte[] object. Then you can create a File.
It works, thanks for your kindness!