aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/UsersManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/database/UsersManager.java')
-rw-r--r--src/org/traccar/database/UsersManager.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/org/traccar/database/UsersManager.java b/src/org/traccar/database/UsersManager.java
index e53409b4f..28e6a31b2 100644
--- a/src/org/traccar/database/UsersManager.java
+++ b/src/org/traccar/database/UsersManager.java
@@ -21,10 +21,9 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import org.traccar.model.BaseModel;
import org.traccar.model.User;
-public class UsersManager extends SimpleObjectManager {
+public class UsersManager extends SimpleObjectManager<User> {
private Map<String, Long> usersTokens;
@@ -32,11 +31,6 @@ public class UsersManager extends SimpleObjectManager {
super(dataManager, User.class);
}
- @Override
- public User getById(long userId) {
- return (User) super.getById(userId);
- }
-
private void putToken(User user) {
if (usersTokens == null) {
usersTokens = new ConcurrentHashMap<>();
@@ -47,16 +41,15 @@ public class UsersManager extends SimpleObjectManager {
}
@Override
- protected void addNewItem(BaseModel item) {
- super.addNewItem(item);
- putToken((User) item);
+ protected void addNewItem(User user) {
+ super.addNewItem(user);
+ putToken(user);
}
@Override
- protected void updateCachedItem(BaseModel item) {
- User user = (User) item;
- User cachedUser = getById(item.getId());
- super.updateCachedItem(item);
+ protected void updateCachedItem(User user) {
+ User cachedUser = getById(user.getId());
+ super.updateCachedItem(user);
if (user.getToken() != null) {
usersTokens.put(user.getToken(), user.getId());
}