fixing invalid attribute

try_it
Amalka Subasinghe 2 years ago
parent 800694de97
commit 44b5b4f44d

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

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

Loading…
Cancel
Save