aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/storage
diff options
context:
space:
mode:
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);
}