diff options
author | Abyss777 <abyss@fox5.ru> | 2017-07-24 17:02:39 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-07-24 17:02:39 +0500 |
commit | af00329fd0addf84071927dbc18cb0b4e5345f2b (patch) | |
tree | 8a8def831332ed70e63544b54c70bcf82e777fbb /src/org/traccar/database/QueryBuilder.java | |
parent | d6c7cdf1e103c977ed94b737dc838d7ac22b9fa7 (diff) | |
download | trackermap-server-af00329fd0addf84071927dbc18cb0b4e5345f2b.tar.gz trackermap-server-af00329fd0addf84071927dbc18cb0b4e5345f2b.tar.bz2 trackermap-server-af00329fd0addf84071927dbc18cb0b4e5345f2b.zip |
Use Permission instead of Map
Diffstat (limited to 'src/org/traccar/database/QueryBuilder.java')
-rw-r--r-- | src/org/traccar/database/QueryBuilder.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index 440690a76..af33458a8 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import org.traccar.Context; import org.traccar.helper.Log; import org.traccar.model.MiscFormatter; +import org.traccar.model.Permission; import javax.sql.DataSource; import java.io.IOException; @@ -488,19 +489,19 @@ public final class QueryBuilder { return 0; } - public <T> Collection<Map<String, T>> executeMapQuery(Class<T> clazz) throws SQLException { - List<Map<String, T>> result = new LinkedList<>(); + public Collection<Permission> executePermissionsQuery() throws SQLException, ClassNotFoundException { + List<Permission> result = new LinkedList<>(); if (query != null) { try { try (ResultSet resultSet = statement.executeQuery()) { ResultSetMetaData resultMetaData = resultSet.getMetaData(); while (resultSet.next()) { - LinkedHashMap<String, T> map = new LinkedHashMap<>(); + LinkedHashMap<String, Long> map = new LinkedHashMap<>(); for (int i = 1; i <= resultMetaData.getColumnCount(); i++) { String label = resultMetaData.getColumnLabel(i); - map.put(label, resultSet.getObject(label, clazz)); + map.put(label, resultSet.getLong(label)); } - result.add(map); + result.add(new Permission(map)); } } } finally { |