Reading a FileDocument

Hi everyone, Here can you please explain me that how to send the FileDocument to the JavaAction using a Microflow. And How to receive a FileDocument as a INPUT in Eclipse Java Code.     Thanks In Advance!
2 answers

Hi Arun,

I have an entity named MyFile with the generalization of file document.

You can pass the file document to any java action as shown below. Create a java action with the parameter of file entity

Deploy the code to eclipse.

In Eclipse, you can see your filedocument as a input 

// This file was generated by Mendix Studio Pro.
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.

package voterregistration.actions;

import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
import com.mendix.systemwideinterfaces.core.IMendixObject;

public class ReadMyFile extends CustomJavaAction<java.lang.Void>
    private IMendixObject __MyFile;
    private voterregistration.proxies.MyFile MyFile;

    public ReadMyFile(IContext context, IMendixObject MyFile)
        this.__MyFile = MyFile;

    public java.lang.Void executeAction() throws Exception
        this.MyFile = __MyFile == null ? null : voterregistration.proxies.MyFile.initialize(getContext(), __MyFile);

        // BEGIN USER CODE
        throw new com.mendix.systemwideinterfaces.MendixRuntimeException("Java action was not implemented");
        // END USER CODE

     * Returns a string representation of this action
    public java.lang.String toString()
        return "ReadMyFile";

I hope this helps you


Have a look at the Community Commons module in the Mendix App Store.

The source code to the Java Actions it uses are available in the Github repository. There are a number of actions that use FileDocuments there that would really help you.

Hope this helps.