Mirth Connect
  1. Mirth Connect
  2. MIRTH-2673

Allow users to pass both the key and destination name to responseMap.get()

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0 Beta 2
    • Fix Version/s: 3.0.0 RC 2, 3.0.0
    • Component/s: Donkey, Server
    • Labels:
      None

      Description

      Since we made the changes to store response map values with the d# key (MIRTH-2314, MIRTH-2418, MIRTH-2627), it would also be nice if it didn't matter whether or not the destination name was passed in. This would make migration much easier as well, because no manual JavaScript changes would be needed.

        Issue Links

          Activity

          Hide
          Nick Rupley added a comment -

          Revision 6547: Modified the response map placed in JavaScript scopes so that users can pass the destination name as well as the "d#" key into responseMap.get(). ImmutableConnectorMessage now stores an internal map of destination names. When the response map is grabbed, it wraps it in a ResponseMap object, and passes in the destination name map. The new ResponseMap object extends HashMap but overrides containsKey and get so that it looks at the destination name map if it can't find the key in the regular key set. JavaScriptScopeUtil now only takes in ImmutableConnectorMessage everywhere instead of ConnectorMessage, so each caller needs to wrap it beforehand. The connectors do this, and pass in their destination name map, which is now set on deploy in DonkeyEngineController.convertToDonkeyChannel.

          Show
          Nick Rupley added a comment - Revision 6547: Modified the response map placed in JavaScript scopes so that users can pass the destination name as well as the "d#" key into responseMap.get(). ImmutableConnectorMessage now stores an internal map of destination names. When the response map is grabbed, it wraps it in a ResponseMap object, and passes in the destination name map. The new ResponseMap object extends HashMap but overrides containsKey and get so that it looks at the destination name map if it can't find the key in the regular key set. JavaScriptScopeUtil now only takes in ImmutableConnectorMessage everywhere instead of ConnectorMessage, so each caller needs to wrap it beforehand. The connectors do this, and pass in their destination name map, which is now set on deploy in DonkeyEngineController.convertToDonkeyChannel.
          Hide
          Matt Shigekawa added a comment -

          Verified responseMap.get() accepts both 'd#' and the full destination name as the key.

          Show
          Matt Shigekawa added a comment - Verified responseMap.get() accepts both 'd#' and the full destination name as the key.
          Hide
          Nick Rupley added a comment -

          There's an issue with this: Objects placed in the response map in a transformer are not persisted afterwards. This is because when the maps are stored with the DAO, they're taken from the ConnectorMessage's maps. However the map placed in the transformer scope is a separate ResponseMap object which isn't referenced after the transformer executes.

          Show
          Nick Rupley added a comment - There's an issue with this: Objects placed in the response map in a transformer are not persisted afterwards. This is because when the maps are stored with the DAO, they're taken from the ConnectorMessage's maps. However the map placed in the transformer scope is a separate ResponseMap object which isn't referenced after the transformer executes.
          Hide
          Nick Rupley added a comment -

          Fixed the above issue in revision 6782. Instead of acting as a standalone HashMap, ResponseMap just implements Map and delegates all methods to the Map passed into the constructor. That way when a user calls put() in JavaScript, it affects the original map from the ConnectorMessage.

          Show
          Nick Rupley added a comment - Fixed the above issue in revision 6782. Instead of acting as a standalone HashMap, ResponseMap just implements Map and delegates all methods to the Map passed into the constructor. That way when a user calls put() in JavaScript, it affects the original map from the ConnectorMessage.
          Hide
          Wayne Huang (Inactive) added a comment -

          Verified that responseMap values placed in a transformer are now correctly persisted.

          Show
          Wayne Huang (Inactive) added a comment - Verified that responseMap values placed in a transformer are now correctly persisted.

            People

            • Assignee:
              Nick Rupley
              Reporter:
              Nick Rupley
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development