use of org.thingsboard.server.common.data.device.profile.RepeatingAlarmConditionSpec in project thingsboard by thingsboard.
the class ProfileState method addEntityKeysFromAlarmConditionSpec.
private void addEntityKeysFromAlarmConditionSpec(AlarmRule alarmRule) {
AlarmConditionSpec spec = alarmRule.getCondition().getSpec();
if (spec == null) {
return;
}
AlarmConditionSpecType specType = spec.getType();
switch(specType) {
case DURATION:
DurationAlarmConditionSpec duration = (DurationAlarmConditionSpec) spec;
if (duration.getPredicate().getDynamicValue() != null && duration.getPredicate().getDynamicValue().getSourceAttribute() != null) {
entityKeys.add(new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, duration.getPredicate().getDynamicValue().getSourceAttribute()));
}
break;
case REPEATING:
RepeatingAlarmConditionSpec repeating = (RepeatingAlarmConditionSpec) spec;
if (repeating.getPredicate().getDynamicValue() != null && repeating.getPredicate().getDynamicValue().getSourceAttribute() != null) {
entityKeys.add(new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, repeating.getPredicate().getDynamicValue().getSourceAttribute()));
}
break;
}
}
Aggregations