diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/database/DriversManager.java | 5 | ||||
-rw-r--r-- | src/org/traccar/database/SimpleObjectManager.java | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java index e3ae07a65..f843568b4 100644 --- a/src/org/traccar/database/DriversManager.java +++ b/src/org/traccar/database/DriversManager.java @@ -16,7 +16,6 @@ */ package org.traccar.database; -import java.sql.SQLException; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -32,8 +31,8 @@ public class DriversManager extends ExtendedObjectManager { } @Override - public void addItem(BaseModel item) throws SQLException { - super.addItem(item); + protected void addNewItem(BaseModel item) { + super.addNewItem(item); driversByUniqueId.put(((Driver) item).getUniqueId(), (Driver) item); } diff --git a/src/org/traccar/database/SimpleObjectManager.java b/src/org/traccar/database/SimpleObjectManager.java index 031f91fc5..0f6a9e6a4 100644 --- a/src/org/traccar/database/SimpleObjectManager.java +++ b/src/org/traccar/database/SimpleObjectManager.java @@ -99,7 +99,7 @@ public abstract class SimpleObjectManager { if (items.containsKey(item.getId())) { updateCachedItem(item); } else { - items.put(item.getId(), item); + addNewItem(item); } } for (Long cachedItemId : items.keySet()) { @@ -127,9 +127,13 @@ public abstract class SimpleObjectManager { } } + protected void addNewItem(BaseModel item) { + items.put(item.getId(), item); + } + public void addItem(BaseModel item) throws SQLException { dataManager.addObject(item); - items.put(item.getId(), item); + addNewItem(item); } protected void updateCachedItem(BaseModel item) { |