aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-15 00:47:57 +1200
committerGitHub <noreply@github.com>2016-09-15 00:47:57 +1200
commit9ee73b1c0b15f87b338e02e564fbba9d45f09ce8 (patch)
tree8accf3b1cdafcb679da17fc5266980840cd2e4f2 /src/org/traccar/web
parent5a3cad30d5b2fa5a4be6cba0eed6df135f496165 (diff)
parent6a2a9637c95b1da12cc82743044c944ff2ab7f81 (diff)
downloadtrackermap-server-9ee73b1c0b15f87b338e02e564fbba9d45f09ce8.tar.gz
trackermap-server-9ee73b1c0b15f87b338e02e564fbba9d45f09ce8.tar.bz2
trackermap-server-9ee73b1c0b15f87b338e02e564fbba9d45f09ce8.zip
Merge pull request #2317 from Abyss777/improve_csv
Small csv export improvement
Diffstat (limited to 'src/org/traccar/web')
-rw-r--r--src/org/traccar/web/CsvBuilder.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/web/CsvBuilder.java b/src/org/traccar/web/CsvBuilder.java
index 73d5fac1d..a25b839a9 100644
--- a/src/org/traccar/web/CsvBuilder.java
+++ b/src/org/traccar/web/CsvBuilder.java
@@ -37,6 +37,12 @@ public class CsvBuilder {
SortedSet<Method> methods = new TreeSet<Method>(new Comparator<Method>() {
@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();
}
}