MIRTH-1892: Completely overhauled how code templates work in Mirth Connect.
There is now the notion of code template libraries, that contain code templates. Libraries may selectively linked to specific channels, so that not all code templates have to be included on all channels all the time, which is how it worked before.
Code templates and libraries are stored in the database and handled by the controller very much the same way channels are. There are synchronized caches for both the code templates and libraries. To facilitate that, code templates now have revision numbers. This also means that in the Administrator, the code templates edit view will prompt you if you try to save a code template and the revision has changed (indicating that someone else has already updated the same template).
Since libraries are linked to channels, when you export a channel you may also choose to export the code template libraries that are linked to it. The libraries are included in the actual channel XML, so you don't have to remember to import a separate file. Also the "Set Libraries" dialog has been refactored into a more general "Set Dependencies" dialog, which has tabs for both the resources and code template libraries. In this dialog you can view which libraries and templates are currently included on a channel, and you can also enable/disable libraries.
The code templates view has been completely rewritten. The table is now a tree table, to accommodate both libraries and their associated code templates. Users can still "export all" like they could before, but now they can also choose to export a single code template, or a single library of templates. When you import code templates or libraries, you're now presented with a dialog that allows you to resolve name conflicts and see other warnings about library assignment.
The Dashboard and Channels views will now show an indicator if code templates linked to a channel have changed or not. The existing revision delta column will still be highlighted if the revision has changed since the channel was last deployed, but now it will also be highlighted if any linked code templates have changed.
On migration the entire code template table will be renamed to OLD_CODE_TEMPLATE. Then the pre-existing code templates will all be migrated into the new table structure under a placeholder library, which will be included on all channels by default. All context sets will also be appropriately migrated too, so the actual behavior of code templates within channels should remain the same after an upgrade. A database task for removing the old table has also been added.
The CLI's code template support has also been vastly improved. You can now list code templates or libraries, and import/export/remove individual ones (using the same search criteria you use for channels).
The Channel History extension now also supports code templates...