Announcement

Collapse
No announcement yet.

JavaScript of Java?

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

  • JavaScript of Java?

    Hello,

    What kind of code are you supposed to use when writing scripts in a javascript transformer? Is it Java or JavaScript?

    It looks like mostly JavaScript, but it looks like there are some Java functions that work, too. Like Java.Io.

    Thank you,

    Garrett

  • #2
    In a transformer (or any other place you can do scripting in Mirth Connect), you're working within a Mozilla Rhino context (hence ECMAScript/JavaScript). The reason you're able to use Java classes is that Rhino provides you with various top-level objects that you can use to load Java objects into the JavaScript context. Packages is the main object that contains all of the Java packages currently included in your VM (java, com, org, etc.). For convenience, Rhino also includes the most common of these packages as top-level variables as well, so referencing "java" is the same as referencing "Packages.java".

    There are actually many many more, surprisingly powerful, things you can do from within Rhino, from directly implementing Java interfaces and spawning new threads, to creating entire GUI applications complete with event listeners...
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment

    Working...
    X