Java Actions

0
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! 
asked
2 answers
1

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

Read: https://apidocs.mendix.com/7/runtime/com/mendix/core/Core.html#getFileDocumentContent-com.mendix.systemwideinterfaces.core.IContext-com.mendix.systemwideinterfaces.core.IMendixObject-

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. 

answered
0

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

https://github.com/mendix/CommunityCommons

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

Hope this helps.

answered