Refactoring Device Profile upgrade
This commit is contained in:
parent
22ce8cf063
commit
5599ab5650
@ -147,22 +147,22 @@ public class DefaultDataUpdateService implements DataUpdateService {
|
||||
if (deviceProfile.getProfileData().has("alarms") &&
|
||||
!deviceProfile.getProfileData().get("alarms").isNull()) {
|
||||
boolean isUpdated = false;
|
||||
JsonNode array = deviceProfile.getProfileData().get("alarms");
|
||||
for (JsonNode node : array) {
|
||||
if (node.has("createRules")) {
|
||||
JsonNode createRules = node.get("createRules");
|
||||
JsonNode alarms = deviceProfile.getProfileData().get("alarms");
|
||||
for (JsonNode alarm : alarms) {
|
||||
if (alarm.has("createRules")) {
|
||||
JsonNode createRules = alarm.get("createRules");
|
||||
for (AlarmSeverity severity : AlarmSeverity.values()) {
|
||||
if (createRules.has(severity.name())) {
|
||||
JsonNode spec = createRules.get(severity.name()).get("condition").get("spec");
|
||||
boolean convertResult = convertDeviceProfileAlarmRulesForVersion330(spec);
|
||||
isUpdated = convertResult || isUpdated;
|
||||
if (convertDeviceProfileAlarmRulesForVersion330(spec))
|
||||
isUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.has("clearRule") && !node.get("clearRule").isNull()) {
|
||||
JsonNode spec = node.get("clearRule").get("condition").get("spec");
|
||||
boolean convertResult = convertDeviceProfileAlarmRulesForVersion330(spec);
|
||||
isUpdated = convertResult || isUpdated;
|
||||
if (alarm.has("clearRule") && !alarm.get("clearRule").isNull()) {
|
||||
JsonNode spec = alarm.get("clearRule").get("condition").get("spec");
|
||||
if (convertDeviceProfileAlarmRulesForVersion330(spec))
|
||||
isUpdated = true;
|
||||
}
|
||||
}
|
||||
if (isUpdated) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user