Fix upgrade from version 3.2.2

This commit is contained in:
Swoq 2021-09-09 15:22:19 +03:00
parent a9460fa22a
commit 9e6b0a01cd

View File

@ -156,12 +156,16 @@ public class DefaultDataUpdateService implements DataUpdateService {
JsonNode createRules = node.get("createRules"); JsonNode createRules = node.get("createRules");
for (AlarmSeverity severity : AlarmSeverity.values()) { for (AlarmSeverity severity : AlarmSeverity.values()) {
if (createRules.has(severity.name())) { if (createRules.has(severity.name())) {
isUpdated = isUpdated || convertDeviceProfileAlarmRulesForVersion330(createRules.get(severity.name()).get("condition").get("spec")); JsonNode spec = createRules.get(severity.name()).get("condition").get("spec");
boolean convertResult = convertDeviceProfileAlarmRulesForVersion330(spec);
isUpdated = convertResult || isUpdated;
} }
} }
} }
if (node.has("clearRule") && !node.get("clearRule").isNull()) { if (node.has("clearRule") && !node.get("clearRule").isNull()) {
isUpdated = isUpdated || convertDeviceProfileAlarmRulesForVersion330(node.get("clearRule").get("condition").get("spec")); JsonNode spec = node.get("clearRule").get("condition").get("spec");
boolean convertResult = convertDeviceProfileAlarmRulesForVersion330(spec);
isUpdated = convertResult || isUpdated;
} }
} }
if (isUpdated) { if (isUpdated) {