web stats
Download | Support | Contact
Mirth Corporation
  • Home
  • Products
    • Mirth Connect
    • Mirth Results
    • Mirth Match
    • Mirth Mail
    • Mirth Care
    • Mirth Appliances
    • Mirth Virtual Appliances
    • Mirth Hosted Appliances
  • Services
    • Support
    • Training
    • Consulting
  • Solutions
    • HIEs
    • Hospitals
    • Clinics
    • Laboratories
    • Radiology
    • Vendors
    • Government
  • Community
    • Forums
    • Wiki
    • Issues
    • Source Code
    • Mirth Exchange
    • IRC
    • FAQs
    • Contribute
    • Registration
    • Downloads
  • Company
    • About
    • Mission and Vision
    • Testimonials
    • News
    • Employment Opportunities
    • Contact

Mirth Project

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile
  • Mirth Connect
  • MIRTH-825

Add namespaces to JavaScript transformer and outbound templates

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.0
  • Fix Version/s: 1.8.1
  • Component/s: Server
  • Labels:
    None
  • Environment:
    Fedora Core 8 x86_64

Description

Its impossible now to keep namespaces used in outbound message template couse of "tmp['tagname1']['tagname2'].." syntax used for E4X
We can solve this provlem:
1. Parse message templates with namespaces: add docFactory.setNamespaceAware(true); in TreePanel.setMessage
2. Create treenodes with namespace in such form: <namespace>::<tagname> , use some predefined default for doc default namespace (for example, doc_ns)
3. Make MirthTree.constructPath return path of this form: prefix.<treenode.toString()>[<index>].<treenode.toString()>[<index>]. (tmp.doc_ns::patient.doc_ns::firstname)
4. Do not to remove the namespaces from templates in JavaScriptTransformer.generateScript (remove template.replace(/xmlns:?[^=]*=[\"\"][^\"\"]*[\"\"]/g, '');\n" )
4. Add namespace declarations to script in JavaScriptTransformer.generateScript, for example using this code:
...
scope.put("template", scope, template);

String src = "var tmp = new XML(template);\n" +
"var spaces = tmp.inScopeNamespaces();\n" +
"var result = '';\n" +
"for (var i=0; i<spaces.length; i++) {\n" +

"if ((spaces[i].prefix != undefined) && (spaces[i].prefix != ''))\n" +
" result = result + 'var ' + spaces[i].prefix + \" = new Namespace('\" + spaces[i].prefix + \"', '\" + spaces[i].uri + \"');\\n\";\n" +
" else\n" +
" result = result +\"var doc_ns = new Namespace('', '\" + spaces[i].uri + \"');\\n\";\n" +
"}\n" +
"result\n";

logger.info("Source : " +src);
Script script = context.compileString(src, "getNamespaces", 1, null);

                        // append namespaсe declarations to script, before oldScript
                        newScript.append(script.exec(context, scope).toString);
...
 

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Source
Hide
Permalink
Jacob Brauer added a comment - 18/Sep/08 4:49 PM
Maxim, can you provide a patch file with the changes you made? Thanks.
Show
Jacob Brauer added a comment - 18/Sep/08 4:49 PM Maxim, can you provide a patch file with the changes you made? Thanks.
Hide
Permalink
Jacob Brauer added a comment - 10/Jun/09 3:37 PM
Removed the remove namespaces channel property.
Added stripNamespaces property on XML, HL7V2, and HL7V3.
Added import converter to add stripNamespaces property to those standards, and by default set it to true unless remove namespaces was unchecked before.
In the JavaScriptTransformer, stripped namespaces from the inbound message unless an inbound property set stripNamespaces to false. If a namespace was not stripped, then the default xml namespace for e4x is set to that namespace. On the outbound template, namespaces are also stripped unless an outbound property set the stripNamespaces property to false. The default xml namespace will remain set to the inbound message namespace until overwritten with JavaScript in a transformer step.

Also added fix for checking individual properties to see if they are equal to the defaults rather than the whole map, and fixed a bug where outbound properties might not be checked.

More fixes and helper functions will be done with MIRTH-1110.
Show
Jacob Brauer added a comment - 10/Jun/09 3:37 PM Removed the remove namespaces channel property. Added stripNamespaces property on XML, HL7V2, and HL7V3. Added import converter to add stripNamespaces property to those standards, and by default set it to true unless remove namespaces was unchecked before. In the JavaScriptTransformer, stripped namespaces from the inbound message unless an inbound property set stripNamespaces to false. If a namespace was not stripped, then the default xml namespace for e4x is set to that namespace. On the outbound template, namespaces are also stripped unless an outbound property set the stripNamespaces property to false. The default xml namespace will remain set to the inbound message namespace until overwritten with JavaScript in a transformer step. Also added fix for checking individual properties to see if they are equal to the defaults rather than the whole map, and fixed a bug where outbound properties might not be checked. More fixes and helper functions will be done with MIRTH-1110.

People

  • Assignee:
    Jacob Brauer
    Reporter:
    Maxim Usoltsev
Vote (1)
Watch (2)

Dates

  • Created:
    21/Apr/08 1:11 AM
    Updated:
    10/Nov/10 11:08 AM
    Resolved:
    10/Jun/09 3:37 PM

Time Tracking

Estimated:
1w 1d
Original Estimate - 1 week, 1 day
Remaining:
1w 1d
Remaining Estimate - 1 week, 1 day
Logged:
Not Specified
Time Spent - Not Specified
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Mirth Corporation. Try JIRA - bug tracking software for your team.