From ec01f2eca0a0a5ce8b8b815ba96da0a80c53ab99 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 21 Jul 2015 10:08:28 +1200 Subject: Add support for XML format --- src/org/traccar/database/QueryBuilder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { } -- cgit v1.2.3