From 2a14da72f46fb4984713ececc63b2a73954a5782 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 14 Sep 2016 16:31:54 +0500 Subject: - Make Attributes always last column - Format Map as simple string instead of json --- src/org/traccar/web/CsvBuilder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java index 73d5fac1d..cd0f36fc4 100644 --- a/src/org/traccar/web/CsvBuilder.java +++ b/src/org/traccar/web/CsvBuilder.java @@ -37,6 +37,12 @@ public class CsvBuilder { SortedSet methods = new TreeSet(new Comparator() { @Override public int compare(Method m1, Method m2) { + if (m1.getName().equals("getAttributes") & !m1.getName().equals(m2.getName())) { + return 1; + } + if (m2.getName().equals("getAttributes") & !m1.getName().equals(m2.getName())) { + return -1; + } return m1.getName().compareTo(m2.getName()); } }); @@ -73,7 +79,10 @@ public class CsvBuilder { } else if (method.getReturnType().equals(Map.class)) { Map value = (Map) method.invoke(object); if (value != null) { - builder.append(MiscFormatter.toJson(value).toString()); + String map = MiscFormatter.toJson(value).toString(); + map = map.replaceAll("[\\{|\\}|\"]", ""); + map = map.replaceAll(",", " "); + builder.append(map); addSeparator(); } } -- cgit v1.2.3