diff options
20 files changed, 43 insertions, 43 deletions
diff --git a/src/org/traccar/database/AttributesManager.java b/src/org/traccar/database/AttributesManager.java index ebfdbc9b4..6531019d1 100644 --- a/src/org/traccar/database/AttributesManager.java +++ b/src/org/traccar/database/AttributesManager.java @@ -22,7 +22,7 @@ import org.traccar.model.AttributePermission; import org.traccar.model.Attribute; import org.traccar.model.DeviceAttribute; import org.traccar.model.GroupAttribute; -import org.traccar.model.Identifiable; +import org.traccar.model.BaseModel; public class AttributesManager extends ExtendedObjectManager { @@ -33,7 +33,7 @@ public class AttributesManager extends ExtendedObjectManager { } @Override - public void updateItem(Identifiable item) throws SQLException { + public void updateItem(BaseModel item) throws SQLException { Attribute attribute = (Attribute) item; getDataManager().updateObject(attribute); Attribute cachedAttribute = (Attribute) getById(item.getId()); diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 6c9cca86c..7497294a1 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -41,7 +41,7 @@ import org.traccar.helper.Log; import org.traccar.model.AttributeAlias; import org.traccar.model.Device; import org.traccar.model.Event; -import org.traccar.model.Identifiable; +import org.traccar.model.BaseModel; import org.traccar.model.Position; import org.traccar.model.Server; import org.traccar.model.Statistics; @@ -285,21 +285,21 @@ public class DataManager { return QueryBuilder.create(dataSource, getQuery(query)).executeQuery(clazz); } - public void addObject(Identifiable entity) throws SQLException { + public void addObject(BaseModel entity) throws SQLException { String query = "database.insert" + entity.getClass().getSimpleName(); entity.setId(QueryBuilder.create(dataSource, getQuery(query), true) .setObject(entity) .executeUpdate()); } - public void updateObject(Identifiable entity) throws SQLException { + public void updateObject(BaseModel entity) throws SQLException { String query = "database.update" + entity.getClass().getSimpleName(); QueryBuilder.create(dataSource, getQuery(query)) .setObject(entity) .executeUpdate(); } - public void removeObject(Class<? extends Identifiable> clazz, long entityId) throws SQLException { + public void removeObject(Class<? extends BaseModel> clazz, long entityId) throws SQLException { String query = "database.delete" + clazz.getSimpleName(); QueryBuilder.create(dataSource, getQuery(query)) .setLong("id", entityId) diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java index 9b01f1a70..dba06a37f 100644 --- a/src/org/traccar/database/DriversManager.java +++ b/src/org/traccar/database/DriversManager.java @@ -25,7 +25,7 @@ import org.traccar.model.DeviceDriver; import org.traccar.model.Driver; import org.traccar.model.DriverPermission; import org.traccar.model.GroupDriver; -import org.traccar.model.Identifiable; +import org.traccar.model.BaseModel; public class DriversManager extends ExtendedObjectManager { @@ -42,7 +42,7 @@ public class DriversManager extends ExtendedObjectManager { if (getDataManager() != null) { try { clearItems(); - for (Identifiable item : getDataManager().getObjects(getBaseClass())) { + for (BaseModel item : getDataManager().getObjects(getBaseClass())) { putItem(item.getId(), item); driversByUniqueId.put(((Driver) item).getUniqueId(), (Driver) item); } @@ -54,13 +54,13 @@ public class DriversManager extends ExtendedObjectManager { } @Override - public void addItem(Identifiable item) throws SQLException { + public void addItem(BaseModel item) throws SQLException { super.addItem(item); driversByUniqueId.put(((Driver) item).getUniqueId(), (Driver) item); } @Override - public void updateItem(Identifiable item) throws SQLException { + public void updateItem(BaseModel item) throws SQLException { Driver driver = (Driver) item; getDataManager().updateObject(driver); Driver cachedDriver = (Driver) getById(driver.getId()); diff --git a/src/org/traccar/database/ExtendedObjectManager.java b/src/org/traccar/database/ExtendedObjectManager.java index a6508f066..caad989c2 100644 --- a/src/org/traccar/database/ExtendedObjectManager.java +++ b/src/org/traccar/database/ExtendedObjectManager.java @@ -29,7 +29,7 @@ import org.traccar.model.BaseDevicePermission; import org.traccar.model.BaseGroupPermission; import org.traccar.model.BaseUserPermission; import org.traccar.model.Device; -import org.traccar.model.Identifiable; +import org.traccar.model.BaseModel; public abstract class ExtendedObjectManager extends SimpleObjectManager { @@ -41,7 +41,7 @@ public abstract class ExtendedObjectManager extends SimpleObjectManager { private Class<? extends BaseGroupPermission> groupPermissionClass; protected ExtendedObjectManager(DataManager dataManager, - Class<? extends Identifiable> baseClass, + Class<? extends BaseModel> baseClass, Class<? extends BaseUserPermission> permissionClass, Class<? extends BaseDevicePermission> devicePermissionClass, Class<? extends BaseGroupPermission> groupPermissionClass) { 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); diff --git a/src/org/traccar/model/Attribute.java b/src/org/traccar/model/Attribute.java index ab12cd2c4..45d40b3ec 100644 --- a/src/org/traccar/model/Attribute.java +++ b/src/org/traccar/model/Attribute.java @@ -16,7 +16,7 @@ */ package org.traccar.model; -public class Attribute extends Identifiable { +public class Attribute extends BaseModel { private String description; diff --git a/src/org/traccar/model/AttributeAlias.java b/src/org/traccar/model/AttributeAlias.java index 5aa8a5122..1599ab939 100644 --- a/src/org/traccar/model/AttributeAlias.java +++ b/src/org/traccar/model/AttributeAlias.java @@ -16,7 +16,7 @@ */ package org.traccar.model; -public class AttributeAlias extends Identifiable { +public class AttributeAlias extends BaseModel { private long deviceId; diff --git a/src/org/traccar/model/Identifiable.java b/src/org/traccar/model/BaseModel.java index f22cfe800..8bdb916e8 100644 --- a/src/org/traccar/model/Identifiable.java +++ b/src/org/traccar/model/BaseModel.java @@ -16,7 +16,7 @@ */ package org.traccar.model; -public class Identifiable { +public class BaseModel { private long id; diff --git a/src/org/traccar/model/Calendar.java b/src/org/traccar/model/Calendar.java index 55f696d50..3d855b1be 100644 --- a/src/org/traccar/model/Calendar.java +++ b/src/org/traccar/model/Calendar.java @@ -34,7 +34,7 @@ import net.fortuna.ical4j.model.Period; import net.fortuna.ical4j.model.component.CalendarComponent; import org.traccar.database.QueryIgnore; -public class Calendar extends Extensible { +public class Calendar extends ExtendedModel { private String name; diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java index 2324da532..6a13c2b77 100644 --- a/src/org/traccar/model/Device.java +++ b/src/org/traccar/model/Device.java @@ -18,7 +18,7 @@ package org.traccar.model; import java.util.Date; import java.util.List; -public class Device extends Extensible { +public class Device extends ExtendedModel { private String name; diff --git a/src/org/traccar/model/Driver.java b/src/org/traccar/model/Driver.java index 7a51d9151..05f52fd4d 100644 --- a/src/org/traccar/model/Driver.java +++ b/src/org/traccar/model/Driver.java @@ -16,7 +16,7 @@ */ package org.traccar.model; -public class Driver extends Extensible { +public class Driver extends ExtendedModel { private String name; diff --git a/src/org/traccar/model/Extensible.java b/src/org/traccar/model/ExtendedModel.java index 3b382838e..a4bf00e70 100644 --- a/src/org/traccar/model/Extensible.java +++ b/src/org/traccar/model/ExtendedModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.traccar.model; import java.util.LinkedHashMap; import java.util.Map; -public class Extensible extends Identifiable { +public class ExtendedModel extends BaseModel { private Map<String, Object> attributes = new LinkedHashMap<>(); diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java index dfb888852..21c196da9 100644 --- a/src/org/traccar/model/Geofence.java +++ b/src/org/traccar/model/Geofence.java @@ -26,7 +26,7 @@ import org.traccar.geofence.GeofencePolyline; import com.fasterxml.jackson.annotation.JsonIgnore; -public class Geofence extends Extensible { +public class Geofence extends ExtendedModel { public static final String TYPE_GEOFENCE_CILCLE = "geofenceCircle"; public static final String TYPE_GEOFENCE_POLYGON = "geofencePolygon"; diff --git a/src/org/traccar/model/Group.java b/src/org/traccar/model/Group.java index c21d43127..aad206aad 100644 --- a/src/org/traccar/model/Group.java +++ b/src/org/traccar/model/Group.java @@ -15,7 +15,7 @@ */ package org.traccar.model; -public class Group extends Extensible { +public class Group extends ExtendedModel { private String name; diff --git a/src/org/traccar/model/Message.java b/src/org/traccar/model/Message.java index ab472202b..dad9c20f0 100644 --- a/src/org/traccar/model/Message.java +++ b/src/org/traccar/model/Message.java @@ -15,7 +15,7 @@ */ package org.traccar.model; -public class Message extends Extensible { +public class Message extends ExtendedModel { private long deviceId; diff --git a/src/org/traccar/model/Notification.java b/src/org/traccar/model/Notification.java index 6c61cafaf..e7bb69903 100644 --- a/src/org/traccar/model/Notification.java +++ b/src/org/traccar/model/Notification.java @@ -15,7 +15,7 @@ */ package org.traccar.model; -public class Notification extends Extensible { +public class Notification extends ExtendedModel { private long userId; diff --git a/src/org/traccar/model/Server.java b/src/org/traccar/model/Server.java index 4ded65204..cd5b0624e 100644 --- a/src/org/traccar/model/Server.java +++ b/src/org/traccar/model/Server.java @@ -19,7 +19,7 @@ import java.util.TimeZone; import org.traccar.helper.Log; -public class Server extends Extensible { +public class Server extends ExtendedModel { public String getVersion() { return Log.getAppVersion(); diff --git a/src/org/traccar/model/Statistics.java b/src/org/traccar/model/Statistics.java index c7ae5af7a..2acf8514f 100644 --- a/src/org/traccar/model/Statistics.java +++ b/src/org/traccar/model/Statistics.java @@ -17,7 +17,7 @@ package org.traccar.model; import java.util.Date; -public class Statistics extends Extensible { +public class Statistics extends ExtendedModel { private Date captureTime; diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java index 366ced503..6e6a079c2 100644 --- a/src/org/traccar/model/User.java +++ b/src/org/traccar/model/User.java @@ -21,7 +21,7 @@ import org.traccar.helper.Hashing; import java.util.Date; import java.util.TimeZone; -public class User extends Extensible { +public class User extends ExtendedModel { private String name; diff --git a/src/org/traccar/notification/PropertiesProvider.java b/src/org/traccar/notification/PropertiesProvider.java index e7cac8d0f..2fea901af 100644 --- a/src/org/traccar/notification/PropertiesProvider.java +++ b/src/org/traccar/notification/PropertiesProvider.java @@ -16,27 +16,27 @@ package org.traccar.notification; import org.traccar.Config; -import org.traccar.model.Extensible; +import org.traccar.model.ExtendedModel; public class PropertiesProvider { private Config config; - private Extensible extensible; + private ExtendedModel extendedModel; public PropertiesProvider(Config config) { this.config = config; } - public PropertiesProvider(Extensible extensible) { - this.extensible = extensible; + public PropertiesProvider(ExtendedModel extendedModel) { + this.extendedModel = extendedModel; } public String getString(String key) { if (config != null) { return config.getString(key); } else { - return extensible.getString(key); + return extendedModel.getString(key); } } |