diff options
author | Abyss777 <abyss@fox5.ru> | 2017-07-26 15:20:22 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-07-26 15:25:14 +0500 |
commit | 82edf57e1b93d5a5ca34294dc62e3620889c2341 (patch) | |
tree | c862fe276147f3292289f617db22e4bb723b2268 /src/org/traccar/database/UsersManager.java | |
parent | bbcca3d65106069018e93a69b85290c075b128db (diff) | |
download | trackermap-server-82edf57e1b93d5a5ca34294dc62e3620889c2341.tar.gz trackermap-server-82edf57e1b93d5a5ca34294dc62e3620889c2341.tar.bz2 trackermap-server-82edf57e1b93d5a5ca34294dc62e3620889c2341.zip |
Override getById in all managers
Diffstat (limited to 'src/org/traccar/database/UsersManager.java')
-rw-r--r-- | src/org/traccar/database/UsersManager.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/database/UsersManager.java b/src/org/traccar/database/UsersManager.java index cb4ea623f..e53409b4f 100644 --- a/src/org/traccar/database/UsersManager.java +++ b/src/org/traccar/database/UsersManager.java @@ -32,6 +32,11 @@ 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<>(); @@ -50,7 +55,7 @@ public class UsersManager extends SimpleObjectManager { @Override protected void updateCachedItem(BaseModel item) { User user = (User) item; - User cachedUser = (User) getById(item.getId()); + User cachedUser = getById(item.getId()); super.updateCachedItem(item); if (user.getToken() != null) { usersTokens.put(user.getToken(), user.getId()); @@ -62,7 +67,7 @@ public class UsersManager extends SimpleObjectManager { @Override protected void removeCachedItem(long userId) { - User cachedUser = (User) getById(userId); + User cachedUser = getById(userId); if (cachedUser != null) { String userToken = cachedUser.getToken(); super.removeCachedItem(userId); @@ -81,7 +86,7 @@ public class UsersManager extends SimpleObjectManager { } public User getUserByToken(String token) { - return (User) getById(usersTokens.get(token)); + return getById(usersTokens.get(token)); } } |