Set notificationRuleId in TbCreateAlarmNode
This commit is contained in:
		
							parent
							
								
									a4ce6252de
								
							
						
					
					
						commit
						17e4b322c1
					
				@ -184,6 +184,7 @@ public class TbCreateAlarmNode extends TbAbstractAlarmNode<TbCreateAlarmNodeConf
 | 
			
		||||
                existingAlarm.setDetails(details);
 | 
			
		||||
            }
 | 
			
		||||
            existingAlarm.setEndTs(System.currentTimeMillis());
 | 
			
		||||
            existingAlarm.setNotificationRuleId(config.getNotificationRuleId());
 | 
			
		||||
            return ctx.getAlarmService().createOrUpdateAlarm(existingAlarm);
 | 
			
		||||
        }, ctx.getDbCallbackExecutor());
 | 
			
		||||
 | 
			
		||||
@ -205,6 +206,7 @@ public class TbCreateAlarmNode extends TbAbstractAlarmNode<TbCreateAlarmNodeConf
 | 
			
		||||
                .startTs(ts)
 | 
			
		||||
                .endTs(ts)
 | 
			
		||||
                .details(details)
 | 
			
		||||
                .notificationRuleId(config.getNotificationRuleId())
 | 
			
		||||
                .build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@ package org.thingsboard.rule.engine.action;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import org.thingsboard.rule.engine.api.NodeConfiguration;
 | 
			
		||||
import org.thingsboard.server.common.data.alarm.AlarmSeverity;
 | 
			
		||||
import org.thingsboard.server.common.data.id.NotificationRuleId;
 | 
			
		||||
import org.thingsboard.server.common.data.script.ScriptLanguage;
 | 
			
		||||
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
@ -36,6 +37,8 @@ public class TbCreateAlarmNodeConfiguration extends TbAbstractAlarmNodeConfigura
 | 
			
		||||
 | 
			
		||||
    private List<String> relationTypes;
 | 
			
		||||
 | 
			
		||||
    private NotificationRuleId notificationRuleId;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public TbCreateAlarmNodeConfiguration defaultConfiguration() {
 | 
			
		||||
        TbCreateAlarmNodeConfiguration configuration = new TbCreateAlarmNodeConfiguration();
 | 
			
		||||
 | 
			
		||||
@ -241,6 +241,7 @@ class AlarmState {
 | 
			
		||||
            // Skip update if severity is decreased.
 | 
			
		||||
            if (severity.ordinal() <= oldSeverity.ordinal()) {
 | 
			
		||||
                currentAlarm.setDetails(createDetails(ruleState));
 | 
			
		||||
                currentAlarm.setNotificationRuleId(alarmDefinition.getNotificationRuleId());
 | 
			
		||||
                if (!oldSeverity.equals(severity)) {
 | 
			
		||||
                    currentAlarm.setSeverity(severity);
 | 
			
		||||
                    currentAlarm = ctx.getAlarmService().createOrUpdateAlarm(currentAlarm);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user