aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/Context.java2
-rw-r--r--src/org/traccar/api/BaseObjectResource.java13
2 files changed, 6 insertions, 9 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 75a7d179b..306a37e83 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -378,7 +378,7 @@ public final class Context {
identityManager = testIdentityManager;
}
- public static <T extends BaseModel> BaseObjectManager<T> getManager(Class<? extends BaseModel> clazz) {
+ public static <T extends BaseModel> BaseObjectManager<T> getManager(Class<T> clazz) {
if (clazz.equals(Device.class)) {
return (BaseObjectManager<T>) deviceManager;
} else if (clazz.equals(Group.class)) {
diff --git a/src/org/traccar/api/BaseObjectResource.java b/src/org/traccar/api/BaseObjectResource.java
index 11e9a5d01..ea5d4966f 100644
--- a/src/org/traccar/api/BaseObjectResource.java
+++ b/src/org/traccar/api/BaseObjectResource.java
@@ -34,7 +34,7 @@ import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.User;
-public class BaseObjectResource<T extends BaseModel> extends BaseResource {
+public abstract class BaseObjectResource<T extends BaseModel> extends BaseResource {
private Class<T> baseClass;
@@ -57,8 +57,7 @@ public class BaseObjectResource<T extends BaseModel> extends BaseResource {
if (manager instanceof SimpleObjectManager) {
((SimpleObjectManager<T>) manager).refreshUserItems();
- }
- if (baseClass.equals(Group.class) || baseClass.equals(Device.class)) {
+ } else if (baseClass.equals(Group.class) || baseClass.equals(Device.class)) {
Context.getPermissionsManager().refreshDeviceAndGroupPermissions();
Context.getPermissionsManager().refreshAllExtendedPermissions();
}
@@ -71,8 +70,7 @@ public class BaseObjectResource<T extends BaseModel> extends BaseResource {
Context.getPermissionsManager().checkReadonly(getUserId());
if (baseClass.equals(Device.class)) {
Context.getPermissionsManager().checkDeviceReadonly(getUserId());
- }
- if (baseClass.equals(User.class)) {
+ } else if (baseClass.equals(User.class)) {
User before = Context.getPermissionsManager().getUser(entity.getId());
Context.getPermissionsManager().checkUserUpdate(getUserId(), before, (User) entity);
}
@@ -83,8 +81,7 @@ public class BaseObjectResource<T extends BaseModel> extends BaseResource {
if (baseClass.equals(Group.class) || baseClass.equals(Device.class)) {
Context.getPermissionsManager().refreshDeviceAndGroupPermissions();
Context.getPermissionsManager().refreshAllExtendedPermissions();
- }
- if (baseClass.equals(User.class) && Context.getNotificationManager() != null) {
+ } else if (baseClass.equals(User.class) && Context.getNotificationManager() != null) {
Context.getNotificationManager().refresh();
}
return Response.ok(entity).build();
@@ -116,7 +113,7 @@ public class BaseObjectResource<T extends BaseModel> extends BaseResource {
Context.getPermissionsManager().refreshAllExtendedPermissions();
}
}
- // deprecated
+ // Next should be removed with Attribute Aliases
if (baseClass.equals(Device.class)) {
Context.getAliasesManager().removeDevice(id);
}