Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Mirth/Java Limitations?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mirth/Java Limitations?

    When we are using the Javascript in the channel transformers are we limited to a subset or Javascript? I tried some commands I found in the Javascript reference on the web and it didn't understand the command. Are we limited to the few items under the reference tab?
    Mike Caldwell
    Alliance HealthCare - GE VAR
    Rocklin, CA
    Centricity PM/EMR Support - Developer - Network Engineer

  • #2
    Re:Mirth/Java Limitations?

    Nope,you can use the standard JS functions along with any Java code that you want.
    Brendan Haverlock | Mirth Software Engineer | Mirth Corporation

    Comment


    • #3
      Re:Mirth/Java Limitations?

      Really? I tested several things that didnt work right from Java examples from Sun.

      Here is an example. It doesn't understand 'import' and I guess you can't call functions, like the copy below? I haven't had any luck.

      import java.io.File;
      import java.io.FileReader;
      import java.io.FileWriter;
      import java.io.IOException;

      public class Copy {
      public static void main(String[] args) throws IOException {
      File inputFile = new File("farrago.txt");
      File outputFile = new File("outagain.txt");

      FileReader in = new FileReader(inputFile);
      FileWriter out = new FileWriter(outputFile);
      int c;

      while ((c = in.read()) != -1)
      out.write(c);

      in.close();
      out.close();
      }
      }
      Mike Caldwell
      Alliance HealthCare - GE VAR
      Rocklin, CA
      Centricity PM/EMR Support - Developer - Network Engineer

      Comment


      • #4
        Re:Mirth/Java Limitations?

        You can use java objects but you still need to use javascript syntax.

        To import a package:
        importPackage(java.io);

        To import a class:
        importClass(java.io.File);

        Something like this should work better:
        function copy()
        {
        var inputFile = new java.io.File("farrago.txt");
        var outputFile = new java.io.File("outagain.txt");

        var in = new java.io.FileReader(inputFile);
        var out = new java.io.FileWriter(outputFile);
        var c;

        while ((c = in.read()) != -1)
        out.write(c);

        in.close();
        out.close();
        }
        Daniel Svanstedt
        Software Engineer
        Mirth Corporation

        Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
        Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

        Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

        Comment

        Working...
        X