aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/storage
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-03 17:06:30 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-03 17:06:30 -0700
commit4030d3207c157a3fcee2653c18440898b6b2a2e6 (patch)
treeb7e04a72bd369f75871edf832f7ff58198001a85 /src/main/java/org/traccar/storage
parent65b0f9c5398ddcb28018cb1963108534c638b1f4 (diff)
downloadtrackermap-server-4030d3207c157a3fcee2653c18440898b6b2a2e6.tar.gz
trackermap-server-4030d3207c157a3fcee2653c18440898b6b2a2e6.tar.bz2
trackermap-server-4030d3207c157a3fcee2653c18440898b6b2a2e6.zip
Remove attributes manager
Diffstat (limited to 'src/main/java/org/traccar/storage')
-rw-r--r--src/main/java/org/traccar/storage/DatabaseStorage.java4
-rw-r--r--src/main/java/org/traccar/storage/MemoryStorage.java4
-rw-r--r--src/main/java/org/traccar/storage/Storage.java13
3 files changed, 15 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/storage/DatabaseStorage.java b/src/main/java/org/traccar/storage/DatabaseStorage.java
index e4e4f3294..91dd6b077 100644
--- a/src/main/java/org/traccar/storage/DatabaseStorage.java
+++ b/src/main/java/org/traccar/storage/DatabaseStorage.java
@@ -15,6 +15,7 @@
*/
package org.traccar.storage;
+import org.traccar.model.BaseModel;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.GroupedModel;
@@ -116,7 +117,8 @@ public class DatabaseStorage extends Storage {
@Override
public List<Permission> getPermissions(
- Class<?> ownerClass, long ownerId, Class<?> propertyClass, long propertyId) throws StorageException {
+ Class<? extends BaseModel> ownerClass, long ownerId,
+ Class<? extends BaseModel> propertyClass, long propertyId) throws StorageException {
StringBuilder query = new StringBuilder("SELECT * FROM ");
query.append(Permission.getStorageName(ownerClass, propertyClass));
var conditions = new LinkedList<Condition>();
diff --git a/src/main/java/org/traccar/storage/MemoryStorage.java b/src/main/java/org/traccar/storage/MemoryStorage.java
index 71e895428..f19897ff8 100644
--- a/src/main/java/org/traccar/storage/MemoryStorage.java
+++ b/src/main/java/org/traccar/storage/MemoryStorage.java
@@ -15,6 +15,7 @@
*/
package org.traccar.storage;
+import org.traccar.model.BaseModel;
import org.traccar.model.Pair;
import org.traccar.model.Permission;
import org.traccar.storage.query.Request;
@@ -54,7 +55,8 @@ public class MemoryStorage extends Storage {
@Override
public List<Permission> getPermissions(
- Class<?> ownerClass, long ownerId, Class<?> propertyClass, long propertyId) {
+ Class<? extends BaseModel> ownerClass, long ownerId,
+ Class<? extends BaseModel> propertyClass, long propertyId) {
return getPermissionsSet(ownerClass, propertyClass).stream()
.filter(pair -> ownerId == 0 || pair.getFirst().equals(ownerId))
.filter(pair -> propertyId == 0 || pair.getSecond().equals(propertyId))
diff --git a/src/main/java/org/traccar/storage/Storage.java b/src/main/java/org/traccar/storage/Storage.java
index 22b5aaedc..62dba0165 100644
--- a/src/main/java/org/traccar/storage/Storage.java
+++ b/src/main/java/org/traccar/storage/Storage.java
@@ -15,6 +15,7 @@
*/
package org.traccar.storage;
+import org.traccar.model.BaseModel;
import org.traccar.model.Permission;
import org.traccar.storage.query.Request;
@@ -31,24 +32,28 @@ public abstract class Storage {
public abstract void removeObject(Class<?> clazz, Request request) throws StorageException;
public abstract List<Permission> getPermissions(
- Class<?> ownerClass, long ownerId, Class<?> propertyClass, long propertyId) throws StorageException;
+ Class<? extends BaseModel> ownerClass, long ownerId,
+ Class<? extends BaseModel> propertyClass, long propertyId) throws StorageException;
public abstract void addPermission(Permission permission) throws StorageException;
public abstract void removePermission(Permission permission) throws StorageException;
public List<Permission> getPermissions(
- Class<?> ownerClass, Class<?> propertyClass) throws StorageException {
+ Class<? extends BaseModel> ownerClass,
+ Class<? extends BaseModel> propertyClass) throws StorageException {
return getPermissions(ownerClass, 0, propertyClass, 0);
}
public List<Permission> getPermissions(
- Class<?> ownerClass, long ownerId, Class<?> propertyClass) throws StorageException {
+ Class<? extends BaseModel> ownerClass, long ownerId,
+ Class<? extends BaseModel> propertyClass) throws StorageException {
return getPermissions(ownerClass, ownerId, propertyClass, 0);
}
public List<Permission> getPermissions(
- Class<?> ownerClass, Class<?> propertyClass, long propertyId) throws StorageException {
+ Class<? extends BaseModel> ownerClass,
+ Class<? extends BaseModel> propertyClass, long propertyId) throws StorageException {
return getPermissions(ownerClass, 0, propertyClass, propertyId);
}