-
Notifications
You must be signed in to change notification settings - Fork 49
Maintain consistent element order in exports #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
|
|
||
| package com.mirth.connect.donkey.util; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.TreeMap; | ||
| import java.util.Map; | ||
| import java.util.Map.Entry; | ||
|
|
||
|
|
@@ -61,7 +61,7 @@ public static String serializeMap(Serializer serializer, Map<String, Object> map | |
| try { | ||
| return serializer.serialize(map); | ||
| } catch (Exception e) { | ||
| Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| Map<String, Object> newMap = new TreeMap<String, Object>(); | ||
|
|
||
| for (Entry<String, Object> entry : map.entrySet()) { | ||
|
Comment on lines
62
to
66
|
||
| Object value = entry.getValue(); | ||
|
|
@@ -108,7 +108,7 @@ public static Map<String, Object> deserializeMapWithInvalidValues(Serializer ser | |
| * If an exception occurs while deserializing, we build up a new map manually, attempting to | ||
| * deserialize each entry and replacing entries that fail with their string representations. | ||
| */ | ||
| Map<String, Object> map = new HashMap<String, Object>(); | ||
| Map<String, Object> map = new TreeMap<String, Object>(); | ||
|
|
||
| for (DonkeyElement entry : mapElement.getChildElements()) { | ||
| if (!entry.getNodeName().equalsIgnoreCase("entry")) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
| import java.util.Collections; | ||
| import java.util.Comparator; | ||
| import java.util.HashMap; | ||
| import java.util.HashSet; | ||
| import java.util.TreeSet; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
@@ -46,8 +46,8 @@ public class CodeTemplateLibrary implements Serializable, Migratable, Purgable, | |
|
|
||
| public CodeTemplateLibrary() { | ||
| id = UUID.randomUUID().toString(); | ||
| enabledChannelIds = new HashSet<String>(); | ||
| disabledChannelIds = new HashSet<String>(); | ||
| enabledChannelIds = new TreeSet<String>(); | ||
| disabledChannelIds = new TreeSet<String>(); | ||
| codeTemplates = new ArrayList<CodeTemplate>(); | ||
| } | ||
|
Comment on lines
47
to
52
|
||
|
|
||
|
|
@@ -58,8 +58,8 @@ public CodeTemplateLibrary(CodeTemplateLibrary library) { | |
| lastModified = library.getLastModified(); | ||
| description = library.getDescription(); | ||
| includeNewChannels = library.isIncludeNewChannels(); | ||
| enabledChannelIds = new HashSet<String>(library.getEnabledChannelIds()); | ||
| disabledChannelIds = new HashSet<String>(library.getDisabledChannelIds()); | ||
| enabledChannelIds = new TreeSet<String>(library.getEnabledChannelIds()); | ||
| disabledChannelIds = new TreeSet<String>(library.getDisabledChannelIds()); | ||
| codeTemplates = new ArrayList<CodeTemplate>(); | ||
| if (CollectionUtils.isNotEmpty(library.getCodeTemplates())) { | ||
| for (CodeTemplate codeTemplate : library.getCodeTemplates()) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since a TreeMap is sorted and a HashMap is not, I'm guessing there could be considerable changes compared to a prior export the first time an export is done with the new code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, then subsequent exports will benefit.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a purpose for having MapContent as part of this PR? I think it only shows up in a message export, and not part of the server configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll revert it and verify.