![]() In the java file, you can write your java code between the markers: // BEGIN USER CODE and // END USER CODEġ: Write some validation lines: Write the following lines to validate if the file has contents and if the file extension matches ‘.msg’. Open Eclipse and go to the java file belonging to your java action, which in my case can be found in ‘myfirstmodule.actions’. More information about using Eclipse to write java actions can be found here. ![]() It is possible to set the association between the attachments and the email inside the java action, but I like to do as much as possible in the microflow. After the java action is done, the microflow sets the association between the attachments and the email, closes the first page and opens the second page. The java action will read the email, copy its attributes to the email object, and add the attachments to the list of documents. This microflow takes the email object, creates a list of documents, creates a string variable (‘MyFirstModule.Document’) and calls the java action. Show the email’s attributes and attachments on the page.Ħ: Create a second microflow. The microflow must create an empty email object and open the page with the file uploader.ĥ: Create a second page for showing the email after it has been uploaded and processed by the java action. You can choose the standard filemanager from Mendix or the dropzone widget from the Appstore for uploading the file.Ĥ: Create a microflow that opens the first page. My java action looks like this:ģ: Create a page for uploading the email. The string variable is needed to tell the java action the full name of the document entity, which is in my case ‘MyFirstModule.Document’. The list of documents is needed to collect the email’s attachments, because for each attachment a document object is created and added to the list. The email file is passed to the java action as email object. Both entities are subclasses of FileDocument.Ģ: Create a java action with three input parameters: An email object, a list with document objects and a string variable. A document entity for storing any attachments. I have setted up my domain model as follows: An email entity with attributes for storing the email file and its content, such as the sender, recipients and html body. Please leave a comment if you know a better way of managing jar conflicts.ġ: You start by setting up your domain model. Always test your project before committing any changes. My project did run after I removed ‘’ (which is the older jar file) from my userlib folder. You can resolve this problem by removing the jar file with the older version. You probably have downloaded the Excel Importer from the appstore which adds another version of the POI jar file to your userlib. This happens when a project contains two java classes with the same name. You may experience jar conflicts, when you try to run the application. My userlib folder already contained commons-logging-1.1.jar, so I didn’t need commons-logging-1.2.jar.
0 Comments
Leave a Reply. |