aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/SimpleObjectManager.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-07-20 17:12:29 +0500
committerAbyss777 <abyss@fox5.ru>2017-07-20 17:12:29 +0500
commite00fbfa466b17e94f59e6ff8fefb83f08999b3ec (patch)
tree61302b7e3535f75925a2896a358ba0bb2492ca71 /src/org/traccar/database/SimpleObjectManager.java
parent0d5a1b36c704f3a79eceb2a1f19894f0438eb1b0 (diff)
downloadtrackermap-server-e00fbfa466b17e94f59e6ff8fefb83f08999b3ec.tar.gz
trackermap-server-e00fbfa466b17e94f59e6ff8fefb83f08999b3ec.tar.bz2
trackermap-server-e00fbfa466b17e94f59e6ff8fefb83f08999b3ec.zip
Rename Identifiable and Extensible to BaseModel and ExtendedModel
Diffstat (limited to 'src/org/traccar/database/SimpleObjectManager.java')
-rw-r--r--src/org/traccar/database/SimpleObjectManager.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/org/traccar/database/SimpleObjectManager.java b/src/org/traccar/database/SimpleObjectManager.java
index f5f807850..aae407b56 100644
--- a/src/org/traccar/database/SimpleObjectManager.java
+++ b/src/org/traccar/database/SimpleObjectManager.java
@@ -27,20 +27,20 @@ import java.util.concurrent.ConcurrentHashMap;
import org.traccar.Context;
import org.traccar.helper.Log;
import org.traccar.model.BaseUserPermission;
-import org.traccar.model.Identifiable;
+import org.traccar.model.BaseModel;
public abstract class SimpleObjectManager {
private final DataManager dataManager;
- private final Map<Long, Identifiable> items = new ConcurrentHashMap<>();
+ private final Map<Long, BaseModel> items = new ConcurrentHashMap<>();
private final Map<Long, Set<Long>> userItems = new ConcurrentHashMap<>();
- private Class<? extends Identifiable> baseClass;
+ private Class<? extends BaseModel> baseClass;
private Class<? extends BaseUserPermission> permissionClass;
protected SimpleObjectManager(DataManager dataManager,
- Class<? extends Identifiable> baseClass,
+ Class<? extends BaseModel> baseClass,
Class<? extends BaseUserPermission> permissionClass) {
this.dataManager = dataManager;
this.baseClass = baseClass;
@@ -51,11 +51,11 @@ public abstract class SimpleObjectManager {
return dataManager;
}
- protected final Class<? extends Identifiable> getBaseClass() {
+ protected final Class<? extends BaseModel> getBaseClass() {
return baseClass;
}
- public final Identifiable getById(long itemId) {
+ public final BaseModel getById(long itemId) {
return items.get(itemId);
}
@@ -63,7 +63,7 @@ public abstract class SimpleObjectManager {
items.clear();
}
- protected final void putItem(long itemId, Identifiable item) {
+ protected final void putItem(long itemId, BaseModel item) {
items.put(itemId, item);
}
@@ -90,7 +90,7 @@ public abstract class SimpleObjectManager {
if (dataManager != null) {
try {
clearItems();
- for (Identifiable item : dataManager.getObjects(this.baseClass)) {
+ for (BaseModel item : dataManager.getObjects(this.baseClass)) {
putItem(item.getId(), item);
}
} catch (SQLException error) {
@@ -113,18 +113,18 @@ public abstract class SimpleObjectManager {
}
}
- public void addItem(Identifiable item) throws SQLException {
+ public void addItem(BaseModel item) throws SQLException {
dataManager.addObject(item);
putItem(item.getId(), item);
}
- public void updateItem(Identifiable item) throws SQLException {
+ public void updateItem(BaseModel item) throws SQLException {
dataManager.updateObject(item);
putItem(item.getId(), item);
}
public void removeItem(long itemId) throws SQLException {
- Identifiable item = getById(itemId);
+ BaseModel item = getById(itemId);
if (item != null) {
dataManager.removeObject(item.getClass(), itemId);
removeCachedItem(itemId);