diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-07 10:09:08 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-07 10:09:08 +1300 |
commit | 5b57c0fdb81bae87ca487e1d0087f8927b3fd07f (patch) | |
tree | c3733bca54002ca694b6d7b83b147de87212c5eb /src/org/traccar/database/DataManager.java | |
parent | 33b2a5c9ab70ffe7bbdd074ce430920d2a0d3941 (diff) | |
download | trackermap-server-5b57c0fdb81bae87ca487e1d0087f8927b3fd07f.tar.gz trackermap-server-5b57c0fdb81bae87ca487e1d0087f8927b3fd07f.tar.bz2 trackermap-server-5b57c0fdb81bae87ca487e1d0087f8927b3fd07f.zip |
Replace factory method with reflection
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 66d94ac91..7d8966d9a 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -171,7 +171,7 @@ public class DataManager implements IdentityManager { if (schemaVersionQuery != null) { Schema schema = QueryBuilder.create(dataSource, schemaVersionQuery) - .executeQuerySingle(new Schema()); + .executeQuerySingle(Schema.class); int version = 0; if (schema != null) { @@ -246,7 +246,7 @@ public class DataManager implements IdentityManager { public User login(String email, String password) throws SQLException { User user = QueryBuilder.create(dataSource, getQuery("database.loginUser")) .setString("email", email) - .executeQuerySingle(new User()); + .executeQuerySingle(User.class); if (user != null && user.isPasswordValid(password)) { return user; } else { @@ -256,13 +256,13 @@ public class DataManager implements IdentityManager { public Collection<User> getUsers() throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectUsersAll")) - .executeQuery(new User()); + .executeQuery(User.class); } public User getUser(long userId) throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectUser")) .setLong("id", userId) - .executeQuerySingle(new User()); + .executeQuerySingle(User.class); } public void addUser(User user) throws SQLException { @@ -297,18 +297,18 @@ public class DataManager implements IdentityManager { public Collection<Permission> getPermissions() throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.getPermissionsAll")) - .executeQuery(new Permission()); + .executeQuery(Permission.class); } public Collection<Device> getAllDevices() throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectDevicesAll")) - .executeQuery(new Device()); + .executeQuery(Device.class); } public Collection<Device> getDevices(long userId) throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectDevices")) .setLong("userId", userId) - .executeQuery(new Device()); + .executeQuery(Device.class); } public void addDevice(Device device) throws SQLException { @@ -365,7 +365,7 @@ public class DataManager implements IdentityManager { .setLong("deviceId", deviceId) .setDate("from", from) .setDate("to", to) - .executeQuery(new Position()); + .executeQuery(Position.class); } public void addPosition(Position position) throws SQLException { @@ -392,12 +392,12 @@ public class DataManager implements IdentityManager { public Collection<Position> getLatestPositions() throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectLatestPositions")) - .executeQuery(new Position()); + .executeQuery(Position.class); } public Server getServer() throws SQLException { return QueryBuilder.create(dataSource, getQuery("database.selectServers")) - .executeQuerySingle(new Server()); + .executeQuerySingle(Server.class); } public void updateServer(Server server) throws SQLException { |