aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-21 10:08:28 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-21 10:08:28 +1200
commitec01f2eca0a0a5ce8b8b815ba96da0a80c53ab99 (patch)
treeea6067c80a3007105817e4a690e9e6853046242c /src/org/traccar/database
parent91ca14dbf98b78ebf23a8527a16936eec8751b43 (diff)
downloadtraccar-server-ec01f2eca0a0a5ce8b8b815ba96da0a80c53ab99.tar.gz
traccar-server-ec01f2eca0a0a5ce8b8b815ba96da0a80c53ab99.tar.bz2
traccar-server-ec01f2eca0a0a5ce8b8b815ba96da0a80c53ab99.zip
Add support for XML format
Diffstat (limited to 'src/org/traccar/database')
-rw-r--r--src/org/traccar/database/QueryBuilder.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java
index 9fb92a17f..cee27a413 100644
--- a/src/org/traccar/database/QueryBuilder.java
+++ b/src/org/traccar/database/QueryBuilder.java
@@ -36,6 +36,8 @@ import javax.json.Json;
import javax.json.JsonReader;
import javax.json.stream.JsonParsingException;
import javax.sql.DataSource;
+
+import org.traccar.Context;
import org.traccar.model.Factory;
import org.traccar.model.MiscFormatter;
@@ -250,7 +252,11 @@ public class QueryBuilder {
} else if (method.getReturnType().equals(Date.class)) {
setDate(name, (Date) method.invoke(object));
} else if (method.getReturnType().equals(Map.class)) {
- setString(name, MiscFormatter.toJsonString((Map) method.invoke(object)));
+ if (Context.getConfig().getBoolean("database.xml")) {
+ setString(name, MiscFormatter.toXmlString((Map) method.invoke(object)));
+ } else {
+ setString(name, MiscFormatter.toJsonString((Map) method.invoke(object)));
+ }
}
} catch (IllegalAccessException | InvocationTargetException error) {
}