Skip to content
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

#5004 Maintain consistent element order in exports #5791

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

package com.mirth.connect.donkey.model.message;

import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map;

public class MapContent extends Content {
private Object content = new HashMap<String, Object>();
private Object content = new TreeMap<String, Object>();
private transient boolean persisted = false;

public MapContent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()) {
Object value = entry.getValue();
Expand Down Expand Up @@ -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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.TreeSet;
import java.util.Iterator;
import java.util.Set;

Expand All @@ -25,7 +25,7 @@ public CodeTemplateContextSet(ContextType... contextTypes) {
}

public CodeTemplateContextSet(Collection<ContextType> contextTypes) {
delegate = new HashSet<ContextType>(contextTypes);
delegate = new TreeSet<ContextType>(contextTypes);
}

public CodeTemplateContextSet addContext(ContextType... contextTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>();
}

Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingCo
try {
DonkeyElement mapElement = new DonkeyElement(serializedMap);
mapElement.setNodeName("content");
mapElement.setAttribute("class", "map");
mapElement.setAttribute("class", "tree-map");
copier.copy(new XppReader(new StringReader(mapElement.toXml()), new MXParser()), writer);
} catch (DonkeyElementException e) {
throw new SerializerException(e);
Expand Down