diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml new file mode 100644 index 0000000..75ca8b3 --- /dev/null +++ b/.github/workflows/reuse.yml @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: 2026 Tony Germano +# SPDX-License-Identifier: MPL-2.0 + +name: REUSE compliance + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + reuse: + runs-on: ubuntu-26.04 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0 diff --git a/.project b/.project deleted file mode 100644 index ff60cad..0000000 --- a/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - Mirth Connect Examples - - - - - - - - diff --git a/Channels/Get Num Pages From Embedded PDF/Example - Get Num Pages From Embedded PDF.xml b/Channels/Get Num Pages From Embedded PDF/Example - Get Num Pages From Embedded PDF.xml index eadfca7..5cd32ce 100644 --- a/Channels/Get Num Pages From Embedded PDF/Example - Get Num Pages From Embedded PDF.xml +++ b/Channels/Get Num Pages From Embedded PDF/Example - Get Num Pages From Embedded PDF.xml @@ -1,3 +1,7 @@ + 6de4dab6-cbb8-4840-87bb-31a85fab9101 2 diff --git a/Code Templates/Thread-safe get or create from globalMap/LICENSE b/Channels/Get Num Pages From Embedded PDF/LICENSE similarity index 76% rename from Code Templates/Thread-safe get or create from globalMap/LICENSE rename to Channels/Get Num Pages From Embedded PDF/LICENSE index 0432f9b..61e9ad0 100644 --- a/Code Templates/Thread-safe get or create from globalMap/LICENSE +++ b/Channels/Get Num Pages From Embedded PDF/LICENSE @@ -2,4 +2,4 @@ This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -Files in this subfolder are Copyright Tony Germano 2019. \ No newline at end of file +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Channels/Get Num Pages From Embedded PDF/source-transformer.js b/Channels/Get Num Pages From Embedded PDF/source-transformer.js index af929e2..c138cf2 100644 --- a/Channels/Get Num Pages From Embedded PDF/source-transformer.js +++ b/Channels/Get Num Pages From Embedded PDF/source-transformer.js @@ -1 +1,4 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + $c('pages', getNumPagesInPDF(getAttachments(true).get(0).getContent())); \ No newline at end of file diff --git a/Channels/Validate XSD Source Filter/Example - Validate XSD.xml b/Channels/Validate XSD Source Filter/Example - Validate XSD.xml index 03e1e76..51d8180 100644 --- a/Channels/Validate XSD Source Filter/Example - Validate XSD.xml +++ b/Channels/Validate XSD Source Filter/Example - Validate XSD.xml @@ -1,3 +1,7 @@ + 9c5f43ca-544c-4a40-80f6-455868c7e3f4 2 diff --git a/Channels/Validate XSD Source Filter/LICENSE b/Channels/Validate XSD Source Filter/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Channels/Validate XSD Source Filter/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Channels/Validate XSD Source Filter/source-filter.js b/Channels/Validate XSD Source Filter/source-filter.js index 507e259..dcfcae0 100644 --- a/Channels/Validate XSD Source Filter/source-filter.js +++ b/Channels/Validate XSD Source Filter/source-filter.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + importPackage(javax.xml); importPackage(javax.xml.transform.stream); importPackage(javax.xml.validation); diff --git a/Code Templates/Bundle.xml b/Code Templates/Bundle.xml deleted file mode 100644 index eda169e..0000000 --- a/Code Templates/Bundle.xml +++ /dev/null @@ -1,1161 +0,0 @@ - - - e31ef05e-7cd5-43d2-a2db-b264ed98c003 - Convert Date From Multiple Formats - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Parses a date (String, Date, DateTime, or Number) into a string using an array of possible input - patterns and the specified output pattern. - - @param {Object} date - The String, Date, DateTime, or Number to convert. - @param {String} outpattern - The pattern to use when converting the date to the output string. - @return {String} The converted output date string. -*/ -var patterns = [ - 'yyyy-MM-dd HH:mm:ss:SSS', - 'yyyy-MM-dd HH:mm:ss.SSS', - 'yyyy-MM-dd HH:mm:ss', - 'yyyy-MM-dd HH:mm', - 'EEE MMM dd HH:mm:ss:SSS zzz yyyy', - 'EEE MMM dd HH:mm:ss.SSS zzz yyyy', - 'EEE MMM dd HH:mm:ss zzz yyyy', - 'EEE MMM dd zzz yyyy', - 'dd-MMM-yyyy HH:mm:ss:SSS', - 'dd-MMM-yyyy HH:mm:ss.SSS', - 'dd-MMM-yyyy HH:mm:ss', - 'yyyy-MM-dd', - 'yyyy MM dd', - 'yyyy.MM.dd', - 'MM-dd-yyyy', - 'MM dd yyyy', - 'MM.dd.yyyy', - 'HH:mm:ss:SSS', - 'HH:mm:ss.SSS', - 'HH:mm:ss', - 'yyyyMMddHHmmssSSS', - 'yyyyMMddHHmmss', - 'yyyyMMddHHmm', - 'hh:mm aa']; - -var formatters = []; -for each (pattern in patterns) { - formatters.push(org.joda.time.format.DateTimeFormat.forPattern(pattern)); -} - -function convertDate(date, outpattern) { - var instant = 0; - if (typeof date == 'number' || date instanceof java.lang.Number) { - instant = new Number(date); - } else if (date instanceof Date || date instanceof java.util.Date) { - instant = date.getTime(); - } else if (date instanceof org.joda.time.ReadableInstant) { - instant = date.getMillis(); - } else { - for each (formatter in formatters) { - try { - instant = formatter.parseMillis(new String(date)); - break; - } catch(e) {} - } - } - - return org.joda.time.format.DateTimeFormat.forPattern(outpattern).print(instant); -} - - - - 64b8b653-162b-454e-a790-21d659934bc8 - Convert XML to HL7 - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Deserializes an E4X XML node into HL7 v2.x. The last four parameters are optional and default to the - standard encoding characters. - - @param {XML} node - The E4X XML node to deserialize. - @param {String} fieldSeparator - Defaults to '|' if not specified. - @param {String} componentSeparator - Defaults to '^' if not specified. - @param {String} repetitionMarker - Defaults to '~' if not specified. - @param {String} subcomponentSeparator - Defaults to '&' if not specified. - @return {String} The deserialized HL7 v2.x string. -*/ -function xmlToHL7(node, fieldSeparator, componentSeparator, repetitionMarker, subcomponentSeparator) { - // Data validation - if (!node) { - return ''; - } - - // This shouldn't really ever happen with E4X anyway, but just in case. - String.prototype.replaceAmp = function() {return this.replace(/&amp;/g,'&');}; - - // If we're just dealing with a simple node, then just return its contents. - if (node.hasSimpleContent()) { - return node.toString().replaceAmp(); - } - - // Used for StringUtils - importPackage(org.apache.commons.lang3); - - // Defaults to standard HL7 encoding characters - var fs = fieldSeparator || '|'; - var cs = componentSeparator || '^'; - var rm = repetitionMarker || '~'; - var ss = subcomponentSeparator || '&'; - var cr = '\x0D'; - - // What will actually be returned - var output = ''; - // Get the XML name of the node (in the case of an XMLList of repeating fields, the first one will be returned, since they all have the same name anyway) - var qname = node[0].name().toString(); - // Use the HL7 dot notation to find what level we're at - var level = StringUtils.countMatches(qname,'.'); - - // If the name is HL7Message, we're at the root node - if (qname == 'HL7Message') { - // Recursively append serialization for each segment - for each (segment in node.children()) { - output += xmlToHL7(segment,fs,cs,rm,ss); - } - } else if (level == 0) { // If we're at the segment level - // If the node is an XMLList of multiple segments - if (node.length() > 1) { - // Recursively append serialization for each segment - for each (segment in node) { - output += xmlToHL7(segment,fs,cs,rm,ss); - } - } else { - // Add the segment name to the output - output += qname; - // Initialize name placeholder - var prevName = ''; - - // Iterate through each field in the segment - for each (field in node.children()) { - // Get the QName of the field - var fieldName = field.name().toString(); - - // If we're dealing with the special cases of MSH.1/2, then just add the field contents - if (fieldName in {'MSH.1':1,'MSH.2':1}) { - output += field.toString().replaceAmp(); - } else { // Otherwise add the recursive serialization of the field - // If we're on a field repetition, then prepend a repetition marker, otherwise prepend a field separator - output += (prevName==fieldName?rm:fs) + xmlToHL7(field,fs,cs,rm,ss); - } - - // Update the field name placeholder - prevName = fieldName; - } - - // Add a carriage return to the end of the segment - output += cr; - } - } else if (level == 1) { // If we're at the field level - // If the node is an XMLList of multiple fields - if (node.length() > 1) { - // Recursively append serialization for each field - for each (field in node) { - output += xmlToHL7(field,fs,cs,rm,ss) + rm; - } - - // Remove the final repetition marker - output = StringUtils.chomp(output,rm); - } - else { - // Recursively append serialization for each component - for each (component in node.children()) { - // Append a component separator to the end - output += xmlToHL7(component,fs,cs,rm,ss) + cs; - } - - // Remove the last component separator - output = StringUtils.chomp(output,cs); - } - } else if (level == 2) { // If we're at the component level - // Recursively append serialization for each subcomponent - for each (subcomponent in node.children()) { - // Append a subcomponent separator to the end - output += xmlToHL7(subcomponent,fs,cs,rm,ss) + ss; - } - - // Remove the last subcomponent separator - output = StringUtils.chomp(output,ss); - } else { // If we're at the subcomponent level - // Just add the contents of the node - output = node.toString().replaceAmp(); - } - - // Return the final output - return output; -} - - - - 41f83fb6-69a4-434d-8e11-d687577f387e - Create Segment Before Segment - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Creates a new segment with the given name and inserts it before the given segment. - - @param {String} insertSegmentName - The name of the new segment to insert. - @param {XML} beforeThisSegment - The segment to insert just before. - @return {XML} The newly created segment. -*/ -function createSegmentBefore(insertSegmentName, beforeThisSegment) { - var msgObj = beforeThisSegment; - while (msgObj.parent() != undefined) { - msgObj = msgObj.parent(); - } - msgObj.insertChildBefore(beforeThisSegment[0], new XML('<' + insertSegmentName + '></' + insertSegmentName + '>')); - return msgObj.child(beforeThisSegment[0].childIndex() - 1); -} - - - - 942f9161-6998-42e1-9528-83342f457ac5 - Encrypt PDF - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Encrypts a PDF with a password. Either a Base64 string or by array can be passed in, and the output - can be written to a file or returned as a Base64 string. - - @param {String/byte[]} pdfBase64OrBytes - The PDF data to encrypt. May be a Base64 string, or a - byte array. - @param {String} password - The password to use for encryption. - @param {String} outputFilename - (Optional) The filename to output the encrypted PDF to. If - omitted, the data will be returned from the function as a Base64 string. - @return {String} If outputFilename is not specified, returns the Base64 string. -*/ -function encryptPDF(pdfBase64OrBytes, password, outputFilename) { - var document; - var fos; - - try { - var pdfBytes; - if (pdfBase64OrBytes instanceof Array) { - pdfBytes = pdfBase64OrBytes; - } else { - pdfBytes = FileUtil.decode(pdfBase64OrBytes); - } - - var inputStream = new java.io.ByteArrayInputStream(pdfBytes); - document = org.apache.pdfbox.pdmodel.PDDocument.load(inputStream); - - var accessPermission = new org.apache.pdfbox.pdmodel.encryption.AccessPermission(); - accessPermission.setCanAssembleDocument(false); - accessPermission.setCanExtractContent(true); - accessPermission.setCanExtractForAccessibility(false); - accessPermission.setCanFillInForm(false); - accessPermission.setCanModify(false); - accessPermission.setCanModifyAnnotations(false); - accessPermission.setCanPrint(true); - accessPermission.setCanPrintDegraded(true); - - var policy = new org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy(UUIDGenerator.getUUID(), password, accessPermission); - policy.setEncryptionKeyLength(128); - document.protect(policy); - - if (outputFilename) { - fos = new java.io.FileOutputStream(new java.io.File(outputFilename)); - document.save(fos); - } else { - var baos = new java.io.ByteArrayOutputStream(); - document.save(baos); - return FileUtil.encode(baos.toByteArray()); - } - } finally { - if (document) { - document.close(); - } - if (fos) { - fos.close(); - } - } -} - - - - 28e29e59-d093-41cf-8c2d-4ad4587f9e20 - Execute Runtime Command - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Executes a command or array of command and arguments using a local OS shell. Returns an object - containing the exit value, output, and errors. - - @param {String/Array} args - The command arguments, as either a string or an array. - @param {String} charset - (Optional) The charset encoding to use when reading the output from the - command. If omitted, the JVM default charset will be used. - @return {Object} An Object with the properties exitValue, stdout, and stderr. -*/ -function executeRuntimeCommand(args, charset) { - var process = java.lang.Runtime.getRuntime().exec(args); - var stdoutConsumer = new StreamConsumer(process.getInputStream(), charset); - var stderrConsumer = new StreamConsumer(process.getErrorStream(), charset); - return { - exitValue : process.waitFor(), - stdout : stdoutConsumer.getOutput(), - stderr : stderrConsumer.getOutput() - }; -} - -function StreamConsumer(is, charset) { - var output = ''; - - var thread = new java.lang.Thread({ - run: function() { - if (typeof charset !== 'undefined') { - output = org.apache.commons.io.IOUtils.toString(is, charset); - } else { - output = org.apache.commons.io.IOUtils.toString(is); - } - } - }); - - this.interrupt = function() { - thread.interrupt(); - } - - this.getOutput = function() { - thread.join(); - return output; - }; - - thread.start(); -} - - - - dcd2ce64-4c3c-4e53-9f71-dbf296004fe3 - Extract Text From PDF - 1 - - - GMT - - - - DESTINATION_RESPONSE_TRANSFORMER - SOURCE_FILTER_TRANSFORMER - SOURCE_RECEIVER - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Extracts and returns all text from a PDF. Uses the built-in iText library, version 2.1.7. - - @param {byte[]} pdfBytes - The raw byte array for the PDF. - @return {String} The extracted text. -*/ -function extractTextFromPDF(pdfBytes) { - var text = new java.lang.StringBuilder(); - var reader = new com.lowagie.text.pdf.PdfReader(pdfBytes); - - try { - var extractor = new com.lowagie.text.pdf.parser.PdfTextExtractor(reader); - var pages = reader.getNumberOfPages(); - - for (var i = 1; i <= pages; i++) { - text.append(extractor.getTextFromPage(i)); - if (i < pages) { - text.append('\n\n'); - } - } - } finally { - reader.close(); - } - - return text.toString(); -} - - - - 23adc50e-ab2b-4c9f-ab4b-6b17dc31bab7 - Fix Node Order in HL7 v2.x Message - 3 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Because out-of-order HL7 nodes can cause unexpected errors, this function will automatically fix - that node order, using the HL7 numeric dot notation. - - @param {XML} node - The E4X XML node to fix. - @return {XML} The fixed E4X XML node. -*/ -function fixHL7NodeOrder(node) { - // Create output node - var newNode = new XML(); - - // In case the node is an XMLList of multiple siblings, loop through each sibling - for each (sibling in node) { - // Create new sibling node - var newSibling = new XML('<'+sibling.name().toString()+'/>'); - - // Iterate through each child node - for each (child in sibling.children()) { - if (child.hasComplexContent()) { - // If the child has its own children, then recursively fix the node order of the child - newSibling.appendChild(fixHL7NodeOrder(child)); - } else { - // If the child doesn't have its own children, then just add the child to the new sibling node - newSibling.appendChild(child); - } - } - - // After recursively fixing all of the child nodes, now we'll fix the current node - newNode += sortHL7Node(newSibling); - } - - // Return the fixed node - return newNode; -} - -// Helper function for fixHL7NodeOrder -function sortHL7Node(node) { - // If the node has no children, then there's nothing to sort - if (node.hasSimpleContent()) { - return node; - } - - // Create new output node - var newNode = new XML('<'+node.name().toString()+'/>'); - - // Iterate through each child in the node - for each (child in node.children()) { - // If the child has a QName, then we can sort on it - if (child.name()) { - // Get the current "index" of the child. Id est, if the QName is PID.3.1, then the index is 1 - curChildIndex = parseInt(child.name().toString().substring(child.name().toString().lastIndexOf('.')+1),10); - // Boolean placeholder - var inserted = false; - - // Iterate through each child currently in the NEW node - for (var i = 0; i <= newNode.children().length()-1; i++) { - // Get the index of the child of the new node - loopChildIndex = parseInt(newNode.child(i).name().toString().substring(newNode.child(i).name().toString().lastIndexOf('.')+1),10); - - /* - If the child we want to insert has a lower index then the - current child of the new node, then we're going to insert - the child right before the current newNode child - */ - if (curChildIndex < loopChildIndex) { - // Insert the child - newNode.insertChildBefore(newNode.children()[i],child); - // Set our flag, indicating that an insertion was made - inserted = true; - // No need to continue iteration - break; - } - } - - /* If no insertion was made, then the index of the child we want to - insert is greater than or equal to all of the indices of the - children that have already been inserted in newNode. So, we'll - just append the child to the end. - */ - if (!inserted) { - newNode.appendChild(child); - } - } - } - - // Return the sorted HL7 node - return newNode; -} - - - - 7294645e-df37-4536-b2ad-a0d08f4e98be - Get Num Pages In PDF - 1 - - - America/Los_Angeles - - - - DESTINATION_RESPONSE_TRANSFORMER - SOURCE_RECEIVER - DESTINATION_FILTER_TRANSFORMER - SOURCE_FILTER_TRANSFORMER - DESTINATION_DISPATCHER - - - - FUNCTION - /** - Loads the raw PDF byte array into a PDFBox PDDocument object, then returns the number of pages in - the PDF. - - See also: - https://svn.apache.org/repos/asf/pdfbox/cmssite/trunk/content/docs/1.8.4/javadocs/org/apache/pdfbox/pdmodel/PDDocument.html - - @param {byte[]} pdfBytes - The raw PDF byte array. - @return {Number} The number of pages in the PDF. -*/ -function getNumPagesInPDF(pdfBytes) { - var is = new java.io.ByteArrayInputStream(pdfBytes); - var pdf = org.apache.pdfbox.pdmodel.PDDocument.load(is); - return pdf.getNumberOfPages(); -} - - - - 270003aa-9350-45a7-9397-58679320cb9d - Get Segments After a Particular Segment - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Returns an array of segments with the specified name that come after a given segment in the message. - - @param {XML} root - The root HL7Message node of the message, or the parent of the segment node. - @param {XML} startSeg - The segment AFTER which to start collecting segments. - @param {String/RegExp} segName - The name (String or RegExp) of the segments you want to collect. - @param {Boolean} consecutiveInd - If true, indicates that the segments are expected to come - directly after startSeg. If false, segments are collected until another segment with the same name - as startSeg is encountered. Defaults to false. - @param {String[]} stopSegNames - An array of segment names that, when encountered, stop the - collection of segments. - @return {XML[]} The array of matching segments. -*/ -function getSegmentsAfter(root, startSeg, segName, consecutiveInd, stopSegNames) { - function test(str) { - return segName instanceof RegExp ? segName.test(str) : segName === str; - } - - // The index to start collection is the next one up from the starting segment - var index = startSeg.childIndex()+1; - // The return array - var out = []; - // Boolean placeholder to stop iteration - var done = false; - // Object that will contain all of the stopSegNames strings, bound to a truthy value (1) - var stopNames = {}; - // Indicates whether we have any stop segments - var stopNamesInd = false; - - if (stopSegNames !== undefined && stopSegNames !== null) { - // Set our indicator to true - stopNamesInd = true; - // Add each string in the array to our object - for each (name in stopSegNames) { - stopNames[name] = 1; - } - } - - // Iterate through each child in the root, starting at the segment after startSeg, and - // ending at the final segment, or when the done flag is set to true. - while (index < root.children().length() && !done) { - if (stopNamesInd && root.children()[index].name().toString() in stopNames) { - // If a stop segment is encountered, stop iteration - done = true; - } else if (root.children()[index].name().toString() == startSeg.name().toString() && !consecutiveInd) { - // If a segment with the same name as startSeg is encountered, stop iteration - done = true; - } else if (!test(root.children()[index].name().toString()) && consecutiveInd) { - // If we're only collecting consecutive segments and we encounter a segment with a name other than segName, stop iteration - done = true; - } else if (test(root.children()[index].name().toString())) { - // If all previous tests passed, and the current segment has a name of segName, then add it to our array - out.push(root.children()[index]); - } - - // Increment our index counter - index++; - } - - // Return the output array - return out; -} - - - - 623381ec-3378-4517-a75c-eb476e66aad7 - Insert Segment After Segment - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Inserts a given segment after a particular segment. - - @param {XML} insertSegment - The segment to insert. - @param {XML} afterThisSegment - The segment after which to insert the new segment. - @return {XML} The newly inserted segment. -*/ -function insertSegmentAfter(insertSegment, afterThisSegment) { - var msgObj = afterThisSegment; - while (msgObj.parent() != undefined) { - msgObj = msgObj.parent(); - } - msgObj.insertChildAfter(afterThisSegment[0], insertSegment); - return msgObj.child(afterThisSegment[0].childIndex() + 1); -} - - - - d25ebb24-3802-4caa-a4fe-3b69501187a0 - Insert Segment Before Segment - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Inserts a given segment before a particular segment. - - @param {XML} insertSegment - The segment to insert. - @param {XML} beforeThisSegment - The segment before which to insert the new segment. - @return {XML} The newly inserted segment. -*/ -function insertSegmentBefore(insertSegment, beforeThisSegment) { - var msgObj = beforeThisSegment; - while (msgObj.parent() != undefined) { - msgObj = msgObj.parent(); - } - msgObj.insertChildBefore(beforeThisSegment[0], insertSegment); - return msgObj.child(beforeThisSegment[0].childIndex() - 1); -} - - - - a9e61c41-5b0c-47da-82c9-0601ad5a3baa - Overwrite Logger Categories - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Overwrites the categories of Logger objects placed in JavaScript contexts. - - NOTE: This will work automatically for all contexts except for the transformer. For transformers, - you will need to manually include "overwriteCategories();" at the beginning of your first step. -*/ -function overwriteCategories() { - logger = org.apache.log4j.Logger.getLogger({ - 'transformer': 'custom-transformer', - 'preprocessor': 'custom-preprocessor', - 'postprocessor': 'custom-postprocessor', - 'deploy': 'custom-deploy', - 'shutdown': 'custom-shutdown', - 'filter': 'custom-filter', - 'db-connector': 'custom-db-connector', - 'js-connector': 'custom-js-connector', - 'attachment': 'custom-attachment', - 'batch': 'custom-batch', - 'response': 'custom-response' - }[logger.getName()]); - logger.setLevel(org.apache.log4j.Level.DEBUG); -} - -overwriteCategories(); - - - - 80cbe9dc-bbb9-4379-a124-21ce86b3e3ea - Rename HL7 Field - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - This function returns a copy of the given HL7 field, changing all segment names to the given name. - - @param {XML} oldField - The field to copy and change. - @param {String} name - The new name for the field. - @return {XML} The copied and modified field. -*/ -function renameField(oldField, name) { - String.prototype.entityReplace = function() {return this.replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&apos;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}; - - var out = new XML(); - - for each (field in oldField) { - var outField = new XML('<'+name+'/>'); - - for each (component in field.children()) { - var cname = name + component.name().toString().substring(component.name().toString().indexOf('.',component.name().toString().indexOf('.')+1)); - - if (component.children().length() > 1) { - // Has subcomponents - var outComponent = new XML('<'+cname+'/>'); - - for each (subcomponent in component.children()) { - var scname = name + subcomponent.name().toString().substring(subcomponent.name().toString().indexOf('.',subcomponent.name().toString().indexOf('.')+1)); - var outSubcomponent = new XML('<'+scname+'>'+subcomponent.toString().entityReplace()+'</'+scname+'>'); - outComponent.scname = outSubcomponent; - } - - outField.cname = outComponent; - } else { - outField.cname = new XML('<'+cname+'>'+component.toString().entityReplace()+'</'+cname+'>'); - } - } - - out += outField; - } - - return out; -} - - - - c4ef99be-6845-4167-8a07-1e6c40b52bb3 - Replace in All Descendant XML Nodes - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Recursively iterates through all descendant nodes of an E4X XML object and makes a string - replacement. - - @param {XML} parent - The E4X XML node to replace within. - @param {RegExp} regexp - The regular expression to test against at each leaf (text) node. - @param {String} replacement - The string with which to replace. -*/ -function replaceAllInXML(parent, regexp, replacement) { - for each (child in parent.children()) { - if (child.hasComplexContent()) { - replaceAllInXML(child, regexp, replacement); - } else { - parent.children()[child.childIndex()] = child.toString().replace(regexp, replacement); - } - } -} - - - - ffa5fa9b-e13e-48b1-96d5-b4f7ac08d497 - Strip Empty Nodes from XML - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Recursively iterates through all descendant nodes of an E4X XML object and removes those that are - empty (or those whose children are all empty). - - @param {XML} node - The node to iterate through. If node itself is empty, it will not be removed from its parent. - @param {Boolean} stripWhitespaceNodes - If true, nodes that are not empty but only contain whitespace will also be removed. - @param {Boolean} onlyDeleteTrailing - If true, only trailing nodes will actually be deleted. -*/ -function stripEmptyNodes(node, stripWhitespaceNodes, onlyDeleteTrailing) { - var nonEmptyFound = false; - - for (var childIndex = node.children().length()-1; childIndex >= 0; childIndex--) { - var child = node.children()[childIndex]; - stripEmptyNodes(child, stripWhitespaceNodes, onlyDeleteTrailing); - - if (stripWhitespaceNodes && !child.toString().trim() || !stripWhitespaceNodes && !child.toString()) { - if (!nonEmptyFound || !onlyDeleteTrailing) { - delete node.children()[childIndex]; - } else { - node.children()[childIndex] = new XML('<'+child.name().toString()+'/>'); - } - } else { - nonEmptyFound = true; - } - } -} - - - - 9d3f1dd9-d28e-42e5-89bd-8a3569b33b69 - Unescape \Xdd..\ HL7 Sequences - 1 - - - GMT - - - - GLOBAL_UNDEPLOY - DESTINATION_RESPONSE_TRANSFORMER - GLOBAL_POSTPROCESSOR - CHANNEL_PREPROCESSOR - CHANNEL_ATTACHMENT - SOURCE_FILTER_TRANSFORMER - CHANNEL_BATCH - SOURCE_RECEIVER - CHANNEL_POSTPROCESSOR - GLOBAL_DEPLOY - GLOBAL_PREPROCESSOR - CHANNEL_DEPLOY - CHANNEL_UNDEPLOY - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - - - - FUNCTION - /** - Replaces any \Xdd..\ HL7 escape sequences with the corresponding character(s). - - @param {XML} node - The node to recursively iterate through. - @param {String} charset - The character encoding set to use when converting bytes to Unicode code - points. If not specified, US-ASCII will be used. - @param {String} encodingCharacters - The HL7 encoding characters to exclude from the replacement. -*/ -function unescapeXSequences(node, charset, encodingCharacters) { - if (!charset) { - charset = 'US-ASCII'; - } - - if (!encodingCharacters) { - encodingCharacters = node.MSH['MSH.1'].toString().split('').concat(node.MSH['MSH.2'].toString().split('')); - if (encodingCharacters.length == 0) { - encodingCharacters = ['|', '^', '~', '\\', '&']; - } - } - - for each (child in node.children()) { - if (child.hasComplexContent()) { - unescapeXSequences(child, charset, encodingCharacters); - } else if (!/MSH\.[12]/.test(child.name())) { - var childString = child.toString(); - var matched = false; - - for each (match in childString.match(/\\X([\dA-F]{2})+\\/ig)) { - matched = true; - var hexString = match.substr(2, match.length-3); - var buffer = java.nio.ByteBuffer.allocate(hexString.length / 2); - - while (hexString.length > 0) { - var intValue = new java.lang.Integer((java.lang.Character.digit(hexString.substr(0,1), 16) << 4) + java.lang.Character.digit(hexString.substr(1,1), 16)); - buffer.put(intValue.byteValue()); - hexString = hexString.substr(2); - } - - childString = childString.replace(match, new java.lang.String(buffer.array(), charset)); - } - - if (matched) { - if (encodingCharacters.length > 3) { - childString = childString.replace(encodingCharacters[3], '\\E\\'); - } - if (encodingCharacters.length > 0) { - childString = childString.replace(encodingCharacters[0], '\\F\\'); - } - if (encodingCharacters.length > 1) { - childString = childString.replace(encodingCharacters[1], '\\S\\'); - } - if (encodingCharacters.length > 2) { - childString = childString.replace(encodingCharacters[2], '\\R\\'); - } - if (encodingCharacters.length > 4) { - childString = childString.replace(encodingCharacters[4], '\\T\\'); - } - - node.children()[child.childIndex()] = <{child.name()}>{childString}</{child.name()}>; - } - } - } -} - - - \ No newline at end of file diff --git a/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.js b/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.js index a6ccad1..47a91d7 100644 --- a/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.js +++ b/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Parses a date (String, Date, DateTime, or Number) into a string using an array of possible input patterns and the specified output pattern. diff --git a/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.xml b/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.xml index f5b29af..542cbe7 100644 --- a/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.xml +++ b/Code Templates/Convert Date From Multiple Formats/Convert Date From Multiple Formats.xml @@ -1,3 +1,7 @@ + e31ef05e-7cd5-43d2-a2db-b264ed98c003 Convert Date From Multiple Formats diff --git a/Code Templates/Convert Date From Multiple Formats/LICENSE b/Code Templates/Convert Date From Multiple Formats/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Convert Date From Multiple Formats/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Convert XML to HL7/Convert XML to HL7.js b/Code Templates/Convert XML to HL7/Convert XML to HL7.js index 366f135..f1167ab 100644 --- a/Code Templates/Convert XML to HL7/Convert XML to HL7.js +++ b/Code Templates/Convert XML to HL7/Convert XML to HL7.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Deserializes an E4X XML node into HL7 v2.x. The last four parameters are optional and default to the standard encoding characters. diff --git a/Code Templates/Convert XML to HL7/Convert XML to HL7.xml b/Code Templates/Convert XML to HL7/Convert XML to HL7.xml index 7a12b04..47ca449 100644 --- a/Code Templates/Convert XML to HL7/Convert XML to HL7.xml +++ b/Code Templates/Convert XML to HL7/Convert XML to HL7.xml @@ -1,3 +1,7 @@ + 64b8b653-162b-454e-a790-21d659934bc8 Convert XML to HL7 diff --git a/Code Templates/Convert XML to HL7/LICENSE b/Code Templates/Convert XML to HL7/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Convert XML to HL7/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.js b/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.js index bd9ef46..e1bea31 100644 --- a/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.js +++ b/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Creates a new segment with the given name and inserts it before the given segment. diff --git a/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.xml b/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.xml index 3e9a62e..259adb3 100644 --- a/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.xml +++ b/Code Templates/Create and Insert Segment Templates/Create Segment Before Segment.xml @@ -1,3 +1,7 @@ + 41f83fb6-69a4-434d-8e11-d687577f387e Create Segment Before Segment diff --git a/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.js b/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.js index 9411bfa..b5ea31c 100644 --- a/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.js +++ b/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Inserts a given segment after a particular segment. diff --git a/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.xml b/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.xml index c5b890f..c71589e 100644 --- a/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.xml +++ b/Code Templates/Create and Insert Segment Templates/Insert Segment After Segment.xml @@ -1,3 +1,7 @@ + 623381ec-3378-4517-a75c-eb476e66aad7 Insert Segment After Segment diff --git a/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.js b/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.js index 27342eb..db9ca8a 100644 --- a/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.js +++ b/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Inserts a given segment before a particular segment. diff --git a/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.xml b/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.xml index e68972c..add827c 100644 --- a/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.xml +++ b/Code Templates/Create and Insert Segment Templates/Insert Segment Before Segment.xml @@ -1,3 +1,7 @@ + d25ebb24-3802-4caa-a4fe-3b69501187a0 Insert Segment Before Segment diff --git a/Code Templates/Create and Insert Segment Templates/LICENSE b/Code Templates/Create and Insert Segment Templates/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Create and Insert Segment Templates/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Encrypt PDF/Encrypt PDF.js b/Code Templates/Encrypt PDF/Encrypt PDF.js index 1ef47c5..1597ec6 100644 --- a/Code Templates/Encrypt PDF/Encrypt PDF.js +++ b/Code Templates/Encrypt PDF/Encrypt PDF.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Encrypts a PDF with a password. Either a Base64 string or by array can be passed in, and the output can be written to a file or returned as a Base64 string. diff --git a/Code Templates/Encrypt PDF/Encrypt PDF.xml b/Code Templates/Encrypt PDF/Encrypt PDF.xml index 5c6a318..de303e6 100644 --- a/Code Templates/Encrypt PDF/Encrypt PDF.xml +++ b/Code Templates/Encrypt PDF/Encrypt PDF.xml @@ -1,3 +1,7 @@ + 942f9161-6998-42e1-9528-83342f457ac5 Encrypt PDF diff --git a/Code Templates/Encrypt PDF/LICENSE b/Code Templates/Encrypt PDF/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Encrypt PDF/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Execute Runtime Command/Execute Runtime Command.js b/Code Templates/Execute Runtime Command/Execute Runtime Command.js index ba9ac3e..1cffb65 100644 --- a/Code Templates/Execute Runtime Command/Execute Runtime Command.js +++ b/Code Templates/Execute Runtime Command/Execute Runtime Command.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Executes a command or array of command and arguments using a local OS shell. Returns an object containing the exit value, output, and errors. diff --git a/Code Templates/Execute Runtime Command/Execute Runtime Command.xml b/Code Templates/Execute Runtime Command/Execute Runtime Command.xml index 204e871..4c52840 100644 --- a/Code Templates/Execute Runtime Command/Execute Runtime Command.xml +++ b/Code Templates/Execute Runtime Command/Execute Runtime Command.xml @@ -1,3 +1,7 @@ + 28e29e59-d093-41cf-8c2d-4ad4587f9e20 Execute Runtime Command diff --git a/Code Templates/Execute Runtime Command/LICENSE b/Code Templates/Execute Runtime Command/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Execute Runtime Command/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Extract Text From PDF/Extract Text From PDF.js b/Code Templates/Extract Text From PDF/Extract Text From PDF.js index 930cd2c..874af4a 100644 --- a/Code Templates/Extract Text From PDF/Extract Text From PDF.js +++ b/Code Templates/Extract Text From PDF/Extract Text From PDF.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Extracts and returns all text from a PDF. Uses the built-in iText library, version 2.1.7. diff --git a/Code Templates/Extract Text From PDF/Extract Text From PDF.xml b/Code Templates/Extract Text From PDF/Extract Text From PDF.xml index 310aa7e..5dc91ee 100644 --- a/Code Templates/Extract Text From PDF/Extract Text From PDF.xml +++ b/Code Templates/Extract Text From PDF/Extract Text From PDF.xml @@ -1,3 +1,7 @@ + dcd2ce64-4c3c-4e53-9f71-dbf296004fe3 Extract Text From PDF diff --git a/Code Templates/Extract Text From PDF/LICENSE b/Code Templates/Extract Text From PDF/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Extract Text From PDF/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Filter XMLLists/xFilter.js b/Code Templates/Filter XMLLists/xFilter.js index 1a2de4d..4f09ed9 100644 --- a/Code Templates/Filter XMLLists/xFilter.js +++ b/Code Templates/Filter XMLLists/xFilter.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2020 Tony Germano +// SPDX-License-Identifier: MPL-2.0 + /** Improved XMLList filter over built-in e4x filters. diff --git a/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.js b/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.js index d126239..92b825e 100644 --- a/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.js +++ b/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Because out-of-order HL7 nodes can cause unexpected errors, this function will automatically fix that node order, using the HL7 numeric dot notation. diff --git a/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.xml b/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.xml index 06a82a2..eeaf953 100644 --- a/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.xml +++ b/Code Templates/Fix HL7 Node Order/Fix Node Order in HL7 v2.x Message.xml @@ -1,3 +1,7 @@ + 23adc50e-ab2b-4c9f-ab4b-6b17dc31bab7 Fix Node Order in HL7 v2.x Message diff --git a/Code Templates/Fix HL7 Node Order/LICENSE b/Code Templates/Fix HL7 Node Order/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Fix HL7 Node Order/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.js b/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.js index 00a08e5..4f93b0f 100644 --- a/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.js +++ b/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Loads the raw PDF byte array into a PDFBox PDDocument object, then returns the number of pages in the PDF. diff --git a/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.xml b/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.xml index 791b996..5c00049 100644 --- a/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.xml +++ b/Code Templates/Get Num Pages In PDF/Get Num Pages In PDF.xml @@ -1,3 +1,7 @@ + 7294645e-df37-4536-b2ad-a0d08f4e98be Get Num Pages In PDF diff --git a/Code Templates/Get Num Pages In PDF/LICENSE b/Code Templates/Get Num Pages In PDF/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Get Num Pages In PDF/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.js b/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.js index 98f6533..dbf5308 100644 --- a/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.js +++ b/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Returns an array of segments with the specified name that come after a given segment in the message. diff --git a/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.xml b/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.xml index e104e49..35280cd 100644 --- a/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.xml +++ b/Code Templates/Get Segments After a Particular Segment/Get Segments After a Particular Segment.xml @@ -1,3 +1,7 @@ + 270003aa-9350-45a7-9397-58679320cb9d Get Segments After a Particular Segment diff --git a/Code Templates/Get Segments After a Particular Segment/LICENSE b/Code Templates/Get Segments After a Particular Segment/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Get Segments After a Particular Segment/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.js b/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.js index ce1b1a8..7894bc0 100644 --- a/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.js +++ b/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2018 Tony Germano +// SPDX-License-Identifier: MPL-2.0 + /** Returns the string representation of each child element of xml joined by separator. If xml contains no child elements, the string diff --git a/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.xml b/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.xml index 49a4d0f..3081949 100644 --- a/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.xml +++ b/Code Templates/Join HL7 Subcomponents/Join HL7 Subcomponents.xml @@ -1,3 +1,7 @@ + aab23d47-cae1-4a03-9317-27246e5cf808 diff --git a/Code Templates/Overwrite Logger Categories/LICENSE b/Code Templates/Overwrite Logger Categories/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Overwrite Logger Categories/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.js b/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.js index 1f28670..b6e56a3 100644 --- a/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.js +++ b/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Overwrites the categories of Logger objects placed in JavaScript contexts. diff --git a/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.xml b/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.xml index 6c11ed8..073a44b 100644 --- a/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.xml +++ b/Code Templates/Overwrite Logger Categories/Overwrite Logger Categories.xml @@ -1,3 +1,7 @@ + a9e61c41-5b0c-47da-82c9-0601ad5a3baa Overwrite Logger Categories diff --git a/Code Templates/README.md b/Code Templates/README.md index 9d639db..3882e01 100644 --- a/Code Templates/README.md +++ b/Code Templates/README.md @@ -1,4 +1,2 @@ # Example Code Templates Each code template is contained in its own folder. - -If you want to import them all at once, download the Bundle.xml file. \ No newline at end of file diff --git a/Code Templates/Rename HL7 Field/LICENSE b/Code Templates/Rename HL7 Field/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Rename HL7 Field/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Rename HL7 Field/Rename HL7 Field.js b/Code Templates/Rename HL7 Field/Rename HL7 Field.js index 43b0888..d7190b4 100644 --- a/Code Templates/Rename HL7 Field/Rename HL7 Field.js +++ b/Code Templates/Rename HL7 Field/Rename HL7 Field.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** This function returns a copy of the given HL7 field, changing all segment names to the given name. diff --git a/Code Templates/Rename HL7 Field/Rename HL7 Field.xml b/Code Templates/Rename HL7 Field/Rename HL7 Field.xml index b69fb2a..70ddb49 100644 --- a/Code Templates/Rename HL7 Field/Rename HL7 Field.xml +++ b/Code Templates/Rename HL7 Field/Rename HL7 Field.xml @@ -1,3 +1,7 @@ + 80cbe9dc-bbb9-4379-a124-21ce86b3e3ea Rename HL7 Field diff --git a/Code Templates/Replace in All Descendant XML Nodes/LICENSE b/Code Templates/Replace in All Descendant XML Nodes/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Replace in All Descendant XML Nodes/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.js b/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.js index 93703e2..6b6dcd7 100644 --- a/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.js +++ b/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Recursively iterates through all descendant nodes of an E4X XML object and makes a string replacement. diff --git a/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.xml b/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.xml index 4a7fd03..1d90538 100644 --- a/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.xml +++ b/Code Templates/Replace in All Descendant XML Nodes/Replace in All Descendant XML Nodes.xml @@ -1,3 +1,7 @@ + c4ef99be-6845-4167-8a07-1e6c40b52bb3 Replace in All Descendant XML Nodes diff --git a/Code Templates/Route with Sources/Route With Sources - Code Template Library.xml b/Code Templates/Route with Sources/Route With Sources - Code Template Library.xml index 207e182..6540102 100644 --- a/Code Templates/Route with Sources/Route With Sources - Code Template Library.xml +++ b/Code Templates/Route with Sources/Route With Sources - Code Template Library.xml @@ -1,3 +1,7 @@ + ca9c7efd-2329-4248-bb9a-0271554baeaf Route With Sources diff --git a/Code Templates/Route with Sources/createRawMessage.js b/Code Templates/Route with Sources/createRawMessage.js index 9fff931..e7fa0f8 100644 --- a/Code Templates/Route with Sources/createRawMessage.js +++ b/Code Templates/Route with Sources/createRawMessage.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023, 2024 Tony Germano +// SPDX-License-Identifier: MPL-2.0 + /** Create a RawMessage with the specified content, sourceMap, and destinationSet. Information about the chain of source channel Ids and source message Ids will be included in the sourceMap of the new diff --git a/Code Templates/Route with Sources/routeMessage.js b/Code Templates/Route with Sources/routeMessage.js index b4b6f4a..96b0b1b 100644 --- a/Code Templates/Route with Sources/routeMessage.js +++ b/Code Templates/Route with Sources/routeMessage.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023, 2024 Tony Germano +// SPDX-License-Identifier: MPL-2.0 + /** Route a message to the specified channelName. Information about the chain of source channel Ids and source message Ids will be included in the sourceMap of the downstream message automatically in a diff --git a/Code Templates/Route with Sources/routeMessageByChannelId.js b/Code Templates/Route with Sources/routeMessageByChannelId.js index 80cbedf..7aa468d 100644 --- a/Code Templates/Route with Sources/routeMessageByChannelId.js +++ b/Code Templates/Route with Sources/routeMessageByChannelId.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023, 2024 Tony Germano +// SPDX-License-Identifier: MPL-2.0 + /** Route a message to the specified channelId. Information about the chain of source channel Ids and source message Ids will be included in the sourceMap of the downstream message automatically in a diff --git a/Code Templates/Run on Startup/Run on Startup.js b/Code Templates/Run on Startup/Run on Startup.js index 90bf481..b9248c1 100644 --- a/Code Templates/Run on Startup/Run on Startup.js +++ b/Code Templates/Run on Startup/Run on Startup.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2019 Tony Germano +// SPDX-License-Identifier: MPL-2.0 + const isInitialDeploy = (function() { const ConfigurationController = com.mirth.connect.server.controllers.ConfigurationController; const configurationController = ConfigurationController.getInstance(); diff --git a/Code Templates/Strip Empty Nodes from XML/LICENSE b/Code Templates/Strip Empty Nodes from XML/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Strip Empty Nodes from XML/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.js b/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.js index 17498d5..7e63599 100644 --- a/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.js +++ b/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Recursively iterates through all descendant nodes of an E4X XML object and removes those that are empty (or those whose children are all empty). diff --git a/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.xml b/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.xml index deacd1f..86bb28f 100644 --- a/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.xml +++ b/Code Templates/Strip Empty Nodes from XML/Strip Empty Nodes from XML.xml @@ -1,3 +1,7 @@ + ffa5fa9b-e13e-48b1-96d5-b4f7ac08d497 Strip Empty Nodes from XML diff --git a/Code Templates/Thread-safe get or create from globalMap/README.md b/Code Templates/Thread-safe get or create from globalMap/README.md deleted file mode 100644 index 1972210..0000000 --- a/Code Templates/Thread-safe get or create from globalMap/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Thread-safe get or create from globalMap -For a given key, retrieve the value from the globalMap. If the globalMap does not contain the key or the object returned is null produce and store a new object in a thread-safe manner. - -### Parameters: - -- **globalMapkey:** Key under which this object is stored in the globalMap. Also used as the key for the synchronization object in the globalMap. -- **initializer:** Function which will be called when the value for globalMapKey is null. Returns the object to be stored as the value for globalMapKey. - -### Examples -Get synchronized SortedSet stored in the globalMap with key `mySet` or create it if it doesn't exist. - -```javascript -with (JavaImporter(java.util)) { - var mySet = getInstance('mySet', function() { - return Collections.synchronizedSortedSet(new TreeSet()); - }); -} -``` \ No newline at end of file diff --git a/Code Templates/Thread-safe get or create from globalMap/Thread-safe get or create from globalMap.js b/Code Templates/Thread-safe get or create from globalMap/Thread-safe get or create from globalMap.js deleted file mode 100644 index 914b51e..0000000 --- a/Code Templates/Thread-safe get or create from globalMap/Thread-safe get or create from globalMap.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - For a given key, retrieve the value from the globalMap. If the globalMap does not contain the key or - the object returned is null produce and store a new object in a thread-safe manner. - - @param {string} globalMapKey - Key under which this object is stored in the globalMap. Also used - as the key for the synchronization object in the globalMap. - @param {function():any} initializer - Function which will be called when the value for - globalMapKey is null. Returns the object to be stored as the value for globalMapKey. - @return {any} Object previously stored by globalMapKey or object created by initializer. - - @author Tony Germano -*/ -function getInstance(globalMapKey, initializer) { - var val = globalMap.get(globalMapKey); - if (val == null) { - if (!globalMap.containsKeySync(globalMapKey)) { - globalMap.putSync(globalMapKey,null); - } - try { - globalMap.lock(globalMapKey); - if ((val = globalMap.get(globalMapKey)) == null) { - val = initializer(); - globalMap.put(globalMapKey, val); - } - } - finally { - globalMap.unlock(globalMapKey); - } - } - return val; -}; diff --git a/Code Templates/Thread-safe get or create from globalMap/Thread-safe get or create from globalMap.xml b/Code Templates/Thread-safe get or create from globalMap/Thread-safe get or create from globalMap.xml deleted file mode 100644 index a54f0ac..0000000 --- a/Code Templates/Thread-safe get or create from globalMap/Thread-safe get or create from globalMap.xml +++ /dev/null @@ -1,53 +0,0 @@ - - d9c5b969-56ad-4a2f-bcec-e6708deea959 - getInstance - 7 - - - GMT - - - - DESTINATION_DISPATCHER - DESTINATION_FILTER_TRANSFORMER - DESTINATION_RESPONSE_TRANSFORMER - SOURCE_RECEIVER - SOURCE_FILTER_TRANSFORMER - - - - FUNCTION - /** - For a given key, retrieve the value from the globalMap. If the globalMap does not contain the key or - the object returned is null produce and store a new object in a thread-safe manner. - - @param {string} globalMapKey - Key under which this object is stored in the globalMap. Also used - as the key for the synchronization object in the globalMap. - @param {function():any} initializer - Function which will be called when the value for - globalMapKey is null. Returns the object to be stored as the value for globalMapKey. - @return {any} Object previously stored by globalMapKey or object created by initializer. - - @author Tony Germano -*/ -function getInstance(globalMapKey, initializer) { - var val = globalMap.get(globalMapKey); - if (val == null) { - if (!globalMap.containsKeySync(globalMapKey)) { - globalMap.putSync(globalMapKey,null); - } - try { - globalMap.lock(globalMapKey); - if ((val = globalMap.get(globalMapKey)) == null) { - val = initializer(); - globalMap.put(globalMapKey, val); - } - } - finally { - globalMap.unlock(globalMapKey); - } - } - return val; -}; - - - \ No newline at end of file diff --git a/Code Templates/Unescape Xdd HL7 Sequences/LICENSE b/Code Templates/Unescape Xdd HL7 Sequences/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Code Templates/Unescape Xdd HL7 Sequences/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.js b/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.js index 25faf82..bcad383 100644 --- a/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.js +++ b/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + /** Replaces any \Xdd..\ HL7 escape sequences with the corresponding character(s). diff --git a/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.xml b/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.xml index 982396f..01032e5 100644 --- a/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.xml +++ b/Code Templates/Unescape Xdd HL7 Sequences/Unescape Xdd HL7 Sequences.xml @@ -1,3 +1,7 @@ + 9d3f1dd9-d28e-42e5-89bd-8a3569b33b69 Unescape \Xdd..\ HL7 Sequences diff --git a/LICENSES/MPL-2.0.txt b/LICENSES/MPL-2.0.txt new file mode 100644 index 0000000..a612ad9 --- /dev/null +++ b/LICENSES/MPL-2.0.txt @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/LICENSE_ADDITIONAL_INFO b/LICENSE_ADDITIONAL_INFO deleted file mode 100644 index b1ee895..0000000 --- a/LICENSE_ADDITIONAL_INFO +++ /dev/null @@ -1,5 +0,0 @@ - LICENSE ADDITIONAL INFORMATION - -Unless otherwise specified by a LICENSE file in a project subfolder, all -channels, code templates, scripts, and other modules are Copyright (c) -NextGen Healthcare and licensed under the Mozilla Public License 2.0. \ No newline at end of file diff --git a/README.md b/README.md index 6a84221..163cffe 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,22 @@ # Example Channels, Code Templates, and more -This is a repository of example channels, code templates, and other scripts you can import and use in Mirth Connect. - -#### Channels - - Get Num Pages From Embedded PDF - - Validate XSD Source Filter - -#### Code Templates - - Convert Date From Multiple Formats - - Convert XML to HL7 - - Create and Insert Segment Templates - - Encrypt PDF - - Execute Runtime Command - - Extract Text From PDF - - Filter XMLLists - - Fix HL7 Node Order - - Get Num Pages In PDF - - Get Segments After a Particular Segment - - Join HL7 Sub-components - - Overwrite Logger Categories - - Rename HL7 Field - - Replace in All Descendant XML Nodes - - Route with Sources - - Run on Startup - - Strip Empty Nodes from XML - - Thread-safe get or create from globalMap - - Unescape `\Xdd..\` HL7 Sequences - -#### Scripts - - EDI/X12 Batch Script - -See also the public wiki: [https://github.com/nextgenhealthcare/connect/wiki/](https://github.com/nextgenhealthcare/connect/wiki/) + +A collection of example channels, code templates, and scripts you can import and use in [Open Integration Engine](https://github.com/OpenIntegrationEngine). + +## Layout + +- [`Channels`](Channels): example channels. Each channel has its own folder with the channel XML and a README. +- [`Code Templates`](Code%20Templates): code templates. Each template has its own folder. +- [`Scripts`](Scripts): standalone scripts, such as batch scripts. + +Each example folder has a README describing what it does and how to use it. + +## Contributing + +Add each new example in its own folder under the matching top-level directory, with a README. + +- Contributors must sign the [Eclipse Contributor Agreement](https://www.eclipse.org/legal/eca/) (ECA). You sign it once, online, with an [Eclipse account](https://accounts.eclipse.org/), and the email address on your commits must match the one on that account. +- Every new file must include an `SPDX-FileCopyrightText` and `SPDX-License-Identifier` header naming the contributor and the license. Files that can't carry a header, such as READMEs, get an entry in [REUSE.toml](REUSE.toml) instead. Use `MPL-2.0` unless agreed otherwise. ## License -Unless otherwise specified by a LICENSE file in a project subfolder, all channels, code templates, scripts, and other modules are Copyright © NextGen Healthcare and licensed under the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/). +Contributions are copyright their respective authors. The license of each file is stated in its SPDX header or in [REUSE.toml](REUSE.toml). A `LICENSE` file in its folder is optional. Most content is licensed under the [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/). diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 0000000..48edab3 --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,125 @@ +version = 1 + +# Files originally created by NextGen Healthcare that do not carry inline headers. + +[[annotations]] +path = "Channels/Get Num Pages From Embedded PDF/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Channels/Validate XSD Source Filter/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Convert Date From Multiple Formats/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Convert XML to HL7/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Create and Insert Segment Templates/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Encrypt PDF/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Execute Runtime Command/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Extract Text From PDF/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Fix HL7 Node Order/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Get Num Pages In PDF/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Get Segments After a Particular Segment/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Overwrite Logger Categories/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Rename HL7 Field/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Replace in All Descendant XML Nodes/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Strip Empty Nodes from XML/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Unescape Xdd HL7 Sequences/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Scripts/EDI X12 Batch Script/README.md" +SPDX-FileCopyrightText = "NextGen Healthcare" +SPDX-License-Identifier = "MPL-2.0" + +# Subfolders contributed by Tony Germano. Later annotations take precedence. +[[annotations]] +path = "Code Templates/Filter XMLLists/README.md" +SPDX-FileCopyrightText = "2020 Tony Germano" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Join HL7 Subcomponents/README.md" +SPDX-FileCopyrightText = "2018 Tony Germano" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Route with Sources/README.md" +SPDX-FileCopyrightText = "2023, 2024 Tony Germano" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "Code Templates/Run on Startup/README.md" +SPDX-FileCopyrightText = "2019 Tony Germano" +SPDX-License-Identifier = "MPL-2.0" + +# Root README, rewritten for Open Integration Engine. +[[annotations]] +path = "README.md" +SPDX-FileCopyrightText = "2026 Tony Germano" +SPDX-License-Identifier = "MPL-2.0" + +[[annotations]] +path = "renovate.json" +SPDX-FileCopyrightText = "2026 Tony Germano" +SPDX-License-Identifier = "MPL-2.0" diff --git a/Scripts/EDI X12 Batch Script/EDI X12 Batch Script.js b/Scripts/EDI X12 Batch Script/EDI X12 Batch Script.js index b57e213..6158410 100644 --- a/Scripts/EDI X12 Batch Script/EDI X12 Batch Script.js +++ b/Scripts/EDI X12 Batch Script/EDI X12 Batch Script.js @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: NextGen Healthcare +// SPDX-License-Identifier: MPL-2.0 + var segDelim = '~'; var elementDelim = '*'; var subelementDelim = ':'; diff --git a/Scripts/EDI X12 Batch Script/LICENSE b/Scripts/EDI X12 Batch Script/LICENSE new file mode 100644 index 0000000..61e9ad0 --- /dev/null +++ b/Scripts/EDI X12 Batch Script/LICENSE @@ -0,0 +1,5 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Files in this subfolder are Copyright NextGen Healthcare. diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..c7f005c --- /dev/null +++ b/renovate.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + "schedule:monthly", + "helpers:pinGitHubActionDigests" + ], + "timezone": "America/New_York", + "minimumReleaseAge": "14 days", + "automerge": false, + "major": { + "dependencyDashboardApproval": true + }, + "dependencyDashboard": true, + "semanticCommits": "enabled", + "labels": [ + "dependencies" + ], + "osvVulnerabilityAlerts": true, + "packageRules": [ + { + "matchManagers": [ + "github-actions" + ], + "addLabels": [ + "github actions" + ] + } + ] +}