Java Actions

Hi Can you please tell me that how to use core API to retrieve a file document in mendix using Java Actions.  And in which type of variable that can I store a file document? Because if I am storing file document as in input stream it wont accept, It asked to use string. So, Please tell me that how can I retrieve a file document ? Below is my screen shot. Please help me out with this, Thanks you! 
2 answers

Hi Arun,

The file document could very well be assigned to IMendixObject.

When looking at your java code, you are using Core.getFileDocumentContent which returns InputStream


To use this method, you must already pass the FileDocument as IMendixObject.

Why not retrieve the file document in the microflow where you are calling the Java action and pass it on to this java action as a Parameter.

Or you could use system.proxies.FileDocument.load method if you knew the IMendixIdentifier. 


If you are looking for example Java code for working with FileDocuments, the code for the excellent Community Commons module is on GitHub.

Have a look at the code for StringFromFile, StringToFile, FileDocumentFromFile, FileFromFileDocument, amongst others.

Hope this helps.