fixing invalid attribute

traccar-v5.0.15-sync
Amalka Subasinghe 2 years ago
parent 800694de97
commit 44b5b4f44d

@ -872,14 +872,14 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
DeviceManagementProviderService deviceManagementProviderService =
DeviceMgtAPIUtils.getDeviceManagementService();
int validityTime = 3600;
List<String> mqttTopicStructure = new ArrayList<>();
List<String> mqttEventTopicStructure = new ArrayList<>();
try {
DeviceType deviceType = deviceManagementProviderService.getDeviceType(type);
if (deviceType != null) {
if (deviceType.getDeviceTypeMetaDefinition().isLongLivedToken()) {
validityTime = Integer.MAX_VALUE;
}
mqttTopicStructure = deviceType.getDeviceTypeMetaDefinition().getMqttTopicStructures();
mqttEventTopicStructure = deviceType.getDeviceTypeMetaDefinition().getMqttEventTopicStructures();
} else {
String msg = "Device not found, device id : " + id + ", device type : " + type;
log.error(msg);
@ -907,9 +907,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
StringBuilder scopes = new StringBuilder("device_" + type.replace(" ", "")
.replace("_", "") + "_" + id);
for (String topic : mqttTopicStructure) {
if (topic.contains("<deviceId>")) {
topic = topic.replace("<deviceId>", id);
for (String topic : mqttEventTopicStructure) {
if (topic.contains("${deviceId}")) {
topic = topic.replace("${deviceId}", id);
}
topic = topic.replace("/",":");
scopes.append(" perm:topic:sub:".concat(topic));

@ -20,7 +20,7 @@ public class DeviceTypeMetaDefinition {
private String description;
private boolean isSharedWithAllTenants;
private List<String> mqttTopicStructures;
private List<String> mqttEventTopicStructures;
private boolean longLivedToken = false;
@ -89,12 +89,12 @@ public class DeviceTypeMetaDefinition {
isSharedWithAllTenants = sharedWithAllTenants;
}
public List<String> getMqttTopicStructures() {
return mqttTopicStructures;
public List<String> getMqttEventTopicStructures() {
return mqttEventTopicStructures;
}
public void setMqttTopicStructures(List<String> mqttTopicStructures) {
this.mqttTopicStructures = mqttTopicStructures;
public void setMqttEventTopicStructures(List<String> mqttEventTopicStructures) {
this.mqttEventTopicStructures = mqttEventTopicStructures;
}
public boolean isLongLivedToken() {

Loading…
Cancel
Save