Skip to content

Commit

Permalink
Add support for XML format
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Jul 20, 2015
1 parent 91ca14d commit ec01f2e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/org/traccar/database/QueryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
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;

Expand Down Expand Up @@ -250,7 +252,11 @@ public QueryBuilder setObject(Object object) throws SQLException {
} 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) {
}
Expand Down

0 comments on commit ec01f2e

Please sign in to comment.