Reading a FileDocument

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

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)
    {
        super(context);
        this.__MyFile = MyFile;
    }

    @java.lang.Override
    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
     */
    @java.lang.Override
    public java.lang.String toString()
    {
        return "ReadMyFile";
    }

    // BEGIN EXTRA CODE
    // END EXTRA CODE
}
I hope this helps you

answered
0

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.

https://github.com/mendix/CommunityCommons

Hope this helps.

answered