aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/model/Permission.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-25 13:33:35 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-25 13:33:35 -0700
commitc53d98c668af9c79767e22964f05c7bf7dc866f2 (patch)
tree42d664009487232e3a21514bb5ab52c7571262a6 /src/main/java/org/traccar/model/Permission.java
parent5a732a26c85785a9b801583f2fff0ce47314aa03 (diff)
downloadtrackermap-server-c53d98c668af9c79767e22964f05c7bf7dc866f2.tar.gz
trackermap-server-c53d98c668af9c79767e22964f05c7bf7dc866f2.tar.bz2
trackermap-server-c53d98c668af9c79767e22964f05c7bf7dc866f2.zip
Integrate broadcast service
Diffstat (limited to 'src/main/java/org/traccar/model/Permission.java')
-rw-r--r--src/main/java/org/traccar/model/Permission.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/model/Permission.java b/src/main/java/org/traccar/model/Permission.java
index 41dfa43e4..0b2f0584f 100644
--- a/src/main/java/org/traccar/model/Permission.java
+++ b/src/main/java/org/traccar/model/Permission.java
@@ -54,10 +54,10 @@ public class Permission {
this.data = data;
var iterator = data.entrySet().iterator();
var owner = iterator.next();
- ownerClass = CLASSES.get(owner.getKey().substring(0, owner.getKey().length() - 2));
+ ownerClass = getKeyClass(owner.getKey());
ownerId = owner.getValue();
var property = iterator.next();
- propertyClass = CLASSES.get(property.getKey().substring(0, property.getKey().length() - 2));
+ propertyClass = getKeyClass(property.getKey());
propertyId = property.getValue();
}
@@ -73,6 +73,10 @@ public class Permission {
data.put(getKey(propertyClass), propertyId);
}
+ public static Class<? extends BaseModel> getKeyClass(String key) {
+ return CLASSES.get(key.substring(0, key.length() - 2));
+ }
+
public static String getKey(Class<?> clazz) {
return Introspector.decapitalize(clazz.getSimpleName()) + "Id";
}